/* =============================================================
   TV NAVIGATION - Industrial Pop Design
   "Blueprint & Safety" Color Palette
   ============================================================= */

/* --- Design Tokens --- */
:root {
    /* Blueprint & Safety Palette */
    --tv-deep-slate: #2C3E50;
    --tv-industrial-amber: #F39C12;
    --tv-technical-mint: #1ABC9C;
    --tv-paper-white: #ECF0F1;
    --tv-offer-blue: #3498db;

    /* Navigation specific */
    --tv-nav-height: 60px;
    --tv-nav-mobile-height: 70px;
    --tv-nav-bg: var(--tv-deep-slate);
    --tv-nav-text: var(--tv-paper-white);
    --tv-nav-text-muted: rgba(236, 240, 241, 0.7);
    --tv-nav-hover: rgba(236, 240, 241, 0.1);
    --tv-nav-accent: var(--tv-industrial-amber);
    --tv-nav-accent-secondary: var(--tv-technical-mint);
    --tv-nav-dropdown-bg: #ffffff;

    /* Squircle radius (firkant med mye avrunding) */
    --tv-squircle-sm: 12px;
    --tv-squircle-md: 16px;
    --tv-squircle-lg: 20px;
    --tv-squircle-xl: 24px;

    /* Hard shadows (taktilt, trykkbart) */
    --tv-shadow-hard: 0 4px 0 rgba(0, 0, 0, 0.2);
    --tv-shadow-hard-sm: 0 3px 0 rgba(0, 0, 0, 0.15);
    --tv-shadow-pressed: 0 2px 0 rgba(0, 0, 0, 0.2);
    --tv-shadow-mega-tray: 0 8px 0 rgba(0, 0, 0, 0.1);

    /* Transitions */
    --tv-nav-transition: 0.2s ease;
    --tv-nav-transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =============================================================
   1. SKJUL BLOCKSY HEADER PÅ FORSIDEN
   ============================================================= */

body:not(.tv-tool-page) header.ct-header,        /* Blocksy */
body:not(.tv-tool-page) .ct-header,              /* Blocksy */
body:not(.tv-tool-page) #masthead,               /* Underscores / Astra / GeneratePress */
body:not(.tv-tool-page) .site-header,            /* Common Standards */
body:not(.tv-tool-page) header.header,           /* Elementor Hello etc */
body:not(.tv-tool-page) .ast-main-header-wrap    /* Astra */
{
    display: none !important;
}

body:not(.tv-tool-page) .site-main {
    padding-top: 20px !important;
}

/* =============================================================
   2. DESKTOP NAVIGATION BAR - "Command Center"
   ============================================================= */

.tv-nav-bar {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: var(--tv-nav-bg);
    height: var(--tv-nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--tv-shadow-hard);
    margin-bottom: 30px; /* Mellomrom under navigasjonen */
}

/* Logo */
.tv-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--tv-nav-text);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
    letter-spacing: -0.5px;
    transition: opacity var(--tv-nav-transition);
}

.tv-nav-logo:hover {
    opacity: 0.9;
    color: var(--tv-nav-text);
}

.tv-nav-logo i {
    font-size: 1.3rem;
    color: var(--tv-nav-accent);
}

/* Menu Container */
.tv-nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =============================================================
   3. DESKTOP CATEGORY BUTTONS & MEGA-TRAY
   ============================================================= */

.tv-nav-dropdown {
    position: static; /* For mega-tray full-width positioning */
}

.tv-nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--tv-nav-text);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: var(--tv-squircle-md);
    transition: all var(--tv-nav-transition);
    position: relative;
}

.tv-nav-dropdown-btn:hover {
    background: var(--tv-nav-hover);
}

