/* =========================================
   1. REGISTRERA LOKALA TYPSNITT
   ========================================= */

/* Barlow - Brödtext */
@font-face {
    font-family: 'Barlow';
    src: url('../fonts/barlow-reg.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Oswald - Rubriker */
@font-face {
    font-family: 'Oswald';
    src: url('../fonts/oswald-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* OBS: :root-variabler (färger & typsnitt) hanteras nu dynamiskt 
   i header.php så att Club Editor-inställningarna fungerar.
*/

/* =========================================
   3. GRUNDINSTÄLLNINGAR
   ========================================= */
body {
    font-family: var(--team-font-body);
    background-color: var(--team-secondary);
    color: var(--team-text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--team-font-heading);
    text-transform: uppercase;
    margin: 0;
    font-weight: 700;
}
.content-area {
    padding: 20px;
    margin-top: 100px; /* Samma höjd som din .app-header */
    margin-bottom: 70px; /* Ger plats åt din .app-bottom-nav */
    min-height: calc(100vh - 170px);
}

.entry-title {
    color: var(--team-primary);
    margin-bottom: 20px;
}

/* =========================================
   4. APP HEADER & NAVIGATION
   ========================================= */
.app-header {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100px;
    background: var(--team-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 9999;
}

.site-branding {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    z-index: 10;
}

.site-branding svg, 
.site-branding img { 
    height: 80px; 
    width: auto; 
    max-width: 100%; 
    object-fit: contain; 
}

/* Profil-ikon (SVG-hantering) */
.profile-icon-wrapper svg {
    width: 28px;
    height: 28px;
    display: block;
    fill: currentColor; 
}

.header-right { 
    position: absolute; 
    bottom: 8px; 
    right: 15px; 
    z-index: 20; 
}

.profile-trigger {
    display: flex; 
    align-items: center; 
    cursor: pointer; 
    background: transparent; 
    padding: 0; 
    gap: 8px; 
    border: none;
    color: var(--team-text-light);
}

.profile-name {
    font-family: var(--team-font-body);
    font-size: 13px; 
    font-weight: 500; 
    line-height: 1;
}

.dropdown-arrow {
    stroke: currentColor; 
    width: 12px; 
    height: 12px; 
    transition: transform 0.3s ease; 
    opacity: 0.8;
}

.profile-trigger.active .dropdown-arrow { 
    transform: rotate(180deg); 
}

/* =========================================
   5. DROPDOWN PANEL
   ========================================= */
.full-width-user-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--team-secondary);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 999;
    display: none; 
}

.full-width-user-panel.is-open {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-content-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    color: var(--team-text-main);
}

.panel-speech-arrow {
    position: absolute;
    top: -6px;
    right: 35px;
    width: 14px;
    height: 14px;
    background-color: var(--team-secondary);
    transform: rotate(45deg);
    box-shadow: -1px -1px 2px rgba(0,0,0,0.05); 
    z-index: 1001;
}

.btn-panel-action {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--team-primary);
    color: var(--team-text-light);
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    font-family: var(--team-font-heading);
    font-size: 14px;
    text-transform: uppercase;
}

/* =========================================
   6.0 APP BOTTOM NAVIGATION (Footer)
   ========================================= */
.app-bottom-nav {
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 60px; /* Något högre för bättre touch-yta */
    background: var(--team-primary); /* Dynamisk lagfärg */
    border-top: 1px solid rgba(0,0,0,0.1); 
    display: flex; 
    justify-content: space-around; 
    align-items: center; 
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    text-decoration: none !important; 
    color: #f9f9f9; /* Din önskade ljusa färg för ej aktiv */
    opacity: 0.7;
    width: 100%; 
    height: 100%; 
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.nav-icon-wrapper svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: currentColor;
}

.nav-label {
    font-family: var(--team-font-body);
    font-size: 10px;
    font-weight: 500;
    margin-top: 4px;
}

/* Aktiv knapp */
.nav-item.active {
    color: var(--team-text-light, #ffffff); /* Dynamisk ljus textfärg */
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active .nav-icon-wrapper {
    transform: scale(1.1);
}

/* Mobile-First begränsning för större skärmar */
@media (min-width: 768px) {
    .app-bottom-nav { 
        max-width: 480px; 
        left: 50%; 
        transform: translateX(-50%); 
        border-radius: 20px 20px 0 0; 
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
}

/* =========================================
   7.0 SIDLAYOUT (Mallar & Navigation)
   ========================================= */

/* Grundwrapper för alla app-sidor */
.app-page-wrapper {
    margin-top: 100px; /* Headerns höjd - eliminerar glapp */
    margin-bottom: 60px; /* Plats för footer-nav */
    min-height: calc(100vh - 160px);
    background-color: var(--team-secondary);
    display: flex;
    flex-direction: column;
}

/* NYTT: Layout-hantering för page.php */

/* 1. Fristående sida (Inga tabs/meny) */
.app-page-wrapper.standalone-page .content-area {
    margin-top: 0; /* Wrappern sköter avståndet till headern */
    padding-top: 20px; 
    padding-left: 20px;
    padding-right: 20px;
}

/* 2. Sida med Sticky Nav (Tabs/Dropdown) */
.app-page-wrapper.has-sticky-nav .content-area {
    margin-top: 0; 
    padding-top: 20px; /* Lite luft mellan tabs och innehåll */
    padding-left: 0;   /* Tab-innehållet går ofta kant-i-kant eller sköter sin egen padding */
    padding-right: 0;
}

/* Sticky container som fäster direkt under header */
.sticky-nav-container {
    position: sticky;
    top: 100px; 
    z-index: 900;
    background: var(--team-secondary);
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 7.1 LAG-DROPDOWN (Rubrikmeny) */
.team-dropdown-header {
    padding: 12px 20px;
    display: flex;
    justify-content: center; 
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: relative;
    cursor: pointer;
}

.team-dropdown-header h1 {
    font-family: var(--team-font-heading);
    font-size: 18px;
    margin: 0;
    text-transform: uppercase;
    color: var(--team-text-main);
    position: relative; 
    display: inline-block;
}

/* Pilen placeras utanför textens breddberäkning */
.arrow-down {
    position: absolute;
    right: -20px; 
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.arrow-down::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -3px; 
}

/* 7.2 PILLBOX TABS (Sammanhållen Segmented Control) */
.pillbox-tabs-wrapper {
    padding: 10px 15px;
    background: var(--team-secondary);
    display: flex;
    justify-content: center;
}

.pillbox-tabs {
    display: flex;
    gap: 0; 
    width: 100%;
    max-width: 500px;
    border: none; 
    border-radius: 6px;
    overflow: hidden; 
    background: #f9f9f9; 
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1); 
}

.tab-btn {
    flex: 1; 
    background: transparent;
    border: none;
    border-right: 1px solid rgba(0,0,0,0.1); 
    padding: 12px 4px; 
    font-family: var(--team-font-heading);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--team-text-main);
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 0; 
    margin: 0;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn.active {
    background: var(--team-primary);
    color: var(--team-text-light);
}

.tab-btn.active + .tab-btn {
    border-left: none;
}

/* 7.3 INNEHÅLLSYTOR */
.tab-content-container {
    width: 100%;
    padding: 0; 
    flex: 1; /* Fyller ut höjden */
}

.tab-pane {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 7.4 STANDALONE CONTENT (Specifikt för innehåll utan tabs) */
.standalone-content {
    width: 100%;
    max-width: 100%;
}

/* 7.5 LAG-DROPDOWN CONTENT */
.team-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 5px); 
    left: 50%;
    transform: translateX(-50%); 
    width: 60vw; 
    max-width: 300px; 
    background: var(--team-secondary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 12px; 
    z-index: 999;
    border: 1px solid rgba(0,0,0,0.05);
}

.dropdown-arrow-center {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--team-secondary);
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.team-dropdown-content ul {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.team-dropdown-content ul li a {
    display: block;
    padding: 12px 15px;
    text-align: center;
    text-decoration: none;
    color: var(--team-text-main);
    font-family: var(--team-font-heading);
    text-transform: uppercase;
    font-size: 13px;
    transition: background 0.2s ease;
}

.team-dropdown-content ul li a:active {
    background: rgba(0,0,0,0.02);
}

.team-dropdown-content ul li:not(:last-child) a {
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.team-dropdown-header.is-active .team-dropdown-content {
    display: block;
    animation: popIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes popIn {
    from { 
        opacity: 0; 
        transform: translateX(-50%) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateX(-50%) scale(1); 
    }
}

/* =========================================
   8.0 STARTSIDA (Front Page)
   ========================================= */
.app-home-container {
    /* VIKTIGT: padding-top måste vara Header-höjd (100px) + önskat mellanrum (15px) */
    padding-top: 115px; 
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 80px; /* Plats för bottenmenyn */
    min-height: 100vh;
    background-color: var(--team-secondary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 25px 0 12px 0;
}

.section-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    color: var(--team-text-main);
    font-family: var(--team-font-heading);
    text-transform: uppercase;
}

.section-link {
    font-family: var(--team-font-heading);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    color: var(--team-primary);
    text-transform: uppercase;
}

/* =========================================
   9.0 WIDGETS (Match, News, Video)
   ========================================= */

/* 9.1 MATCH WIDGET - CONTAINERS */
.taif_match_widget_container {
    margin-bottom: 30px;
    /* Skugga läggs nu på hela containern eller hanteras av delarna för att se enhetligt ut */
    filter: drop-shadow(0 4px 15px rgba(0,0,0,0.05)); 
}

/* TABS (Nu integrerad topp) */
.mw-tabs-container {
    display: flex;
    gap: 0;
    width: 100%;
    /* Endast radius upptill */
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    background: #ffffff; /* Vit bakgrund för inaktiva tabs */
    margin-bottom: 0; /* Ingen marginal neråt, de sitter ihop nu */
    border-bottom: 1px solid rgba(0,0,0,0.05); /* Skiljelinje mot innehållet */
}

.mw-tab-item {
    flex: 1;
    background: #ffffff; /* Vit standardfärg */
    border: none;
    border-right: 1px solid rgba(0,0,0,0.05); /* Svag skiljelinje mellan tabs */
    padding: 12px 4px;
    font-family: var(--team-font-heading);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--team-text-main); /* Mörk text som standard */
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mw-tab-item:last-child { 
    border-right: none; 
}

.mw-tab-item.active {
    background: var(--team-primary); /* Grön bakgrund för aktiv */
    color: var(--team-text-light); /* Vit text */
}

/* MATCH CARD (Nu integrerad botten) */
.match-hero.widget-mode {
    background: #fff;
    /* Endast radius nedtill */
    border-radius: 0 0 12px 12px;
    padding: 15px; /* Lite mindre padding i toppen för datumets skull */
    /* Ingen skugga här, vi lät containern ha drop-shadow eller litar på platt design */
}

/* NYTT: Topp-datum stil */
.match-top-date {
    text-align: center;
    font-family: var(--team-font-heading);
    font-size: 10px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

/* TEAM & LOGO */
.team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.team-logo-raw img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.team-name {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.2;
}

.team-name-large {
    font-family: var(--team-font-heading);
    font-size: 14px;
    line-height: 1.1;
    text-align: center;
    font-weight: 800;
    text-transform: uppercase;
}

/* COUNTDOWN */
.score-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.widget-countdown {
    display: flex;
    gap: 10px;
}

.cd-part {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cd-n {
    font-family: var(--team-font-heading);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: var(--team-text-main);
}

.cd-l {
    font-size: 9px;
    text-transform: uppercase;
    color: #888;
}

/* INFO & BUTTONS */
.match-divider-small {
    height: 1px;
    background-color: rgba(0,0,0,0.05);
    margin: 15px 0;
}

.match-info-middle {
    text-align: center;
    font-family: var(--team-font-heading);
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.match-actions {
    display: flex;
    gap: 10px;
}

.btn-match {
    flex: 1;
    padding: 12px 10px;
    text-align: center;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    text-decoration: none;
    text-transform: uppercase;
    display: block;
    font-family: var(--team-font-heading);
}

.btn-ticket {
    background: var(--team-primary);
    color: #fff !important;
    border: none;
}

/* 9.2 NYHETER (Vita kort) */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-card {
    display: flex;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    min-height: 90px;
    cursor: pointer;
}

.news-card-image-wrapper {
    width: 35%;
    flex-shrink: 0;
    position: relative;
    background: #f0f0f0;
}

.news-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
}

.news-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 65%;
}

.news-date {
    font-size: 10px; 
    color: #888; 
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.news-card-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--team-text-main);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 9.3 VIDEO SCROLL */
.video-widget-section {
    width: 100%;
}

.video-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 15px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.video-scroll-container::-webkit-scrollbar {
    display: none;
}

.video-card {
    flex: 0 0 240px;
    text-decoration: none;
}

.video-thumbnail-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: #000;
}

.video-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.video-content {
    padding-top: 8px;
}

.video-title {
    font-size: 13px;
    margin: 0;
    color: var(--team-text-main);
    line-height: 1.3;
    font-weight: 600;
}

.video-date {
    font-size: 10px;
    color: #888;
    margin-top: 3px;
    display: block;
}