/**
 * Ratsutamise Päeviku Header Stiilid - PARANDATUD KONTRAST + SVG LOGO
 * Keelevahetaja ja profiil alati nähtav, suurem kontrast
 * Asukoht: public_html/paavik/assets/css/header.css
 */

/* ================================================================
   HEADER LAYOUT & STRUCTURE - PARANDATUD KONTRAST
   ================================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.08);
}

.navbar {
    padding: var(--space-3) 0;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

/* ================================================================
   BRAND & LOGO - ELEGANTNE SVG LOGO
   ================================================================ */
.navbar-brand {
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: #1f2937;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-weight: var(--font-weight-semibold);
}

.brand-link:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* SVG Logo Stiilid */
.brand-logo {
    width: 32px;
    height: 32px;
    color: #374151;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.brand-link:hover .brand-logo {
    color: #1f2937;
    transform: scale(1.05);
}

.brand-text {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: #1f2937;
    white-space: nowrap;
}

/* ================================================================
   DESKTOP NAVIGATION
   ================================================================ */
.navbar-nav {
    display: none;
    align-items: center;
    gap: var(--space-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    color: #6b7280;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(0, 0, 0, 0.1);
    color: #1f2937;
    font-weight: var(--font-weight-semibold);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #6b7280;
    border-radius: 50%;
}

.nav-link.primary {
    background: #1f2937;
    color: white;
    font-weight: var(--font-weight-semibold);
}

.nav-link.primary:hover {
    background: #111827;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-text {
    font-size: var(--font-size-sm);
}

/* ================================================================
   HEADER ACTIONS - PARANDATUD NÄHTAVUS
   ================================================================ */
.navbar-user {
    flex-shrink: 0;
    position: relative;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ================================================================
   LANGUAGE SWITCHER - ALATI NÄHTAV
   ================================================================ */
.header-lang-switcher {
    display: flex;
    gap: var(--space-1);
    background: rgba(0, 0, 0, 0.04);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.lang-btn {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: #6b7280;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1f2937;
    transform: translateY(-1px);
}

.lang-btn.active {
    background: #1f2937;
    color: white;
    font-weight: var(--font-weight-bold);
}

/* ================================================================
   PROFILE LINK - SISSELOGITUD KASUTAJA
   ================================================================ */
.profile-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    color: #6b7280;
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.profile-link:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.profile-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.profile-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* ================================================================
   AUTH BUTTONS - SISSELOGIMATA KASUTAJAD (UUENDATUD SVG IKOONIDEGA)
   ================================================================ */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 4px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Logi sisse nupp (btn-outline) - ILMA RAAMITA */
.btn.btn-outline {
    color: #6b7280;
    border: none;                    /* Raam ära */
    background: transparent;         /* Läbipaistev taust */
}

.btn.btn-outline:hover {
    background: rgba(107, 114, 128, 0.1);  /* Õrn hover */
    color: #374151;
    border: none;
    transform: translateY(-1px);
    box-shadow: none;                       /* Shadow ära */
}

/* Registreeru nupp (btn-primary) - ILMA RAAMITA */
.btn.btn-primary {
    background: transparent;         /* Läbipaistev taust */
    color: #6b7280;                 /* Sama värv kui outline */
    border: none;                    /* Raam ära */
}

.btn.btn-primary:hover {
    background: rgba(107, 114, 128, 0.1);  /* Sama hover kui outline */
    border: none;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: none;                       /* Shadow ära */
}

/* SVG ikoonid - sobivad suurused ja toonid */
.btn .btn-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    display: none; /* Peidetud desktop vaates */
}

.btn .btn-text {
    font-size: var(--font-size-sm);
}

/* ================================================================
   FLASH MESSAGES - UUENDATUD ELEGANTSED
   ================================================================ */
.flash-messages {
    position: fixed;
    top: 70px;
    right: var(--space-4);
    z-index: 1100;
    max-width: 400px;
    width: auto;
    pointer-events: none;
}

.flash-message {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
    border: 1px solid;
    animation: flashSlideIn 0.4s ease-out;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Success - Elegantne roheline */
.flash-success {
    background: rgba(255, 255, 255, 0.95);
    border-color: #10b981;
    color: #065f46;
    border-left: 4px solid #10b981;
}

/* Error - Elegantne punane */
.flash-error {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ef4444;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

/* Warning - Elegantne oranž */
.flash-warning {
    background: rgba(255, 255, 255, 0.95);
    border-color: #f59e0b;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* Info - Elegantne hall */
.flash-info {
    background: rgba(255, 255, 255, 0.95);
    border-color: #6b7280;
    color: #374151;
    border-left: 4px solid #6b7280;
}

.flash-content {
    flex: 1;
    font-weight: var(--font-weight-medium);
}

.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    color: currentColor;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    width: 20px;
    height: 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.flash-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

/* ================================================================
   MOBILE FLASH MESSAGES - OPTIMEERITUD
   ================================================================ */
@media (max-width: 767px) {
    .flash-messages {
        top: 60px;
        left: var(--space-3);
        right: var(--space-3);
        max-width: none;
    }
    
    .flash-message {
        padding: var(--space-3);
        font-size: var(--font-size-sm);
        border-radius: var(--radius);
        margin-bottom: var(--space-2);
    }
    
    .flash-close {
        width: 24px;
        height: 24px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .flash-messages {
        top: 55px;
        left: var(--space-2);
        right: var(--space-2);
    }
    
    .flash-message {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
    }
}

/* ================================================================
   RESPONSIVE BREAKPOINTS - PARANDATUD NÄHTAVUS
   ================================================================ */
@media (min-width: 768px) {
    .navbar-nav.desktop-nav { 
        display: flex; 
    }
    
    /* Desktop vaates näita auth nuppudes ikoone */
    .btn .btn-icon {
        display: block; /* Näita ikoone ka desktop'is */
    }
}

/* MOBILE - KEELEVAHETAJA JA PROFIIL NÄHTAVAD + AUTH IKOONID */
@media (max-width: 767px) {
    /* Näita auth nuppude ikoone mobiilis */
    .btn .btn-icon {
        display: block;
    }
    
    /* Peida auth nuppude tekst mobiilis, et header oleks kitsam */
    .btn .btn-text {
        display: none;
    }
    
    /* Vähenda auth nuppude paddingut mobiilis */
    .btn {
        padding: 3px var(--space-2);
        min-width: 34px;
        justify-content: center;
    }
    
    /* Vähenda auth nuppude vahet mobiilis */
    .auth-buttons {
        gap: var(--space-1);
    }
    
    /* Peamiselt säilitame header-actions nähtavuse */
    .header-actions {
        display: flex; /* Ei peida mobile's */
        gap: var(--space-2);
    }
    
    .profile-text {
        display: none; /* Peida ainult tekst mobile's, ikoon jääb */
    }
    
    .header-lang-switcher {
        padding: 4px;
    }
    
    .lang-btn {
        min-width: 28px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .profile-link {
        padding: var(--space-2);
        min-width: 40px;
        justify-content: center;
    }
    
    .flash-messages {
        left: var(--space-3);
        right: var(--space-3);
        max-width: none;
        top: 70px;
    }
    
    .brand-text {
        font-size: var(--font-size-lg);
    }
    
    .brand-logo {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: var(--space-2) 0;
    }
    
    .navbar-content {
        gap: var(--space-2);
    }
    
    .brand-link {
        padding: var(--space-2);
    }
    
    .brand-text {
        font-size: var(--font-size-base);
    }
    
    .brand-logo {
        width: 24px;
        height: 24px;
    }
    
    .header-actions {
        gap: var(--space-1);
    }
    
    .profile-link {
        min-width: 36px;
        padding: var(--space-1);
    }
    
    .profile-icon {
        width: 16px;
        height: 16px;
    }
    
    /* Väga väikesed auth nupud */
    .btn {
        padding: 2px var(--space-2);
        min-width: 32px;
    }
    
    .btn .btn-icon {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 380px) {
    .brand-text {
        display: none; /* Väga väikestel ekraanidel peida tekst, jäta ainult logo */
    }
    
    .header-lang-switcher {
        padding: 2px;
    }
    
    .lang-btn {
        min-width: 24px;
        padding: 2px 4px;
        font-size: 9px;
    }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.desktop-only {
    display: block;
}

@media (max-width: 767px) {
    .desktop-only {
        display: none;
    }
}

/* ================================================================
   ACCESSIBILITY & FOCUS STATES
   ================================================================ */
.brand-link:focus,
.nav-link:focus,
.profile-link:focus,
.btn:focus,
.lang-btn:focus {
    outline: 2px solid #6b7280;
    outline-offset: 2px;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
    .header {
        position: static;
        box-shadow: none;
        background: white !important;
        color: black !important;
        border-bottom: 1px solid #ccc;
    }
    
    .navbar-nav,
    .navbar-user,
    .auth-buttons,
    .flash-messages {
        display: none !important;
    }
    
    .brand-text {
        color: black !important;
    }
    
    .brand-logo {
        color: black !important;
    }
}