/* Active category button */
.tv-nav-dropdown-btn.active,
.tv-nav-dropdown.open .tv-nav-dropdown-btn {
    background: var(--tv-nav-accent);
    color: var(--tv-deep-slate);
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-nav-dropdown-btn.active:active,
.tv-nav-dropdown.open .tv-nav-dropdown-btn:active {
    box-shadow: var(--tv-shadow-pressed);
    transform: translateY(1px);
}

.tv-nav-dropdown-btn i:first-child {
    font-size: 1rem;
}

.tv-nav-chevron {
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform var(--tv-nav-transition);
}

.tv-nav-dropdown.open .tv-nav-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* =============================================================
   4. MEGA-TRAY PANEL (Desktop)
   ============================================================= */

.tv-nav-dropdown-content {
    position: fixed;
    top: var(--tv-nav-height);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--tv-paper-white);
    border-radius: 0 0 var(--tv-squircle-lg) var(--tv-squircle-lg);
    box-shadow: var(--tv-shadow-mega-tray);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-top: 4px solid var(--tv-nav-accent);
    max-height: 0;
}

.tv-nav-dropdown.open .tv-nav-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 400px;
}

/* Mega-tray inner container */
.tv-nav-dropdown-content .tv-mega-tray-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 30px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Tool Cards in Mega-Tray */
.tv-nav-dropdown-content a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    color: var(--tv-deep-slate);
    text-decoration: none;
    background: #ffffff;
    border-radius: var(--tv-squircle-md);
    box-shadow: var(--tv-shadow-hard-sm);
    transition: all var(--tv-nav-transition);
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.tv-nav-dropdown-content a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
}

.tv-nav-dropdown-content a:active {
    transform: translateY(1px);
    box-shadow: var(--tv-shadow-pressed);
}

/* Tool card icon */
.tv-nav-dropdown-content a i:first-child {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tv-deep-slate);
    color: var(--tv-nav-accent);
    border-radius: var(--tv-squircle-sm);
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--tv-shadow-hard-sm);
}

/* Inneklima category uses mint accent */
.tv-nav-dropdown[data-category="inneklima"] .tv-nav-dropdown-content a i:first-child {
    color: var(--tv-technical-mint);
}

/* Tilbud category uses blue accent */
.tv-nav-dropdown[data-category="tilbud"] .tv-nav-dropdown-content a i:first-child {
    color: var(--tv-offer-blue, #3498db);
}

/* Læring category uses purple accent */
.tv-nav-dropdown[data-category="laering"] .tv-nav-dropdown-content a i:first-child {
    color: #9B59B6;
}

.tv-nav-dropdown-content a div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tv-nav-dropdown-content a strong {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
}

.tv-nav-dropdown-content a small {
    font-size: 0.85rem;
    color: #64748b;
}

/* User dropdown stays positioned relative (not mega-tray) */
.tv-nav-user .tv-nav-dropdown-content {
    position: absolute;
    top: calc(100% + 8px);
    left: auto;
    right: 0;
    width: auto;
    min-width: 280px;
    max-height: none;
    border-radius: var(--tv-squircle-md);
    border-top: none;
}

.tv-nav-user .tv-nav-dropdown-content a {
    min-width: auto;
    max-width: none;
    box-shadow: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0;
}

.tv-nav-user .tv-nav-dropdown-content a:first-child {
    border-radius: var(--tv-squircle-md) var(--tv-squircle-md) 0 0;
}

.tv-nav-user .tv-nav-dropdown-content a:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--tv-squircle-md) var(--tv-squircle-md);
}

.tv-nav-user .tv-nav-dropdown-content a:hover {
    transform: none;
    box-shadow: none;
    background: rgba(44, 62, 80, 0.05);
}

/* Logout link special styling */
.tv-nav-logout i:first-child {
    background: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
}

/* =============================================================
   5. MOBILE FLOATING DOCK - "Flytende Dokk"
   ============================================================= */

.tv-nav-bottom {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: var(--tv-nav-mobile-height);
    background: var(--tv-nav-bg);
    z-index: 9999;
    padding: 10px 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--tv-shadow-hard);
    border-radius: var(--tv-squircle-xl);
    justify-content: space-around;
    align-items: center;
}

