/* ===== 統一導覽列樣式 ===== */

.header {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0 1.5rem;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

.header-spacer {
    height: calc(56px + env(safe-area-inset-top, 0px));
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.25rem;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
    margin: 0;
}

.header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.header .status {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: rgba(var(--accent-rgb, 0, 217, 255), 0.1);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.header .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ecdc4;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--accent);
    background: rgba(var(--accent-rgb, 0, 217, 255), 0.1);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(var(--accent-rgb, 0, 217, 255), 0.15);
    font-weight: 500;
}

.nav-link .nav-icon {
    font-size: 1rem;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#effectsContainer,
#themeSwitcherContainer,
#uiSwitcherContainer {
    position: relative;
    z-index: 9999;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: rgba(var(--accent-rgb, 0, 217, 255), 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--danger, #ff6b6b);
    color: var(--danger, #ff6b6b);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--danger, #ff6b6b);
    color: #fff;
}

/* ===== 平板 (≤1200px)：隱藏文字只留 icon ===== */
@media (max-width: 1200px) {
    .nav-text { display: none; }
    .nav-link { padding: 0.4rem 0.5rem; }
}

/* ===== 平板小 (≤1024px) ===== */
@media (max-width: 1024px) {
    .header {
        padding: 0 1rem;
    }
    .header h1 {
        font-size: 1.1rem;
    }
    .header-right {
        gap: 0.35rem;
    }
}

/* ===== 手機 (≤640px)：精簡頂部 ===== */
@media (max-width: 640px) {
    .header {
        height: calc(44px + env(safe-area-inset-top, 0px));
        padding: 0 0.6rem;
        padding-top: env(safe-area-inset-top, 0px);
    }
    .header-spacer {
        height: calc(44px + env(safe-area-inset-top, 0px));
    }
    .header h1 {
        font-size: 0.95rem;
        flex-shrink: 1;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-right {
        gap: 0.2rem;
        flex-shrink: 0;
    }
    .header-right .nav-links {
        display: none;
    }
    /* 手機隱藏效果、主題、用戶徽章 — 移到設定頁操作 */
    .header-controls {
        display: none !important;
    }
    .user-badge {
        display: none;
    }
    .header .status {
        padding: 0.2rem 0.4rem;
        font-size: 0;  /* 隱藏文字 */
    }
    .header .status-dot {
        width: 7px;
        height: 7px;
    }
    .header .status span {
        display: none;
    }
    .logout-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
}

/* ===== 極小螢幕 (≤380px) ===== */
@media (max-width: 380px) {
    .header {
        height: calc(40px + env(safe-area-inset-top, 0px));
        padding: 0 0.5rem;
        padding-top: env(safe-area-inset-top, 0px);
    }
    .header-spacer {
        height: calc(40px + env(safe-area-inset-top, 0px));
    }
    .header h1 {
        font-size: 0.85rem;
    }
    .logout-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}
