/* ---------------------------------------------------
   GLOBALT – PANTEX DESIGN SYSTEM (REN VERSION)
   --------------------------------------------------- */

:root {
    --bg: #f2f4f8;
    --text: #111;
    --card-bg: #ffffff;
    --card-border: #e5e5e5;
    --nav-bg: #ffffff;
    --nav-border: #ddd;
    --btn-bg: #e6e6e6;
    --accent: #3040ff;
}

body.dark {
    --bg: #0f0f0f;
    --text: #f2f2f2;
    --card-bg: #141414;
    --card-border: #333;
    --nav-bg: #111;
    --nav-border: #222;
    --btn-bg: #222;
    --accent: #4f5bff;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}


/* ---------------------------------------------------
   NAVBAR – IDENTISK MED FUN FACTS
   --------------------------------------------------- */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-size: 22px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-btn {
  background: var(--btn-bg);
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s;
  color: var(--text);
}

.theme-btn:hover {
  opacity: 0.8;
}


/* ---------------------------------------------------
   OS2026 INDEX – BOX & CARD (matchar FunFacts)
   --------------------------------------------------- */

.os2026-box {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    padding: 0 20px;
}

.os2026-card {
    width: 100%;
    max-width: 760px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 26px 28px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}

.os2026-card h2 {
    margin-top: 0;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
}


/* ---------------------------------------------------
   LISTA – IDENTISK MED FUN FACTS
   --------------------------------------------------- */

.os2026-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.os2026-item {
    margin-bottom: 14px;
}

.os2026-item a {
    display: block;
    padding: 14px 16px;
    border-radius: 12px;
    text-decoration: none;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    transition: 0.25s ease;
}

.os2026-item a:hover {
    background: rgba(0,0,0,0.04);
    transform: translateY(-2px);
}


/* ---------------------------------------------------
   DASHBOARD TILE
   --------------------------------------------------- */

.os2026-tiles {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0 20px;
}

.dashboard-tile {
    flex: 1;
    min-width: 140px;
    text-decoration: none;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.2rem;
    text-align: center;
    color: var(--text);
    transition: 0.25s ease;
}

.dashboard-tile:hover {
    transform: translateY(-3px);
    background: rgba(0,0,0,0.04);
}

.tile-icon {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

.tile-label {
    font-size: 0.95rem;
    opacity: 0.8;
}


/* ---------------------------------------------------
   MEDALS MODULE – DESKTOP
   --------------------------------------------------- */

.os2026-medals-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.os2026-medals-page h1 {
    text-align: center;
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.os2026-medals {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.8rem;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}

.os2026-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.os2026-module-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.os2026-module-meta {
    opacity: 0.7;
    font-size: 0.85rem;
}


/* ---------------------------------------------------
   TABLE – DESKTOP
   --------------------------------------------------- */

.os2026-medals-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

.os2026-medals-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.os2026-medals-table th,
.os2026-medals-table td {
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--text);
    text-align: left;
}

.os2026-medals-table th {
    font-weight: 600;
    user-select: none;
    transition: background 0.2s ease;
}

.os2026-medals-table th:hover {
    background: rgba(0,0,0,0.06);
}

.os2026-medals-table th.sorted-asc::after {
    content: " ▲";
    opacity: 0.7;
}

.os2026-medals-table th.sorted-desc::after {
    content: " ▼";
    opacity: 0.7;
}

.os2026-medals-table tr:hover {
    background: rgba(0,0,0,0.04);
}

.country-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.country-cell .flag {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0,0,0,0.25);
}

.highlight-swe {
    background: rgba(0, 120, 255, 0.22);
    font-weight: 700;
}


/* ---------------------------------------------------
   EXPAND DETAILS
   --------------------------------------------------- */

.medals-details-row {
    background: rgba(0,0,0,0.04);
}

.medals-details {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding: 0 1rem;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.medals-details.open {
    max-height: 500px;
    opacity: 1;
    padding: 1rem;
}

.medal-row {
    cursor: pointer;
    transition: background 0.2s ease;
}

.medal-row.active {
    background: rgba(0,0,0,0.08);
}


/* ---------------------------------------------------
   FLOATING LAUNCHER
   --------------------------------------------------- */

#osMedalsLauncher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--btn-bg);
  color: var(--text);
  font-size: 26px;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  transition: 0.2s ease;
  z-index: 9999;
}

#osMedalsLauncher:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}


/* ---------------------------------------------------
   TEXT-BREAK SAFETY
   --------------------------------------------------- */

.medals-details,
.medal-card-details {
    word-break: break-word;
    overflow-wrap: break-word;
}

.medals-details ul,
.medal-card-details ul {
    padding-left: 0;
    list-style: none;
}

.medals-details li,
.medal-card-details li {
    white-space: normal;
}

#medals-updated {
    display: block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
}


/* ---------------------------------------------------
   MOBIL – APP-LIK LAYOUT FÖR MEDALJSIDAN
   --------------------------------------------------- */

@media (max-width: 600px) {

    /* Grundlayout */
    .os2026-medals-page {
        padding: 1.2rem;
        max-width: 100%;
    }

    .os2026-medals {
        padding: 1.2rem;
        border-radius: 16px;
        max-width: 100%;
    }

    .os2026-module-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .os2026-medals-page h1 {
        font-size: 1.9rem;
        margin-bottom: 1.2rem;
    }

    /* Tabell kompaktare på små skärmar (om den visas) */
    .os2026-medals-table th,
    .os2026-medals-table td {
        padding: 0.45rem 0.3rem;
        font-size: 0.85rem;
    }

    .country-cell .flag {
        width: 18px;
        height: 18px;
    }

    .country-cell span {
        font-size: 0.9rem;
    }

    .medals-details {
        font-size: 0.85rem;
        padding: 0.5rem 0.5rem;
    }

    /* Dölj tabellen helt på mobil */
    .os2026-medals-wrapper {
        display: none !important;
    }

    /* KORTLAYOUT – byggs av JS */
    .medal-card {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 16px;
        padding: 18px 20px;
        margin-bottom: 18px;
        box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    }

    .medal-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }

    .medal-card-country {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 600;
        font-size: 1.1rem;
    }

    .medal-card-country img {
        width: 28px;
        height: 28px;
        border-radius: 50%;
    }

    .medal-card-medals {
        display: flex;
        gap: 16px;
        margin-top: 10px;
        font-size: 1rem;
    }

    .medal-card-medals span {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .medal-card-details {
        margin-top: 14px;
        padding-top: 12px;
        border-top: 1px solid var(--card-border);
        font-size: 0.9rem;
        line-height: 1.45;
        display: none;
    }

    .medal-card-details.open {
        display: block;
    }

    .medal-card.highlight-swe {
        background: rgba(0, 120, 255, 0.15);
        border-color: rgba(0, 120, 255, 0.35);
    }
}
