
/*
 * FCS COMMON TABLE SYSTEM
 * Single shared stylesheet for all FCS data tables.
 * Purpose:
 * - Clear, high-contrast header row
 * - Clearly visible S.No.
 * - Actions always visually separated
 * - Consistent professional appearance
 * - Responsive horizontal scrolling for wide tables
 * - Does not change application/data/save logic
 */

:root {
    --fcs-table-header: #123b61;
    --fcs-table-header-dark: #092c4c;
    --fcs-table-header-border: #8fb0ca;
    --fcs-table-header-text: #ffffff;

    --fcs-table-body: #ffffff;
    --fcs-table-body-alt: #f7fafc;
    --fcs-table-hover: #eef6fb;

    --fcs-table-line: #d8e2ea;
    --fcs-table-line-soft: #e8eef3;

    --fcs-table-serial-bg: #e1eef7;
    --fcs-table-serial-text: #092c4c;
    --fcs-table-serial-border: #aac1d2;

    --fcs-table-actions-bg: #edf4f8;
    --fcs-table-actions-border: #bdcedb;

    --fcs-table-edit-bg: #fffdf0;
    --fcs-table-edit-border: #7da7c7;

    --fcs-table-button-bg: #ffffff;
    --fcs-table-button-border: #b8c9d7;
    --fcs-table-button-text: #123b61;
    --fcs-table-button-hover: #eaf3f8;

    --fcs-table-shadow: 0 8px 24px rgba(16, 42, 67, .08);
}

/* =========================
   TABLE OUTER CONTAINER
   ========================= */

.table-shell,
.fcs-table-shell,
.fcs-table-container,
.fcs-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    background: var(--fcs-table-body);
    border: 1px solid var(--fcs-table-line);
    border-radius: 14px;
    box-shadow: var(--fcs-table-shadow);
    -webkit-overflow-scrolling: touch;
}

/* =========================
   BASE TABLE
   ========================= */

table,
table.fcs-polished-table,
table.fcs-table-ux {
    width: 100%;
    min-width: 820px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--fcs-table-body);
    color: #243746;
    font-family: inherit;
}

/* =========================
   COMPLETE HEADER ROW
   ========================= */

table thead,
table.fcs-polished-table thead,
table.fcs-table-ux thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

table thead tr,
table.fcs-polished-table thead tr,
table.fcs-table-ux thead tr {
    min-height: 52px;
}

table thead th,
table.fcs-polished-table thead th,
table.fcs-table-ux thead th {
    background: var(--fcs-table-header) !important;
    color: var(--fcs-table-header-text) !important;
    opacity: 1 !important;

    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;

    padding: 14px 13px !important;

    text-align: left !important;
    vertical-align: middle !important;

    white-space: nowrap !important;
    overflow: visible !important;

    border-top: 1px solid var(--fcs-table-header-dark) !important;
    border-right: 1px solid #365b79 !important;
    border-bottom: 3px solid var(--fcs-table-header-border) !important;
}

/* First and last header corners */
table thead th:first-child {
    border-top-left-radius: 10px;
}

table thead th:last-child {
    border-top-right-radius: 10px;
}

/* =========================
   S.NO. HEADER
   ========================= */

table thead th.serial-number-header,
table thead th[data-fcs-serial-header] {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;

    background: var(--fcs-table-header-dark) !important;
    color: #ffffff !important;

    text-align: center !important;
    font-size: 14px !important;
    font-weight: 900 !important;

    border-right: 3px solid var(--fcs-table-header-border) !important;
}

/* =========================
   ACTIONS HEADER
   ========================= */

table thead th.actions-header,
table thead th[data-fcs-action-header] {
    width: 235px !important;
    min-width: 235px !important;

    background: #1d527c !important;
    color: #ffffff !important;

    text-align: center !important;

    border-left: 3px solid var(--fcs-table-header-border) !important;
}

/* =========================
   BODY CELLS
   ========================= */

table tbody td,
table.fcs-polished-table tbody td,
table.fcs-table-ux tbody td {
    background: var(--fcs-table-body);
    color: #243746;

    padding: 11px 13px !important;

    border-right: 1px solid var(--fcs-table-line-soft);
    border-bottom: 1px solid var(--fcs-table-line);

    vertical-align: middle !important;
    font-size: 13px;
    line-height: 1.4;
}

table tbody tr:nth-child(even) td {
    background: var(--fcs-table-body-alt);
}

table tbody tr:hover td {
    background: var(--fcs-table-hover);
}

table tbody tr:last-child td {
    border-bottom: 0;
}

/* =========================
   S.NO. BODY CELLS
   ========================= */

table tbody td.serial-number-cell,
table tbody td[data-fcs-serial-cell] {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;

    background: var(--fcs-table-serial-bg) !important;
    color: var(--fcs-table-serial-text) !important;

    text-align: center !important;
    font-size: 14px !important;
    font-weight: 900 !important;

    border-right: 3px solid var(--fcs-table-serial-border) !important;
}

/* Alternate-row S.No. */
table tbody tr:nth-child(even) td.serial-number-cell,
table tbody tr:nth-child(even) td[data-fcs-serial-cell] {
    background: #d7e8f3 !important;
}

table tbody tr:hover td.serial-number-cell,
table tbody tr:hover td[data-fcs-serial-cell] {
    background: #cce1ee !important;
}

/* =========================
   ACTIONS BODY CELLS
   ========================= */

