/* ═══════════════════════════════════════════════════════════
   Shared table component — used by home, declare-accident,
   vehicle-repair, and any page with the split-layout table.
   ═══════════════════════════════════════════════════════════ */

/* ── Layout structure ──────────────────────────────────── */

.theader .scrollable-theader,
.tbody-wrapper .right-side {
    width: calc(100% - 200px);
    min-width: 280px; /* να μην κρύβεται το δεξί τμήμα (πολλές στήλες) */
}

.theader,
.theader .scrollable-theader-wrapper .row,
.tbody-wrapper,
.right-side-wrapper .row {
    display: flex;
}

.static-theader,
.tbody-wrapper .left-side {
    width: 200px;
    flex: 0 0 200px;
}

.tbody .left-side {
    display: flex;
    flex-direction: column;
}

/* ── Column sizing (default: 9 cols, override with CSS var) */

.scrollable-theader-wrapper .row .th,
.right-side-wrapper .row .th {
    width: calc(100% / var(--tbl-cols, 9));
    flex: 0 0 calc(100% / var(--tbl-cols, 9));
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Header bar ────────────────────────────────────────── */

.theader {
    background: linear-gradient(135deg, #c8a96e 0%, #b59b62 50%, #a08a55 100%);
}

.static-theader .th,
.scrollable-theader-wrapper .th {
    color: #fff;
    font-family: var(--pui-font, inherit);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* ── Cell base ─────────────────────────────────────────── */

.th {
    padding: 10px 12px;
    box-sizing: border-box;
    text-align: center;
    font-family: var(--pui-font, inherit);
    font-size: 13px;
    color: var(--pui-text, #1e293b);
    border-bottom: 1px solid rgba(0,0,0,.04);
}

.th a {
    color: var(--pui-text, #1e293b);
    transition: color 150ms ease;
}
.th a:hover {
    color: var(--pui-primary, #6366f1);
}

th a {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tbody .th {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ── Rows ──────────────────────────────────────────────── */

.right-side-wrapper .row,
.tbody .left-side .row {
    height: 70px;
}

.tbody .left-side .row .th {
    height: 100%;
    border-right: 1px solid rgba(0,0,0,.06);
    box-sizing: border-box;
    gap: 10px;
}

.right-side-wrapper .row .th {
    height: 100%;
    gap: 10px;
}

.right-side-wrapper .row .th a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Zebra striping + hover ────────────────────────────── */

.tbody .left-side .row:nth-child(odd),
.right-side-wrapper .row:nth-child(odd) .th {
    background-color: rgba(0,0,0,.02);
}

.tbody .left-side .row:hover,
.right-side-wrapper .row:hover .th {
    background-color: var(--pui-primary-bg, rgba(99,102,241,.04));
}

/* ── Actions column ────────────────────────────────────── */

.right-side-wrapper .row .th.actions {
    gap: 5px;
    justify-content: center;
}

.right-side-wrapper .row .th.actions a {
    width: 35px;
    height: 35px;
}

.right-side-wrapper .row .th.actions button {
    border: 0;
    background-color: transparent;
    width: 35px;
    height: 35px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.right-side-wrapper .row .th.actions button:hover {
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
}

.right-side-wrapper .row .th.actions button.delete-user-btn:hover {
    background-color: rgba(220, 53, 69, 0.2);
}

.right-side-wrapper .row .th.actions button img,
.right-side-wrapper .row .th.actions a img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.right-side-wrapper .row .th.actions a > i,
.right-side-wrapper .row .th.actions button > i {
    font-size: 16px;
    color: #64748b;
    transition: color 0.2s ease;
}

.right-side-wrapper .row .th.actions a:hover > i {
    color: #b8860b;
}

.right-side-wrapper .row .th.actions button.delete-user-btn:hover > i,
.right-side-wrapper .row .th.actions button.final-delete-btn:hover > i,
.right-side-wrapper .row .th.actions a.delete-accident:hover > i,
.right-side-wrapper .row .th.actions a.delete-repair:hover > i {
    color: #dc3545;
}

.right-side-wrapper .row .th.actions button.restore-btn:hover > i {
    color: #198754;
}

/* ── Responsive ────────────────────────────────────────── */

@media screen and (max-width: 1640px) {
    .scrollable-theader-wrapper .row .th,
    .right-side-wrapper .row .th {
        width: 165px;
        flex: 0 0 165px;
    }
}

@media screen and (max-width: 1240px) {
    .scrollable-theader-wrapper .row .th,
    .right-side-wrapper .row .th {
        font-size: 15px;
        width: 140px;
        flex: 0 0 140px;
    }
}

@media screen and (max-width: 1020px) {
    .th {
        padding: 10px;
        font-size: 13px;
    }
    .right-side-wrapper .row,
    .tbody .left-side .row {
        height: 50px;
    }
}