/* Dock items */
.tv-nav-bottom-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--tv-nav-text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all var(--tv-nav-transition-bounce);
    padding: 8px 12px;
    border-radius: var(--tv-squircle-md);
    position: relative;
}

.tv-nav-bottom-item i {
    font-size: 1.4rem;
    transition: transform var(--tv-nav-transition-bounce);
}

.tv-nav-bottom-item span {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all var(--tv-nav-transition);
}

/* Hover state */
.tv-nav-bottom-item:hover {
    color: var(--tv-nav-text);
}

/* Active state - "hopper opp" med amber bakgrunn */
.tv-nav-bottom-item.active {
    color: var(--tv-deep-slate);
    background: var(--tv-nav-accent);
    transform: translateY(-8px);
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-nav-bottom-item.active i {
    transform: scale(1.1);
}

.tv-nav-bottom-item.active span {
    opacity: 1;
    max-height: 20px;
    margin-top: 2px;
}

/* Inneklima item uses mint when active */
.tv-nav-bottom-item[data-sheet="inneklima"].active {
    background: var(--tv-technical-mint);
}

/* Tilbud item uses blue when active */
.tv-nav-bottom-item[data-sheet="tilbud"].active {
    background: var(--tv-offer-blue, #3498db);
}

/* Læring item uses purple when active */
.tv-nav-bottom-item[data-sheet="laering"].active {
    background: #9B59B6;
}

/* =============================================================
   6. MOBILE SHEETS (Slide-up Panels)
   ============================================================= */

.tv-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.7);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tv-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tv-nav-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tv-paper-white);
    border-radius: var(--tv-squircle-xl) var(--tv-squircle-xl) 0 0;
    z-index: 10001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 0 rgba(0, 0, 0, 0.1);
}

.tv-nav-sheet.open {
    transform: translateY(0);
}

/* Sheet drag handle */
.tv-nav-sheet::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(44, 62, 80, 0.2);
    border-radius: 2px;
}

/* Sheet Header */
.tv-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px 16px;
    border-bottom: 2px solid var(--tv-deep-slate);
    background: #ffffff;
    flex-shrink: 0;
}

.tv-sheet-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tv-deep-slate);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tv-sheet-header h3 i {
    color: var(--tv-nav-accent);
    font-size: 1.1rem;
}

/* Inneklima sheet uses mint accent */
#tv-sheet-inneklima .tv-sheet-header h3 i {
    color: var(--tv-technical-mint);
}

/* Tilbud sheet uses blue accent */
#tv-sheet-tilbud .tv-sheet-header h3 i {
    color: var(--tv-offer-blue, #3498db);
}

/* Læring sheet uses purple accent */
#tv-sheet-laering .tv-sheet-header h3 i {
    color: #9B59B6;
}

.tv-sheet-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tv-deep-slate);
    border: none;
    border-radius: var(--tv-squircle-sm);
    color: var(--tv-paper-white);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--tv-nav-transition);
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-sheet-close:hover {
    background: var(--tv-nav-accent);
    color: var(--tv-deep-slate);
}

.tv-sheet-close:active {
    transform: translateY(2px);
    box-shadow: var(--tv-shadow-pressed);
}

/* Sheet Content */
.tv-sheet-content {
    overflow-y: auto;
    flex: 1;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Sheet Links as Cards */
.tv-sheet-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    color: var(--tv-deep-slate);
    text-decoration: none;
    background: #ffffff;
    border-radius: var(--tv-squircle-md);
    box-shadow: var(--tv-shadow-hard-sm);
    transition: all var(--tv-nav-transition);
}

.tv-sheet-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
}

.tv-sheet-link:active {
    transform: translateY(1px);
    box-shadow: var(--tv-shadow-pressed);
}

.tv-sheet-link i:first-child {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tv-deep-slate);
    color: var(--tv-nav-accent);
    border-radius: var(--tv-squircle-sm);
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--tv-shadow-hard-sm);
}

/* Inneklima sheet links use mint */
#tv-sheet-inneklima .tv-sheet-link i:first-child {
    color: var(--tv-technical-mint);
}

