/* =========================================================
   LEGAL MANAGEMENT SYSTEM
   File: css/show_table.css

   Design:
   Professional | Responsive | Desktop Fit | Print Friendly
   Desktop: Full table within page width
   Mobile: Horizontal table scroll
   ========================================================= */


/* =========================================================
   1. GLOBAL SETTINGS
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #263449;
    background: #f4f6fa;
    line-height: 1.5;
}


/* =========================================================
   2. TABLE WRAPPER
   ========================================================= */

.table-wrapper {
    width: calc(100% - 30px);
    max-width: 100%;
    margin: 12px auto 35px;
    padding: 0;
    overflow-x: auto;
    overflow-y: visible;
    background: #ffffff;
    border: 1px solid #dce3ed;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(25, 42, 70, 0.07);
    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   3. MAIN TABLE
   ========================================================= */

.table {
    width: 100%;
    min-width: 0;
    margin: 0;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
    background: #ffffff;
    font-size: 12px;
    color: #263449;
}


/* =========================================================
   4. TABLE HEADER
   ========================================================= */

.table tr.head {
    background: #283e63;
    color: #ffffff;
}

.table .head th {
    padding: 11px 6px;
    background: #283e63;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #405579;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}


/* =========================================================
   5. TABLE BODY
   ========================================================= */

.table tbody tr {
    background: #ffffff;
    transition: background-color 0.18s ease;
}

.table tbody tr:nth-child(even) {
    background: #f7f9fc;
}

.table tbody tr:hover {
    background: #eaf2ff;
}

.table td {
    padding: 9px 6px;
    font-size: 11.5px;
    line-height: 1.45;
    vertical-align: middle;
    text-align: center;
    border: 1px solid #e0e6ef;
    overflow-wrap: anywhere;
    word-break: normal;
    color: #344256;
}

/* Left-aligned content */

.table td.left_side {
    text-align: left;
}

/* Right-aligned content */

.table td.right_side {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Keep table content readable */

.table td,
.table th {
    min-width: 0;
}


/* =========================================================
   6. COLUMN WIDTHS — DESKTOP
   Total width = 100%
   ========================================================= */

/* Defendant Name & Code */

.table th.defendant_col,
.table td.defendant_col {
    width: 16%;
    text-align: left;
}

/* Case Number */

.table th.case_col,
.table td.case_col {
    width: 8%;
}

/* Input Date */

.table th.date_col,
.table td.date_col {
    width: 8%;
}

/* Legal Expenses */

.table th.amount_col,
.table td.amount_col {
    width: 8%;
}

/* Legal Expenses Receipt */

.table th.receipt_col,
.table td.receipt_col {
    width: 10%;
}

/* Recovery After Litigation */

.table th.recovery_col,
.table td.recovery_col {
    width: 11%;
}

/* Next Hearing Date */

.table th.hearing_col,
.table td.hearing_col {
    width: 9%;
}

/* Current Case Status */

.table th.status_col,
.table td.status_col {
    width: 20%;
}

.table th.status_col {
    text-align: center;
}

.table td.status_col {
    text-align: left;
}

/* Edit and Delete */

.table th.action_col,
.table td.action_col {
    width: 5%;
    min-width: 0;
    padding: 5px 2px;
    text-align: center;
    white-space: nowrap;
}


/* =========================================================
   7. ACTION BUTTONS — EDIT / DELETE
   ========================================================= */

.table td.action_col a,
.table td.action_col button,
.table td.action_col span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* Links styled as action buttons */

.table td.action_col a {
    width: 29px;
    height: 29px;
    margin: 2px auto;
    padding: 4px;
    border: 1px solid #d8e1ed;
    border-radius: 5px;
    background: #f1f5fb;
    color: #2d527f;
    text-decoration: none;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.table td.action_col a:hover {
    background: #dceaff;
    border-color: #91b5ed;
    color: #163e75;
    transform: translateY(-1px);
}

/* Delete link */

.table td.action_col a.delete,
.table td.action_col a.delete-btn,
.table td.action_col a[title="Delete"],
.table td.action_col a[title="Delete Case"] {
    background: #fff1f1;
    border-color: #f0caca;
    color: #c62828;
}

.table td.action_col a.delete:hover,
.table td.action_col a.delete-btn:hover,
.table td.action_col a[title="Delete"]:hover,
.table td.action_col a[title="Delete Case"]:hover {
    background: #c62828;
    border-color: #c62828;
    color: #ffffff;
}

/* Action icons */

.table td.action_col img {
    display: block;
    width: 17px;
    height: 17px;
    max-width: 100%;
    object-fit: contain;
}

/* Font icons, if used */

.table td.action_col i,
.table td.action_col svg {
    width: 16px;
    height: 16px;
    font-size: 15px;
}


/* =========================================================
   8. CASE STATUS
   ========================================================= */

.table td.status_col {
    font-weight: 500;
    color: #33445d;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* If status text is inside a span */

.table td.status_col span {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}


/* =========================================================
   9. PAGINATION
   ========================================================= */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 15px 10px;
    margin: 0;
    background: #ffffff;
    border-top: 1px solid #e1e7f0;
}

.pagination a,
.pagination span,
.pagination button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #d7e0ec;
    border-radius: 5px;
    background: #ffffff;
    color: #344967;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination a:hover,
.pagination button:hover {
    background: #eaf1fc;
    border-color: #9db7dc;
    color: #203f6c;
}

.pagination .active,
.pagination span.active {
    background: #283e63;
    border-color: #283e63;
    color: #ffffff;
    font-weight: 700;
}


/* =========================================================
   10. OPTIONAL TABLE INFORMATION
   ========================================================= */

.table-info,
.table-summary {
    width: calc(100% - 30px);
    margin: 10px auto;
    padding: 10px 14px;
    border: 1px solid #dce3ed;
    border-radius: 6px;
    background: #ffffff;
    color: #344256;
    font-size: 12px;
}


/* =========================================================
   11. DESKTOP — FIT TABLE ON ONE PAGE WIDTH
   ========================================================= */

@media screen and (min-width: 1025px) {

    .table-wrapper {
        width: calc(100% - 30px);
        max-width: 100%;
        margin: 12px auto 40px;
        padding: 0;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .table {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        table-layout: fixed;
        font-size: 11px;
    }

    .table .head th {
        padding: 9px 4px;
        font-size: 10.5px;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .table td {
        padding: 8px 4px;
        font-size: 11px;
        line-height: 1.4;
    }

    .table th.defendant_col,
    .table td.defendant_col {
        width: 16%;
    }

    .table th.case_col,
    .table td.case_col {
        width: 8%;
    }

    .table th.date_col,
    .table td.date_col {
        width: 8%;
    }

    .table th.amount_col,
    .table td.amount_col {
        width: 8%;
    }

    .table th.receipt_col,
    .table td.receipt_col {
        width: 10%;
    }

    .table th.recovery_col,
    .table td.recovery_col {
        width: 11%;
    }

    .table th.hearing_col,
    .table td.hearing_col {
        width: 9%;
    }

    .table th.status_col,
    .table td.status_col {
        width: 20%;
    }

    .table th.action_col,
    .table td.action_col {
        width: 5%;
        padding: 4px 2px;
    }

    .table td.action_col a {
        width: 25px;
        height: 25px;
        padding: 3px;
    }

    .table td.action_col img {
        width: 15px;
        height: 15px;
    }

    .pagination {
        padding: 12px 8px;
    }
}


/* =========================================================
   12. TABLET
   ========================================================= */

@media screen and (min-width: 601px) and (max-width: 1024px) {

    .table-wrapper {
        width: calc(100% - 20px);
        margin: 10px auto 30px;
        overflow-x: auto;
    }

    .table {
        min-width: 1050px;
        table-layout: auto;
    }

    .table .head th {
        padding: 9px 6px;
        font-size: 11px;
    }

    .table td {
        padding: 8px 6px;
        font-size: 11px;
    }

    .table th.defendant_col,
    .table td.defendant_col {
        min-width: 170px;
    }

    .table th.status_col,
    .table td.status_col {
        min-width: 150px;
    }

    .table th.action_col,
    .table td.action_col {
        min-width: 55px;
    }
}


/* =========================================================
   13. MOBILE
   ========================================================= */

@media screen and (max-width: 600px) {

    body {
        font-size: 12px;
    }

    .table-wrapper {
        width: calc(100% - 16px);
        margin: 8px auto 25px;
        padding: 0;
        overflow-x: auto;
        overflow-y: visible;
        border-radius: 6px;
    }

    .table {
        width: 100%;
        min-width: 1050px;
        table-layout: auto;
        font-size: 11px;
    }

    .table .head th {
        padding: 9px 6px;
        font-size: 11px;
        line-height: 1.4;
    }

    .table td {
        padding: 8px 6px;
        font-size: 11px;
        line-height: 1.4;
    }

    .table th.defendant_col,
    .table td.defendant_col {
        min-width: 170px;
    }

    .table th.case_col,
    .table td.case_col {
        min-width: 90px;
    }

    .table th.date_col,
    .table td.date_col {
        min-width: 90px;
    }

    .table th.amount_col,
    .table td.amount_col {
        min-width: 90px;
    }

    .table th.receipt_col,
    .table td.receipt_col {
        min-width: 110px;
    }

    .table th.recovery_col,
    .table td.recovery_col {
        min-width: 110px;
    }

    .table th.hearing_col,
    .table td.hearing_col {
        min-width: 100px;
    }

    .table th.status_col,
    .table td.status_col {
        min-width: 145px;
    }

    .table th.action_col,
    .table td.action_col {
        min-width: 55px;
        padding: 5px 3px;
    }

    .table td.action_col a {
        width: 28px;
        height: 28px;
    }

    .pagination {
        gap: 4px;
        padding: 12px 6px;
    }

    .pagination a,
    .pagination span,
    .pagination button {
        min-width: 30px;
        min-height: 30px;
        padding: 5px 8px;
        font-size: 11px;
    }

    .table-info,
    .table-summary {
        width: calc(100% - 16px);
        padding: 9px 10px;
    }
}


/* =========================================================
   14. VERY SMALL MOBILE
   ========================================================= */

@media screen and (max-width: 360px) {

    .table-wrapper {
        width: calc(100% - 10px);
    }

    .table {
        min-width: 1000px;
    }

    .table .head th,
    .table td {
        padding: 7px 5px;
        font-size: 10.5px;
    }

    .table-info,
    .table-summary {
        width: calc(100% - 10px);
    }
}


/* =========================================================
   15. ACCESSIBILITY / REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .table tbody tr,
    .table td.action_col a,
    .pagination a,
    .pagination button {
        transition: none;
    }
}


/* =========================================================
   16. PRINT
   ========================================================= */

@media print {

    @page {
        size: landscape;
        margin: 8mm;
    }

    html,
    body {
        width: 100%;
        min-height: auto;
        margin: 0;
        padding: 0;
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 9px;
    }

    .table-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        overflow: visible;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 8px;
    }

    .table .head th {
        background: #e8edf4 !important;
        color: #000000 !important;
        border: 1px solid #777777;
        padding: 5px 3px;
        font-size: 8px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .table td {
        color: #000000 !important;
        border: 1px solid #999999;
        padding: 4px 3px;
        font-size: 8px;
        overflow-wrap: anywhere;
    }

    .table tbody tr:nth-child(even) {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .table td.action_col,
    .table th.action_col,
    .pagination {
        display: none !important;
    }

    .table tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}