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

.header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 16px 28px;
    margin: 24px 24px 32px;

    background: var(--card);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);

    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);

    box-shadow:
        var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

body.light .header {
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

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

/* BRAND */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.brand img,
.login-header img {
    width: 42px;
    height: 42px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    object-fit: contain;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}

.login-header img {
    width: 72px;
    height: 72px;
}

.brand img:hover,
.login-header img:hover {
    transform: scale(1.05);
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* TOP RIGHT */
.top-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 1024px) {
    .header {
        padding: 14px 20px;
        margin: 20px 16px 24px;
    }

    .top-right { gap: 12px; }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .top-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 12px 16px;
        margin: 16px 12px 20px;
    }

    .brand h1 { font-size: 18px; }
}

/* =========================
   BARRA DE BÚSQUEDA
========================= */

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container input {
    width: 300px;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-soft);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
}

.search-container input::placeholder {
    color: var(--text-dim);
}

.search-container input:hover {
    border-color: var(--card-border);
    background: var(--card-hover);
}

.search-container input:focus {
    border-color: var(--accent);
    background: var(--card);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

@media (max-width: 768px) {
    .search-container input {
        width: 200px;
    }
}

@media (max-width: 640px) {
    .search-container input {
        width: 100%;
    }
}

/* =========================
   NOTIFICACIONES
========================= */

.notification-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: var(--card-soft);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon-btn:hover {
    background: var(--card-hover);
    transform: scale(1.05);
}

.notification-icon-btn:active {
    transform: scale(0.95);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--card);
}

/* =========================
   RELOJ & FECHA
========================= */

.datetime {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    line-height: 1.2;
}

#clock {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text);
}

#fecha {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

/* =========================
   THEME BUTTONS
========================= */

.theme-buttons {
    display: flex;
    gap: 8px;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: var(--card-soft);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.theme-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text);
    stroke: var(--text);
    stroke-width: 2;
}

.theme-btn:hover {
    background: var(--card-hover);
    transform: scale(1.05);
}

.theme-btn:active {
    transform: scale(0.95);
}

.theme-btn.active {
    background: var(--accent);
}

.theme-btn.active svg {
    fill: white;
    stroke: white;
}

/* DARK STATE (default) */
body:not(.light) .moon-btn {
    background: var(--accent);
}

body:not(.light) .moon-btn svg {
    fill: white;
    stroke: white;
}

body:not(.light) .sun-btn {
    background: var(--card-soft);
}

/* LIGHT STATE */
body.light .sun-btn {
    background: var(--accent);
}

body.light .sun-btn svg {
    fill: white;
    stroke: white;
}

body.light .moon-btn {
    background: var(--card-soft);
}

/* =========================
   MENU DROPDOWN
========================= */

.menu-container {
    position: relative;
}

#menuBtn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

#menuBtn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.08);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

#menuBtn:active {
    transform: scale(0.95);
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: var(--z-dropdown);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    min-width: 220px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all var(--transition);
}

body.light .menu-dropdown {
    background: rgba(255, 255, 255, 0.96);
}

.menu-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.menu-dropdown button {
    padding: 11px 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.menu-dropdown button:hover {
    background: var(--accent);
    color: white;
    transform: translateX(4px);
}

.menu-dropdown button:active {
    transform: translateX(2px);
}
