/* ============================================================
   /boardgames/style.css
   Side-specifik styling for Brætspil-sektionen (index, admin).
   Indlæses OVENPÅ det generelle style.css via PAGE_EXTRA_CSS.
   ============================================================ */

/* ------------------------------------------------------------
   Navigation (Admin-knap) - samme mønster som Landals landal-nav
   ------------------------------------------------------------ */
.boardgames-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.boardgames-nav-button {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.9rem;
}
.boardgames-nav-button:hover { text-decoration: none; border-color: var(--color-accent); }


/* Spil-formularen har brug for mere bredde end det generelle 420px form-standard,
   så spillerantal/spilletid/billede-rækkerne reelt kan stå tre-i-bredden */
.boardgames-game-form {
    max-width: 700px;
}


/* ------------------------------------------------------------
   Filter-formular (index.php)
   ------------------------------------------------------------ */
.boardgames-filter-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.boardgames-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.boardgames-filter-row > div {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.boardgames-filter-row label {
    font-weight: 600;
    font-size: 0.85rem;
}
.boardgames-filter-row input,
.boardgames-filter-row select {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
}

.boardgames-filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 0.75rem;
}
.boardgames-filter-toggles small { color: var(--color-text-light); }

/* Fold-ud-knap - skjult på desktop, hvor filtrene altid vises */
.boardgames-filter-toggle-button {
    display: none;
}


/* ------------------------------------------------------------
   Statusfilter (admin.php - "Vis: Alle / Aktive / Deaktiverede")
   ------------------------------------------------------------ */
.boardgames-status-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.boardgames-status-filter select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}


/* ------------------------------------------------------------
   Spilleliste (index.php)
   Desktop: almindelig tabel. Mobil: kort pr. spil (samme mønster
   som Landals entries-table - data-label styrer feltnavnet).
   ------------------------------------------------------------ */
.boardgames-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
    font-size: 0.95rem;
}
.boardgames-table th,
.boardgames-table td {
    text-align: left;
    padding: 0.35rem 0.8rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.boardgames-table th {
    background: var(--color-bg);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-text-light);
}
.boardgames-table th a { color: inherit; }
.boardgames-table th a:hover { color: var(--color-accent-dark); }
.boardgames-table tr:last-child td { border-bottom: none; }

/* Svagt skiftende rækkefarve for bedre læsbarhed i en lang liste */
.boardgames-table tbody tr:nth-child(even):not(.boardgames-expansion-row) {
    background: rgba(0, 0, 0, 0.025);
}

/* Redigér-ikon (kun synligt for admins) */
.boardgames-edit-cell {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}
.boardgames-edit-link {
    text-decoration: none;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}
.boardgames-edit-link:hover {
    opacity: 1;
    text-decoration: none;
}

/* "X spil vises"-tekst ved siden af Filtrér-knappen */
.boardgames-visible-count {
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* Udvidelser vises let indrykket/nedtonet under deres hovedspil */
.boardgames-expansion-row {
    background: var(--color-bg);
}
.boardgames-expansion-row td:nth-child(2) {
    color: var(--color-text-light);
}

.boardgames-new-badge {
    display: inline-block;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.boardgames-secondary-categories {
    color: var(--color-text-light);
}

.boardgames-image-cell { width: 60px; }
.boardgames-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
}
.boardgames-thumb-link { display: block; cursor: zoom-in; }

/* Kun synlig på smal skærm i stående retning - se mediequery nederst i filen */
.boardgames-rotate-hint {
    display: none;
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin: -0.5rem 0 1rem;
}


/* ------------------------------------------------------------
   Mobil: spillisten vises som kort i stedet for tabel
   ------------------------------------------------------------ */
@media (max-width: 600px) {
    .boardgames-rotate-hint {
        display: block;
    }

    .boardgames-table thead { display: none; }

    .boardgames-table {
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .boardgames-table,
    .boardgames-table tbody,
    .boardgames-table tr,
    .boardgames-table td {
        display: block;
        width: 100%;
    }

    .boardgames-table tr {
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.9rem;
    }

    .boardgames-table td {
        border-bottom: 1px solid var(--color-bg);
        padding: 0.4rem 0;
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
    }
    .boardgames-table td:last-child { border-bottom: none; }

    .boardgames-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-light);
        flex-shrink: 0;
    }

    /* Billedcellen skal ikke have et "Billede:"-label - vises bare centreret øverst i kortet */
    .boardgames-table td.boardgames-image-cell {
        justify-content: center;
    }
    .boardgames-table td.boardgames-image-cell::before {
        content: none;
    }
    .boardgames-table .boardgames-thumb {
        width: 80px;
        height: 80px;
    }
}


