/* ═══════════════════════════════════════════════════════════════════════════
   Header & Navigation
   Top navigation bar and mode selector
   ═══════════════════════════════════════════════════════════════════════════ */

/* =============================================================================
   FIXED HEADER CONTAINER - Wraps header and mode selector
   ============================================================================= */

.fixed-header-container {
    position: fixed;
    top: env(safe-area-inset-top, 15px);
    margin-top: 15px;
    left: 0;
    right: 0;
    z-index: 100;
    overflow: visible; /* Allow dropdowns to overflow */
}

/* =============================================================================
   HEADER ROW - Top navigation bar
   ============================================================================= */

.mini-cycle-header-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    /* Extend padding to cover status bar seamlessly */
    padding: calc(env(safe-area-inset-top) + 4px) 16px 4px 16px;
    /* Use theme-aware backgrounds */
    background: var(--theme-header-bg, var(--header-bg, #5680ff));
    border: none;
    border-radius: 0;
    backdrop-filter: blur(5px);
    height: auto;
    min-height: 45px;
}

/* =============================================================================
   HEADER VARIABLES
   ============================================================================= */

:root {
    --header-bg: #5680ff;
    --header-border: rgba(255, 255, 255, 0.2);
    --header-text: #ffffff;
    --header-height: 60px;
}

/* Dark mode header variables are in dark-mode.css */

/* =============================================================================
   HEADER BRANDING
   ============================================================================= */

.header-branding {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.header-logo {
    height: 25px;
    width: auto;
    border-radius: 6px;
    position: relative;
    z-index: 1;
    order: 1;
}

.header-logo:hover {
    transform: scale(1.1);
}

/* Logo flash effects for feedback */
.header-logo.logo-flash-green {
    background-color: #28a745 !important;
    border-radius: 6px !important;
    transition: background-color 0.3s ease;
}

.header-logo.logo-flash-red {
    background-color: #dc3545 !important;
    border-radius: 6px !important;
    transition: background-color 0.3s ease;
}

/* =============================================================================
   MENU BUTTON
   ============================================================================= */

.menu-button {
    justify-self: end;
    background: rgba(0, 0, 0, 0.787);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 6px;
    color: white;
    padding: 7px 10px;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
}

.menu-button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.menu-button:active {
    transform: scale(0.95);
}

/* =============================================================================
   MODE SELECTOR WRAPPER
   ============================================================================= */

.mode-selector-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    padding: 2px 0;
    background: linear-gradient(135deg, #f1f1f172, #ffffff10);
    border-bottom: none;
    backdrop-filter: blur(5px);
    min-height: 28px;
    overflow: visible; /* Allow quick-actions menu to overflow */
}

/* Mode selector dropdown */
.mode-selector-wrapper .mode-selector {
    position: relative;
    background: rgba(255,255,255,0.2);
    box-shadow: 0 2px 4px rgba(226, 226, 226, 0.2);
    border: 1px solid #0c20913f;
    color: rgb(44, 50, 112);
    border-radius: 5px;
    padding: 3px 20px 3px 8px;
    font-size: 12px;
    font-weight: 500;
    max-width: 140px;
    height: 22px;
    appearance: none;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
    /* Dropdown arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%232c3270' viewBox='0 0 16 16'%3e%3cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
}

/* =============================================================================
   LAYOUT POSITIONING FOR MODE SELECTOR BUTTONS
   Component styles are in mode-selector.css and routine-switcher.css
   ============================================================================= */

/* Desktop: Move buttons closer to center */
@media (min-width: 769px) {
    .quick-actions-container {
        left: calc(50% - 280px);
    }

    .routine-switcher-btn {
        right: calc(50% - 280px);
    }
}

/* =============================================================================
   APP NAME
   ============================================================================= */

.app-name {
    height: 35px;
    width: auto;
    position: relative;
    z-index: 1;
    order: 2;
}

/* =============================================================================
   MOBILE HEADER ADJUSTMENTS
   ============================================================================= */

@media (max-width: 868px) {
    .fixed-header-container {
        top: env(safe-area-inset-top, 20px);
        margin-top: 20px;
    }

    .mini-cycle-header-row {
        padding: 8px 13px;
        background: var(--theme-header-bg, var(--header-bg));
        border: none;
        height: 50px;
        grid-template-columns: 1fr auto;
        gap: 6px;
    }

    .header-logo {
        width: auto;
        height: 30px;
    }

    .app-name {
        width: auto;
        height: 40px;
    }

    .menu-button {
        background-color: rgba(0, 0, 0, 0.8);
        border: 1px solid rgba(0, 0, 0, 0.475);
        color: rgb(255, 255, 255);
        font-size: 20px;
    }
}

/* =============================================================================
   TITLE TEXT
   ============================================================================= */

.title-text {
    color: rgb(255, 255, 255);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =============================================================================
   MOBILE ADJUSTMENTS
   ============================================================================= */

@media (max-width: 480px) {
    .fixed-header-container {
        top: env(safe-area-inset-top, 15px);
        margin-top: 20px;
    }

    .mini-cycle-header-row {
        padding: calc(env(safe-area-inset-top) + 4px) 12px 4px 12px;
        min-height: 42px;
        background: var(--theme-header-bg, var(--header-bg));
    }

    .header-logo {
        width: 28px;
        height: 28px;
    }
}