table tbody td.actions-cell,
table tbody td[data-fcs-actions-cell] {
    width: 235px !important;
    min-width: 235px !important;

    background: var(--fcs-table-actions-bg) !important;

    text-align: center !important;
    vertical-align: middle !important;

    border-left: 3px solid var(--fcs-table-actions-border);
}

table tbody tr:nth-child(even) td.actions-cell,
table tbody tr:nth-child(even) td[data-fcs-actions-cell] {
    background: #e7f0f5 !important;
}

table tbody tr:hover td.actions-cell,
table tbody tr:hover td[data-fcs-actions-cell] {
    background: #dceaf2 !important;
}

/* =========================
   EDITABLE CELLS
   ========================= */

table td[contenteditable="true"],
table th[contenteditable="true"] {
    outline: none;
}

table td[contenteditable="true"]:focus {
    background: var(--fcs-table-edit-bg) !important;
    box-shadow: inset 0 0 0 2px var(--fcs-table-edit-border);
}

table thead th[contenteditable="true"]:focus {
    background: #17476d !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 2px #a9cce6;
}

/* =========================
   ACTION BUTTONS
   ========================= */

table .actions-cell button,
table [data-fcs-actions-cell] button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 35px;

    margin: 3px;
    padding: 7px 11px;

    border: 1px solid var(--fcs-table-button-border);
    border-radius: 8px;

    background: var(--fcs-table-button-bg);
    color: var(--fcs-table-button-text);

    font: inherit;
    font-size: 12px;
    font-weight: 800;

    cursor: pointer;

    box-shadow: 0 1px 2px rgba(14, 44, 70, .05);

    transition:
        background .12s ease,
        border-color .12s ease,
        transform .12s ease,
        box-shadow .12s ease;
}

table .actions-cell button:hover,
table [data-fcs-actions-cell] button:hover {
    background: var(--fcs-table-button-hover);
    border-color: #88a8c1;

    box-shadow: 0 3px 10px rgba(19, 55, 86, .10);

    transform: translateY(-1px);
}

table .actions-cell button:disabled,
table [data-fcs-actions-cell] button:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* Hidden file controls remain hidden */
table .actions-cell input[type="file"],
table [data-fcs-actions-cell] input[type="file"] {
    display: none !important;
}

/* =========================
   SAVE STATUS
   ========================= */

.fcs-table-ux-save {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-height: 35px;

    margin: 0 0 10px auto;
    padding: 7px 13px;

    border: 1px solid #c9d5df;
    border-radius: 999px;

    background: #f5f8fa;
    color: #405465;

    font-size: 12px;
    font-weight: 800;
}

.fcs-table-ux-save .dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #8798a8;
}

.fcs-table-ux-save.saving {
    background: #fff7df;
    border-color: #e2c96c;
    color: #624e00;
}

.fcs-table-ux-save.saving .dot {
    background: #c18b00;
}

.fcs-table-ux-save.success {
    background: #eaf7ee;
    border-color: #94c7a2;
    color: #185c2d;
}

.fcs-table-ux-save.success .dot {
    background: #278848;
}

.fcs-table-ux-save.error {
    background: #fff0f0;
    border-color: #d99b9b;
    color: #842222;
}

.fcs-table-ux-save.error .dot {
    background: #ba3333;
}

/* Existing category-specific save messages */
.credits-save-status,
.digital-save-status,
.continuity-save-status,
.family-save-status,
.document-save-status,
.investment-save-status,
.medical-save-status,
.pension-save-status,
.schemes-save-status,
.tax-save-status,
.vehicle-save-status {
    font-weight: 750;
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 760px) {

    .table-shell,
    .fcs-table-shell,
    .fcs-table-container,
    .fcs-table-wrap {
        border-radius: 10px;
    }

    table,
    table.fcs-polished-table,
    table.fcs-table-ux {
        min-width: 820px;
    }

    table thead th.serial-number-header,
    table tbody td.serial-number-cell,
    table thead th[data-fcs-serial-header],
    table tbody td[data-fcs-serial-cell] {
        width: 68px !important;
        min-width: 68px !important;
        max-width: 68px !important;
    }

    table thead th.actions-header,
    table tbody td.actions-cell,
    table thead th[data-fcs-action-header],
    table tbody td[data-fcs-actions-cell] {
        width: 205px !important;
        min-width: 205px !important;
    }
}

/* FCS THREE-PLAN TABLE SEPARATION */
table.fcs-table-ux,
table.fcs-polished-table,
table.fcs-table-ux table {
    border: 1px solid #9aafc0 !important;
}
table.fcs-table-ux thead th,
table.fcs-polished-table thead th {
    border-right: 2px solid #587994 !important;
    border-bottom: 3px solid #7f9fb8 !important;
}
table.fcs-table-ux tbody td,
table.fcs-polished-table tbody td {
    border-right: 1px solid #c7d4df !important;
    border-bottom: 1px solid #c7d4df !important;
}
table.fcs-table-ux tbody tr:nth-child(even) td,
table.fcs-polished-table tbody tr:nth-child(even) td {
    background: #f5f8fa !important;
}
table.fcs-table-ux tbody td.serial-number-cell,
table.fcs-table-ux tbody td[data-fcs-serial-cell],
table.fcs-polished-table tbody td.serial-number-cell {
    border-right: 3px solid #9ab2c6 !important;
}
table.fcs-table-ux tbody td.actions-cell,
table.fcs-table-ux tbody td[data-fcs-actions-cell],
table.fcs-polished-table tbody td.actions-cell {
    border-left: 3px solid #afc2d1 !important;
}