/* ------------------------------------------------------------
   Fold-ud/ind af filtrene - både stående mobil (smal bredde) og
   liggende mobil (lav højde, da liggende telefoner ofte er bredere
   end 600px men stadig for lave til at have filtrene åbne som standard)
   ------------------------------------------------------------ */
@media (max-width: 600px), (max-height: 500px) and (orientation: landscape) {
    .boardgames-filter-row {
        flex-direction: column;
        gap: 0.6rem;
    }
    /* Uden dette arver felterne desktop-reglens flex-basis:180px, som i en
       kolonne-retning bliver tolket som HØJDE i stedet for bredde - det var
       den egentlige årsag til den store afstand mellem filtrene på mobil */
    .boardgames-filter-row > div {
        flex: 1 1 auto;
    }

    /* Fold-ud-knap til filtrene - skjulte som standard */
    .boardgames-filter-toggle-button {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        width: 100%;
        padding: 0.65rem 0.9rem;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        font-size: 0.95rem;
        font-weight: 600;
        font-family: inherit;
        color: var(--color-text);
        cursor: pointer;
    }
    .boardgames-toggle-count {
        font-weight: normal;
        color: var(--color-text-light);
        font-size: 0.8rem;
    }

    .boardgames-filter-fields {
        display: none;
        margin-top: 0.85rem;
    }
    .boardgames-filter-fields.expanded {
        display: block;
    }

    /* Antallet vises allerede i fold-ud-knappen - undgå at vise det to gange når filtrene er foldet ud */
    .boardgames-filter-fields .boardgames-visible-count {
        display: none;
    }
}


/* ------------------------------------------------------------
   Lightbox til billedvisning (index.php)
   ------------------------------------------------------------ */
.boardgames-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    padding: 1.5rem;
}
/* [hidden] har samme specificitet som .boardgames-lightbox alene, men her
   kombineres klasse + attribut, hvilket vinder over display:flex herover -
   uden denne regel forbliver lightboxen synlig og ukanlukkelig */
.boardgames-lightbox[hidden] {
    display: none;
}
.boardgames-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}


/* ------------------------------------------------------------
   Admin: spilformular (opret/rediger)
   ------------------------------------------------------------ */
.boardgames-conditional-field {
    margin: 0.5rem 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.boardgames-inline-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.boardgames-inline-fields > div {
    flex: 1 1 140px;
}
.boardgames-inline-fields label {
    font-size: 0.85rem;
    margin-top: 0;
}

.boardgames-category-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.boardgames-category-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-weight: normal !important;
    font-size: 0.9rem;
    background: var(--color-surface);
}
.boardgames-primary-toggle {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.3rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--color-border);
    color: var(--color-text-light);
}
.boardgames-primary-toggle small { font-size: 0.75rem; }

.boardgames-current-image {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.boardgames-current-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.boardgames-admin-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 0.4rem;
}


/* ------------------------------------------------------------
   Drag-n-drop billedupload (admin.php) - se _admin.js
   ------------------------------------------------------------ */
.boardgames-dropzone {
    position: relative;
    max-width: 420px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    background: var(--color-bg);
    transition: border-color 0.15s ease, background 0.15s ease;
    margin-bottom: 0.75rem;
}
.boardgames-dropzone:hover,
.boardgames-dropzone.dragover {
    border-color: var(--color-accent);
    background: #fff7ef;
}

.boardgames-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.boardgames-dropzone-text {
    margin: 0;
    color: var(--color-text-light);
    font-size: 0.85rem;
    pointer-events: none;
}