/* EasyPrintDz CRM - Mobile Table Cards Fix V20 */
/* UI-only. No business logic. Fixes blank/weak table cards on mobile. */

@media (max-width: 640px){

    .overflow-x-auto,
    .table-responsive{
        overflow-x: visible !important;
    }

    table.epdz-mobile-table{
        width: 100% !important;
        border-collapse: separate !important;
        border-spacing: 0 12px !important;
        background: transparent !important;
    }

    table.epdz-mobile-table thead{
        display: none !important;
    }

    table.epdz-mobile-table tbody{
        display: block !important;
        width: 100% !important;
    }

    table.epdz-mobile-table tbody tr{
        display: block !important;
        width: 100% !important;
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 16px !important;
        padding: 10px 12px !important;
        margin: 0 0 12px 0 !important;
        box-shadow: 0 8px 22px rgba(15,23,42,.06) !important;
        overflow: hidden !important;
    }

    table.epdz-mobile-table tbody td{
        display: grid !important;
        grid-template-columns: 42% 58% !important;
        gap: 8px !important;
        align-items: start !important;
        width: 100% !important;
        min-height: 30px !important;
        padding: 8px 0 !important;
        border: 0 !important;
        border-bottom: 1px dashed #edf0f4 !important;
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        color: #111827 !important;
        background: transparent !important;
        text-align: left !important;
        font-size: 13.5px !important;
        line-height: 1.35 !important;
    }

    table.epdz-mobile-table tbody td:last-child{
        border-bottom: 0 !important;
    }

    table.epdz-mobile-table tbody td::before{
        content: attr(data-epdz-label);
        display: block !important;
        font-weight: 800 !important;
        color: #6b7280 !important;
        font-size: 12px !important;
        line-height: 1.35 !important;
        text-transform: none !important;
        letter-spacing: .01em !important;
    }

    table.epdz-mobile-table tbody td:first-child{
        font-weight: 800 !important;
        color: #111827 !important;
    }

    table.epdz-mobile-table tbody td:first-child::before{
        color: #2563eb !important;
    }

    table.epdz-mobile-table tbody td:empty{
        display: none !important;
    }

    table.epdz-mobile-table tbody td *{
        max-width: 100% !important;
        white-space: normal !important;
    }

    table.epdz-mobile-table tbody td a,
    table.epdz-mobile-table tbody td button,
    table.epdz-mobile-table tbody td .btn,
    table.epdz-mobile-table tbody td .inline-flex{
        min-height: 34px !important;
        border-radius: 10px !important;
        margin: 2px 3px 2px 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    table.epdz-mobile-table tbody td input,
    table.epdz-mobile-table tbody td select,
    table.epdz-mobile-table tbody td textarea{
        width: 100% !important;
        min-width: 0 !important;
    }

    table.epdz-mobile-table tbody td .badge,
    table.epdz-mobile-table tbody td [class*="badge"],
    table.epdz-mobile-table tbody td [class*="status"]{
        display: inline-flex !important;
        width: fit-content !important;
        max-width: 100% !important;
    }

    /* Better compact action cell */
    table.epdz-mobile-table tbody td[data-epdz-label*="Action"],
    table.epdz-mobile-table tbody td[data-epdz-label*="Actions"],
    table.epdz-mobile-table tbody td[data-epdz-label*="Manage"]{
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    table.epdz-mobile-table tbody td[data-epdz-label*="Action"]::before,
    table.epdz-mobile-table tbody td[data-epdz-label*="Actions"]::before,
    table.epdz-mobile-table tbody td[data-epdz-label*="Manage"]::before{
        margin-bottom: 2px !important;
    }
}

@media (max-width: 420px){
    table.epdz-mobile-table tbody tr{
        padding: 9px 10px !important;
        border-radius: 14px !important;
    }

    table.epdz-mobile-table tbody td{
        grid-template-columns: 44% 56% !important;
        gap: 7px !important;
        font-size: 13px !important;
    }

    table.epdz-mobile-table tbody td::before{
        font-size: 11.5px !important;
    }
}
