/* ============================================================
   Tournegar content tables (tn-table) v1.0
   Professional responsive tables for blog articles, tour /
   hotel / accommodation rich content. Desktop = real table,
   mobile/tablet = stacked cards. RTL-first, no JS library
   needed (a tiny enhancer adds data-labels + wrapper).
   Applied ONLY to .tn-table tables, so framework tables
   (.table, Bootstrap) and layout tables are never touched.
   ============================================================ */
:root {
    color-scheme: light dark;
    --tnt-page: transparent;
    --tnt-surface: #ffffff;
    --tnt-subtle: #f8fafc;
    --tnt-hover: #f0f9ff;
    --tnt-text: #0f172a;
    --tnt-muted: #64748b;
    --tnt-border: #e2e8f0;
    --tnt-primary: #0284c7;
    --tnt-success-bg: #f0fdf4;
    --tnt-success-text: #166534;
    --tnt-warning-bg: #fffdf5;
    --tnt-warning-text: #92400e;
    --tnt-danger-bg: #fef2f2;
    --tnt-danger-text: #991b1b;
}

.tn-table-wrap {
    overflow-x: auto;
    background: var(--tnt-surface);
    border: 1.5px solid var(--tnt-border);
    border-radius: 14px;
    margin: 0 0 16px;
    -webkit-overflow-scrolling: touch;
}

table.tn-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
    margin: 0;
    font-size: 13px;
    background: transparent;
}

table.tn-table th,
table.tn-table td {
    padding: 12px 14px;
    text-align: start;
    vertical-align: middle;
}

table.tn-table thead {
    background: var(--tnt-subtle);
    color: var(--tnt-muted);
}

table.tn-table th {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1.5px solid var(--tnt-border);
    color: var(--tnt-text);
}

table.tn-table tbody tr + tr {
    border-top: 1px solid var(--tnt-border);
}

table.tn-table tbody tr {
    transition: background-color 160ms ease;
}

table.tn-table tbody tr:focus-within {
    background: var(--tnt-hover);
}

table.tn-table td {
    color: var(--tnt-text);
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.tn-num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tn-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tn-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: currentColor;
}

.tn-badge--success {
    background: var(--tnt-success-bg);
    color: var(--tnt-success-text);
    border-color: #bbf7d0;
}

.tn-badge--warning {
    background: var(--tnt-warning-bg);
    color: var(--tnt-warning-text);
    border-color: #fde68a;
}

.tn-badge--danger {
    background: var(--tnt-danger-bg);
    color: var(--tnt-danger-text);
    border-color: #fecaca;
}

.tn-cell-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding-inline: 12px;
    border: 1.5px solid var(--tnt-border);
    border-radius: 10px;
    color: var(--tnt-primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.tn-cell-link:focus-visible {
    outline: 3px solid var(--tnt-primary);
    outline-offset: 3px;
}

.tn-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@media (hover: hover) {
    table.tn-table tbody tr:hover {
        background: var(--tnt-hover);
    }

    .tn-cell-link:hover {
        border-color: var(--tnt-primary);
    }
}

/* Rows become cards on mobile / small tablets */
@media (max-width: 767.98px) {
    .tn-table-wrap {
        padding: 12px;
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
    }

    table.tn-table,
    table.tn-table tbody {
        display: block;
    }

    /* Keep thead for screen readers */
    table.tn-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    table.tn-table tbody {
        display: grid;
        gap: 12px;
    }

    table.tn-table tbody tr {
        display: block;
        overflow: hidden;
        background: var(--tnt-surface);
        border: 1.5px solid var(--tnt-border);
        border-radius: 12px;
    }

    table.tn-table td {
        display: grid;
        grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        font-size: 12.5px;
    }

    table.tn-table td + td {
        border-top: 1px dashed var(--tnt-border);
    }

    table.tn-table td::before {
        content: attr(data-label);
        color: var(--tnt-muted);
        font-size: 11.5px;
        font-weight: 700;
    }

    table.tn-table td > * {
        min-width: 0;
        justify-self: end;
        text-align: end;
    }

    table.tn-table td:first-child {
        background: var(--tnt-subtle);
    }
}

@media (prefers-reduced-motion: reduce) {
    table.tn-table tbody tr {
        transition: none;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --tnt-surface: #111827;
        --tnt-subtle: #182235;
        --tnt-hover: #1e293b;
        --tnt-text: #f1f5f9;
        --tnt-muted: #a8b5c9;
        --tnt-border: #334155;
        --tnt-primary: #7dd3fc;
        --tnt-success-bg: #153c2c;
        --tnt-success-text: #86efac;
        --tnt-warning-bg: #422f16;
        --tnt-warning-text: #fde68a;
        --tnt-danger-bg: #451f27;
        --tnt-danger-text: #fca5a5;
    }
}
