﻿/* ============================
   PLATFORMA TABLES (tenants/users-lists etc)
   ============================ */

.platforma-table-wrapper {
    background: var(--platforma-white);
    border-radius: 12px;
    box-shadow: var(--platforma-shadow);
    border: 1px solid var(--platforma-gray-200);
    overflow-x: auto;
    margin-bottom: var(--platforma-space-8);
}

/* Horisontal scroll på små skærme */
.platforma-table-scroll {
    width: 100%;
    overflow-x: auto;
}

/* Selve tabellen */
.platforma-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--platforma-text-sm);
}

/* Columns hidden on mobile — add this class to th/td */
.platforma-table-col-hide-mobile {
    /* visible by default */
}

    .platforma-table thead {
        background: var(--platforma-gray-50);
    }

    .platforma-table th,
    .platforma-table td {
        padding: 0.75rem 1rem;
        text-align: left;
    }

    .platforma-table th {
        font-weight: 600;
        color: var(--platforma-gray-600);
        border-bottom: 1px solid var(--platforma-gray-200);
        font-size: var(--platforma-text-xs);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        white-space: nowrap;
    }

    /* Allow text wrapping in data cells for long values */
    .platforma-table td {
        word-break: break-word;
        max-width: 250px;
    }

    /* Keep compact columns from wrapping (badges, dates, numbers) */
    .platforma-table td .platforma-badge,
    .platforma-table .platforma-table-actions {
        white-space: nowrap;
    }

    /* Sortable column headers */
    .platforma-table th[data-sortable] {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 1.5rem;
    }

    .platforma-table th[data-sortable]:hover {
        color: var(--platforma-gray-900);
        background: var(--platforma-gray-100);
    }

    .platforma-table th[data-sortable]::after {
        content: '';
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid var(--platforma-gray-300);
        transition: transform 0.15s ease, border-color 0.15s ease;
    }

    .platforma-table th[data-sortable][data-sort-dir="asc"]::after {
        border-top-color: var(--platforma-primary);
        transform: translateY(-50%) rotate(180deg);
    }

    .platforma-table th[data-sortable][data-sort-dir="desc"]::after {
        border-top-color: var(--platforma-primary);
    }

    /* Polish (2026-04-26) — Genbrug samme sortable-pattern på wp-pages-table
       (WebsitePages bruger custom .wp-table CSS i stedet for .platforma-table,
       men sort-arrow-mønstret skal være konsistent på tværs af alle admin-
       tabeller). */
    .wp-pages-table th[data-sortable] {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 1.5rem;
    }

    .wp-pages-table th[data-sortable]:hover {
        color: var(--platforma-gray-900, #0f172a);
        background: rgba(11, 13, 22, 0.03);
    }

    .wp-pages-table th[data-sortable]::after {
        content: '';
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid var(--platforma-gray-300, #cbd5e1);
        transition: transform 0.15s ease, border-color 0.15s ease;
    }

    .wp-pages-table th[data-sortable][data-sort-dir="asc"]::after {
        border-top-color: var(--platforma-warm, #C7A55F);
        transform: translateY(-50%) rotate(180deg);
    }

    .wp-pages-table th[data-sortable][data-sort-dir="desc"]::after {
        border-top-color: var(--platforma-warm, #C7A55F);
    }

    .platforma-table tbody tr {
        border-bottom: 1px solid var(--platforma-gray-100);
    }

        .platforma-table tbody tr:last-child {
            border-bottom: none;
        }

        .platforma-table tbody tr:hover {
            background: var(--platforma-gray-50);
            transition: background var(--platforma-transition, 0.15s ease);
        }

    /* Clickable row title links */
    .platforma-table td a {
        transition: color var(--platforma-transition, 0.15s ease);
    }

        .platforma-table td a:hover {
            color: var(--platforma-primary, #009EF7);
        }

/* Celler med “primary” tekst */
.platforma-table-cell-primary {
    font-weight: 600;
    color: var(--platforma-gray-900);
}

/* Light muted cell */
.platforma-table-cell-muted {
    color: var(--platforma-gray-500);
}

/* Badges til status/plan */
.platforma-table-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: var(--platforma-text-xs);
    font-weight: 600;
    border: 1px solid transparent;
}

.platforma-table-badge-success {
    background: var(--platforma-success-light);
    color: var(--platforma-success);
    border-color: rgba(80,205,137,0.4);
}

.platforma-table-badge-warning {
    background: var(--platforma-warning-light);
    color: var(--platforma-warning);
    border-color: rgba(255,199,0,0.4);
}

.platforma-table-badge-danger {
    background: var(--platforma-danger-light);
    color: var(--platforma-danger);
    border-color: rgba(241,65,108,0.4);
}

.platforma-table-badge-neutral {
    background: var(--platforma-gray-100);
    color: var(--platforma-gray-700);
    border-color: var(--platforma-gray-200);
}

/* Actions kolonne */
.platforma-table-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.platforma-table-action-link {
    font-size: var(--platforma-text-xs);
    color: var(--platforma-primary);
    text-decoration: none;
    font-weight: 500;
}

    .platforma-table-action-link:hover {
        text-decoration: underline;
    }

/* Kebab icon-knap */
.platforma-table-action-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--platforma-gray-200);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--platforma-white);
    cursor: pointer;
}

/* Table empty state */
.platforma-table-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--platforma-gray-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.platforma-table-empty svg {
    width: 48px;
    height: 48px;
    color: var(--platforma-gray-300);
    margin-bottom: 0.25rem;
}

.platforma-table-empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--platforma-gray-600);
}