/* Tilbud sheet links use blue */
#tv-sheet-tilbud .tv-sheet-link i:first-child {
    color: var(--tv-offer-blue, #3498db);
}

/* Læring sheet links use purple */
#tv-sheet-laering .tv-sheet-link i:first-child {
    color: #9B59B6;
}

.tv-sheet-link div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tv-sheet-link strong {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
}

.tv-sheet-link small {
    font-size: 0.85rem;
    color: #64748b;
}

.tv-sheet-link i:last-child {
    color: var(--tv-nav-accent);
    font-size: 1rem;
}

/* Logout link in sheet */
.tv-sheet-logout i:first-child {
    background: rgba(231, 76, 60, 0.15) !important;
    color: #e74c3c !important;
    box-shadow: 0 3px 0 rgba(231, 76, 60, 0.2) !important;
}

/* User Info in Sheet */
.tv-sheet-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--tv-deep-slate);
    border-radius: var(--tv-squircle-md);
    box-shadow: var(--tv-shadow-hard-sm);
    margin-bottom: 4px;
}

.tv-sheet-user-info > i {
    font-size: 2.8rem;
    color: var(--tv-nav-accent);
}

.tv-sheet-user-info div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tv-sheet-user-info strong {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'Barlow', 'Roboto Condensed', system-ui, sans-serif;
    color: var(--tv-paper-white);
}

.tv-sheet-user-info small {
    font-size: 0.85rem;
    color: var(--tv-nav-text-muted);
}

/* =============================================================
   7. RESPONSIVE BREAKPOINTS
   ============================================================= */

@media screen and (max-width: 768px) {
    /* Vis navbar (logo) men skjul menyen */
    .tv-nav-bar {
        display: flex !important;
        padding: 0 20px;
    }

    .tv-nav-menu {
        display: none !important;
    }

    /* Vis mobil flytende dokk */
    .tv-nav-bottom {
        display: flex;
    }

    /* Legg til padding for floating dock + safe area */
    body:not(.tv-tool-page) {
        padding-bottom: calc(var(--tv-nav-mobile-height) + 40px + env(safe-area-inset-bottom, 0px));
    }
}

@media screen and (min-width: 769px) {
    /* Skjul mobil-elementer på desktop */
    .tv-nav-bottom,
    .tv-nav-sheet,
    .tv-sheet-overlay {
        display: none !important;
    }
}

/* Small mobile devices - kompaktere dock */
@media screen and (max-width: 380px) {
    .tv-nav-bottom {
        left: 12px;
        right: 12px;
        padding: 8px 4px;
    }

    .tv-nav-bottom-item {
        padding: 6px 8px;
    }

    .tv-nav-bottom-item i {
        font-size: 1.2rem;
    }
}

/* =============================================================
   8. ANIMATIONS
   ============================================================= */

@keyframes tv-nav-bounce-in {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    50% {
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes tv-nav-pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Active item pop animation */
.tv-nav-bottom-item.just-activated {
    animation: tv-nav-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =============================================================
   9. PREVENT BODY SCROLL WHEN SHEET IS OPEN
   ============================================================= */

body.tv-sheet-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* =============================================================
   10. WORDPRESS ADMIN BAR COMPATIBILITY
   ============================================================= */

body.admin-bar .tv-nav-bar {
    top: 32px;
}

body.admin-bar .tv-nav-dropdown-content:not(.tv-nav-user .tv-nav-dropdown-content) {
    top: calc(var(--tv-nav-height) + 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .tv-nav-bar {
        top: 46px;
    }

    body.admin-bar .tv-nav-dropdown-content:not(.tv-nav-user .tv-nav-dropdown-content) {
        top: calc(var(--tv-nav-height) + 46px);
    }
}

/* =============================================================
   11. FONT IMPORT (Barlow for Industrial feel)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@500;600;700&display=swap');

/* =============================================================
   12. BETA BADGE
   ============================================================= */

.tv-nav-beta-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 16px;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}
