/* --- Header Moderno --- */
header {
    background: var(--header-gradient);
    color: var(--header-text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: var(--spacing-lg) 0;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Efectos visuales modernos */
header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

header::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.header-content {
    padding: var(--spacing-md) var(--spacing-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    gap: var(--spacing-lg);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-logo {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.theme-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--header-text);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-base);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-icon {
    font-size: 16px;
}

nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

nav button {
    padding: var(--spacing-sm) var(--spacing-lg);
    cursor: pointer;
    background: var(--nav-button-bg);
    color: var(--header-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans-serif);
    transition: var(--transition-base);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-width: 110px;
    text-align: center;
}

nav button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

nav button:hover::before {
    left: 100%;
}

nav button:hover,
nav button.active {
    background: var(--nav-button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

nav button.active {
    background: var(--nav-button-active-bg);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

nav button.secondary {
    background: var(--danger-color);
    border-color: var(--danger-hover-color);
}

nav button.secondary:hover {
    background: var(--danger-hover-color);
    transform: translateY(-2px);
}

nav button:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.05);
}

/* --- Theme Modal Styles --- */
.theme-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.theme-modal.show {
    opacity: 1;
    visibility: visible;
}

.theme-modal.closing {
    opacity: 0;
    visibility: hidden;
}

.theme-modal-content {
    background: var(--card-background, white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.theme-modal.show .theme-modal-content {
    transform: scale(1);
}

.theme-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.theme-modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.theme-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted-color);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.theme-modal-close:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.theme-modal-body {
    padding: var(--spacing-lg);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
}

.theme-option {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--card-background);
}

.theme-option:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--primary-color);
    background: var(--primary-light, rgba(102, 126, 234, 0.1));
}

.theme-preview {
    height: 80px;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
    position: relative;
}

.theme-preview[data-theme=""] .theme-preview-header,
.theme-preview[data-theme="default"] .theme-preview-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-preview[data-theme="dark"] .theme-preview-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.theme-preview[data-theme="nature"] .theme-preview-header {
    background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
}

.theme-preview[data-theme="sunset"] .theme-preview-header {
    background: linear-gradient(135deg, #dc2626 0%, #f59e0b 100%);
}

.theme-preview[data-theme="ocean"] .theme-preview-header {
    background: linear-gradient(135deg, #0c4a6e 0%, #0ea5e9 100%);
}

.theme-preview-header {
    height: 30px;
    width: 100%;
}

.theme-preview-content {
    padding: var(--spacing-xs);
    height: 50px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.theme-preview-card {
    height: 20px;
    background: var(--card-background);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.theme-preview-button {
    height: 16px;
    background: var(--primary-color);
    border-radius: 4px;
    width: 60%;
}

.theme-info {
    text-align: center;
}

.theme-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-xs);
}

.theme-info h4 {
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.theme-info p {
    margin: 0;
    color: var(--text-secondary-color);
    font-size: 0.9rem;
    line-height: 1.3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .header-logo {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    nav {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    nav button {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .header-controls {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .theme-grid {
        grid-template-columns: 1fr;
    }
    
    .theme-modal-content {
        width: 95%;
        margin: var(--spacing-md);
    }
    
    .theme-modal-header,
    .theme-modal-body {
        padding: var(--spacing-md);
    }
}