.platforma-table-empty-text {
    font-size: 0.85rem;
    color: var(--platforma-gray-400);
    max-width: 28rem;
}

.platforma-table-empty .platforma-btn {
    margin-top: 0.5rem;
}

/* Actions column */
.platforma-table-actions-column {
    text-align: right;
}

/* ─── Slice C (2026-04-26) — Standardiserede row-actions ───
   _RowActions.cshtml partial bruger disse klasser. Konsistent på alle
   admin data-pages: Vis · Redigér · Dupliker · Slet i samme rækkefølge
   med samme stil. Compact-variant viser kun ikoner; verbose viser ikon + label. */
.platforma-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.platforma-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(11, 13, 22, 0.04);
    color: #475569;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: all 0.12s ease;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
}
.platforma-row-action svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.platforma-row-action:hover {
    background: #fff;
    border-color: rgba(11, 13, 22, 0.14);
    color: #0B0D16;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(11, 13, 22, 0.08);
    text-decoration: none;
}
.platforma-row-action--view:hover    { color: #2563eb; border-color: rgba(37, 99, 235, 0.30); }
.platforma-row-action--edit:hover    { color: #C7A55F; border-color: rgba(199, 165, 95, 0.40); }
.platforma-row-action--duplicate:hover { color: #6BA68F; border-color: rgba(107, 166, 143, 0.40); }
.platforma-row-action--delete:hover  { color: #B23A3A; border-color: rgba(178, 58, 58, 0.40); }

/* Verbose-variant: ikon + label, bredere knapper. */
.platforma-row-actions--verbose .platforma-row-action {
    width: auto;
    padding: 0 10px;
    height: 30px;
}
.platforma-row-action-label {
    font-size: 0.78rem;
    line-height: 1;
    font-weight: 500;
}

/* Form-wrapper må ikke bryde flex-row. */
.platforma-row-action-form {
    display: inline-flex;
    margin: 0;
}

/* JS confirm-dialog hook: data-confirm-message attribute trigger
   window.confirm() før form submitter. Implementeret i platforma-tables.js
   eller globalt i layout. */

/* Filter bar (used above tables) */
.platforma-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

    .platforma-filter-bar .platforma-select {
        min-width: 0;
        flex: 1 1 130px;
        max-width: 180px;
        font-size: 0.8125rem;
        padding: 0.4rem 2rem 0.4rem 0.75rem;
    }

/* Task count below filters */
.platforma-filter-count {
    font-size: 0.8125rem;
    color: var(--platforma-gray-500);
    margin-bottom: 0.5rem;
}

/* Tablet (768–1024px) */
@media (max-width: 1024px) {
    .platforma-table th,
    .platforma-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8125rem;
    }

    .platforma-filter-bar .platforma-select {
        flex: 1 1 calc(33% - 0.5rem);
        max-width: none;
    }
}

/* Mobile (<768px) */
@media (max-width: 767.98px) {
    .platforma-table-wrapper {
        border-radius: 8px;
        margin-bottom: var(--platforma-space-4);
    }

    .platforma-table th,
    .platforma-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.75rem;
    }

    .platforma-table-col-hide-mobile {
        display: none;
    }

    .platforma-filter-bar .platforma-select {
        flex: 1 1 calc(50% - 0.25rem);
        max-width: none;
    }

    .platforma-table-actions {
        gap: 0.25rem;
    }
}

/* Small mobile (<480px) */
@media (max-width: 480px) {
    .platforma-filter-bar .platforma-select {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .platforma-table th,
    .platforma-table td {
        padding: 0.4rem 0.3rem;
        font-size: 0.6875rem;
    }
}

/* ============================================================
   Wide-table support — migreret fra platforma-admin-ux.css
   (Fase 3). Progressive column-hiding + word-wrap + opt-in
   nowrap. Lever sammen med tabellerne fordi de kun giver
   mening i kontekst af en .platforma-table. */

/* Wide-table responsive wrapper — lang admin-tabel kan scrolle
   horisontalt hvis kolonnerne er uundgåelige, men
   platforma-table-col-prio-N bør bruges først så vi kun falder
   tilbage på scroll i reelle edge cases. */
.platforma-table-wrapper--wide {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.platforma-table-wrapper--wide > table {
    min-width: auto;
}

/* Data-cells: word-wrap så lange values gør ROW højere
   (vertikal plads) i stedet for at tvinge horizontal scroll. */
.platforma-table-wrapper--wide td {
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
}

/* Celler der eksplicit opt-in til nowrap (datoer, badges,
   action-buttons) bliver på én linje; alt andet wrapper frit. */
.platforma-table-wrapper--wide td:not(.platforma-table-col-nowrap):not(.platforma-table-actions),
.platforma-table-wrapper--wide th:not(.platforma-table-col-nowrap) {
    white-space: normal;
}

/* Header-rækker må ombrydes (fx NÆSTE FAKTURERING, PRØVE SLUTTER) */
.platforma-table-wrapper--wide th {
    white-space: normal;
    vertical-align: bottom;
    line-height: 1.25;
}

/* Eksplicit single-line-celler (nowrap-kolonnen) */
.platforma-table td.platforma-table-col-nowrap,
.platforma-table th.platforma-table-col-nowrap {
    white-space: nowrap;
}

/* Progressive column-hiding for wide tables.
   Marker hver th + matchende td med én af disse klasser; de
   lavest-prioriterede kolonner forsvinder først når viewport
   bliver smallere. Prio 1 = altid synlig; højere tal = falder
   først væk.

   Breakpoints tuned for admin-shell (~220px sidebar + main):
     ≥ 1600px → alle kolonner synlige
     < 1600px → prio 4 skjult
     < 1280px → prio 3+4 skjult
     <  900px → prio 2+3+4 skjult
*/
@media (max-width: 1599px) {
    .platforma-table-col-prio-4 { display: none; }
}
@media (max-width: 1279px) {
    .platforma-table-col-prio-3 { display: none; }
}
@media (max-width: 899px) {
    .platforma-table-col-prio-2 { display: none; }
}

/* ──────────────────────────────────────────────────────────────────
   S5.7 — _AdminListPanel cockpit chrome (2026-04-27)
   ──────────────────────────────────────────────────────────────────
   Senior Frontend Design System Engineer: ÉN standard wrapper for alle
   admin-list-Index-views. Erstatter mix af platforma-welcome-section +
   ad-hoc filter-form + bare table-wrapper.

   Struktur:
     .platforma-admin-list                ← root (ingen visual chrome)
       _AdminPageHeader                   ← rendered by partial
       _HelpPanel                         ← optional
       BannerSlot                         ← optional alerts
       .platforma-list-panel-card         ← unified card-shell
         .platforma-list-panel-filter     ← filter-bar-slot
         PreTableSlot                     ← optional details/banners
         .platforma-list-panel-body       ← table eller empty-state
         .platforma-list-panel-footer     ← pagination
   ────────────────────────────────────────────────────────────────── */
.platforma-admin-list {
    display: block;
}

.platforma-list-panel-card {
    background: var(--platforma-surface, var(--platforma-white));
    border: 1px solid var(--platforma-surface-line, var(--platforma-gray-200));
    border-radius: var(--platforma-radius-lg, 10px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-top: var(--platforma-space-4, 1rem);
}

.platforma-list-panel-filter {
    padding: var(--platforma-space-3, .75rem) var(--platforma-space-4, 1rem);
    border-bottom: 1px solid var(--platforma-surface-line, var(--platforma-gray-100));
    background: var(--platforma-parchment-50, var(--platforma-gray-50));
}

.platforma-list-panel-filter form {
    display: flex;
    gap: var(--platforma-space-3, .75rem);
    flex-wrap: wrap;
    align-items: flex-end;
    margin: 0;
}

.platforma-list-panel-filter .platforma-form-group,
.platforma-list-panel-filter > div {
    margin: 0;
}

.platforma-list-panel-body {
    /* Tables sit flush with card edges — no extra padding so headers
       align with the filter-bar above. */
    padding: 0;
}

.platforma-list-panel-body > .platforma-table-wrapper,
.platforma-list-panel-body > table {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.platforma-list-panel-body > .platforma-table-empty,
.platforma-list-panel-body p.platforma-text-muted {
    padding: var(--platforma-space-4, 1rem) var(--platforma-space-4, 1rem);
    margin: 0;
}

.platforma-list-panel-footer {
    padding: var(--platforma-space-3, .75rem) var(--platforma-space-4, 1rem);
    border-top: 1px solid var(--platforma-surface-line, var(--platforma-gray-100));
    background: var(--platforma-parchment-50, var(--platforma-gray-50));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--platforma-space-3, .75rem);
    font-size: var(--platforma-text-sm, .85rem);
    color: var(--platforma-gray-600, #525866);
}

.platforma-list-panel-footer:empty {
    display: none;
}

/* Filter-chip badges (active filters indicator) */
.platforma-list-panel-active-filters {
    margin-top: var(--platforma-space-2, .5rem);
    font-size: var(--platforma-text-xs, .78rem);
    color: var(--platforma-gray-500);
    display: flex;
    gap: var(--platforma-space-2, .5rem);
    flex-wrap: wrap;
    align-items: center;
}

.platforma-list-panel-active-filters strong {
    color: var(--platforma-gray-700);
    margin-right: var(--platforma-space-1, .25rem);
}
