/* frontend/css/header.css */
.smart-header { position: fixed; top: 0; left: 0; width: 100%; z-index: 9999; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

.header-bar {
    background: #1a1a2e; color: white;
    display: flex; justify-content: space-between; align-items: center;
    height: 52px; padding: 0 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Logo centrado */
.header-logo {
    font-size: 17px; font-weight: 700;
    color: #667eea; text-decoration: none;
    white-space: nowrap;
    position: absolute; left: 50%; transform: translateX(-50%);
}
.header-logo span { color: white; }

/* Botón Mi Panel - Izquierda */
.header-menu-btn {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    color: #b0b0c0; padding: 7px 14px; border-radius: 8px;
    cursor: pointer; font-size: 13px; font-weight: 500;
    transition: all 0.2s; white-space: nowrap;
}
.header-menu-btn:hover { background: rgba(102,126,234,0.2); color: white; border-color: #667eea; }
.menu-btn-icon { font-size: 16px; }
.menu-btn-arrow { font-size: 10px; margin-left: 2px; }

.header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.header-icon-btn {
    position: relative; background: none; border: none;
    color: #b0b0c0; font-size: 18px; padding: 8px 10px;
    cursor: pointer; border-radius: 8px; text-decoration: none;
    display: flex; align-items: center; transition: all 0.2s;
}
.header-icon-btn:hover { color: white; background: rgba(255,255,255,0.08); }

.header-badge {
    position: absolute; top: 2px; right: 2px;
    background: #dc3545; color: white; border-radius: 50%;
    width: 18px; height: 18px; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.header-user { display: flex; align-items: center; cursor: pointer; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #667eea; color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 14px;
    overflow: hidden; transition: transform 0.2s; margin-left: 6px;
}
.user-avatar:hover { transform: scale(1.1); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Dropdown */
.header-dropdown {
    display: none; position: fixed; top: 52px; left: 10px;
    background: #1a1a2e; border-radius: 12px; padding: 8px;
    min-width: 260px; max-width: 300px;
    max-height: calc(100vh - 70px); overflow-y: auto;
    z-index: 10000; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid #2a2a4e;
}
.header-dropdown.show { display: block; animation: fadeIn 0.2s ease; }

.dropdown-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; color: white; font-weight: 600; font-size: 14px;
}
.dropdown-close { background: none; border: none; color: #888; font-size: 16px; cursor: pointer; padding: 4px 8px; }
.dropdown-close:hover { color: white; }
.dropdown-divider { border-top: 1px solid #2a2a4e; margin: 4px 0; }

.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; color: #b0b0c0; text-decoration: none;
    border-radius: 8px; font-size: 13px; transition: all 0.15s; position: relative;
}
.menu-item:hover { background: rgba(102,126,234,0.15); color: white; }
.menu-item.active { background: rgba(102,126,234,0.2); color: white; }
.menu-item.active::before { content: '▶'; position: absolute; left: -2px; color: #667eea; font-size: 8px; }
.menu-item.highlight { border: 1px dashed #667eea; margin: 4px 0; }
.menu-icon { font-size: 16px; width: 22px; text-align: center; }
.menu-text { flex: 1; }
.menu-badge { background: #dc3545; color: white; border-radius: 10px; padding: 2px 7px; font-size: 10px; font-weight: 700; }
.logout-item { color: #ff6b6b; }
.logout-item:hover { background: rgba(220,53,69,0.2); }

/* Panel Notificaciones */
.notif-panel {
    display: none; position: fixed; top: 52px; right: 10px;
    background: white; border-radius: 12px; width: 360px;
    max-height: 420px; overflow-y: auto; z-index: 10000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.notif-panel.show { display: block; animation: fadeIn 0.2s ease; }
.notif-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid #eee;
    position: sticky; top: 0; background: white; z-index: 1; font-size: 14px;
}
.notif-panel-header button { background: none; border: none; color: #667eea; cursor: pointer; font-size: 12px; font-weight: 600; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; }
.notif-item:hover { background: #f8f9ff; }
.notif-item.no-leida { background: #f0f2ff; border-left: 3px solid #667eea; }
.notif-titulo { font-weight: 600; font-size: 13px; color: #333; }
.notif-mensaje { font-size: 12px; color: #666; margin-top: 3px; }
.notif-tiempo { font-size: 10px; color: #999; margin-top: 4px; }

.header-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 9998; }
.header-overlay.show { display: block; }

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

@media (max-width: 768px) {
    .header-bar { padding: 0 8px; }
    .header-logo { font-size: 15px; }
    .header-menu-btn { padding: 6px 10px; font-size: 12px; }
    .menu-btn-text { display: inline; }
    .header-icon-btn { padding: 6px 8px; font-size: 16px; }
    .header-dropdown { left: 5px; right: 5px; min-width: auto; max-width: none; border-radius: 0 0 12px 12px; }
    .notif-panel { left: 5px; right: 5px; width: auto; border-radius: 0 0 12px 12px; }
}

@media (max-width: 400px) {
    .header-bar { height: 48px; }
    .header-logo { font-size: 14px; }
    .header-menu-btn { padding: 5px 8px; }
    .header-icon-btn { padding: 5px 6px; font-size: 15px; }
    .user-avatar { width: 28px; height: 28px; font-size: 12px; }
    .header-dropdown, .notif-panel { top: 48px; }
}
/* Botones rápidos del header */
.header-quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    margin: 0 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.header-quick-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.header-quick-btn.highlight {
    animation: pulse-quick 2s infinite;
    box-shadow: 0 0 0 0 rgba(111, 66, 193, 0.6);
}
@keyframes pulse-quick {
    0%, 100% { box-shadow: 0 0 0 0 rgba(111, 66, 193, 0.6); }
    50% { box-shadow: 0 0 0 8px rgba(111, 66, 193, 0); }
}

@media (max-width: 500px) {
    .header-quick-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
}
/* Ocultar logo en pantallas pequeñas (≤610px) */
@media (max-width: 610px) {
    .header-logo {
        display: none;
    }
}
/* Placeholder del header mientras carga */
.header-placeholder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 52px;
    background: #1a1a2e;
    z-index: 9998;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-placeholder .logo {
    font-size: 17px;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-placeholder .logo span {
    color: white;
}

.header-placeholder .skeleton {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.header-placeholder .skeleton-circle {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.header-placeholder .skeleton-btn {
    width: 100px;
    height: 32px;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Ocultar placeholder cuando el header real carga */
.smart-header.loaded + .header-placeholder {
    display: none;
}