/* ============================================
   ELECTROTĂ‰CNICA PRO - IPET NÂ°66
   ============================================ */

/* ============================================
   CSS VARIABLES & THEME
   ============================================ */
:root {
    /* iOS 26 Modern Dark Palette */
    --bg-deep: #020617;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Mesh Gradient Colors */
    --mesh-1: #1e3a8a;
    --mesh-2: #312e81;
    --mesh-3: #1e1b4b;
    --mesh-4: #0f172a;

    /* Accent Colors (Liquid Vibrancy) */
    --accent-primary: #6366f1;
    --accent-secondary: #a855f7;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* LIQUID GLASS Effect (Enhanced iOS 26) */
    --glass-bg: rgba(15, 23, 42, 0.25);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 25px 60px rgba(0, 0, 0, 0.5),
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    --liquid-glow: rgba(99, 102, 241, 0.4);
    --liquid-bg-hover: rgba(99, 102, 241, 0.12);
    --liquid-blur: 20px;
    --liquid-saturate: 1.8;

    /* Noise/Grain Texture (Sandy Effect) */
    --noise-opacity: 0.03;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.75rem;
    --radius-md: 1.25rem;
    --radius-lg: 2rem;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(148, 163, 184, 0.2);
}

/* Rainbow Theme (66 Style) - Complete App Styling */
[data-theme="rainbow"] {
    --bg-deep: #0a0a1a;
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0b0;

    /* Rainbow Mesh Gradient Colors */
    --mesh-1: #ff6b6b;
    --mesh-2: #feca57;
    --mesh-3: #48dbfb;
    --mesh-4: #5f27cd;

    /* Rainbow Accent Colors */
    --accent-primary: #ff6b6b;
    --accent-secondary: #48dbfb;
    --accent-success: #1dd1a1;
    --accent-warning: #feca57;
    --accent-danger: #ff6b6b;

    /* Rainbow Gradients */
    --gradient-primary: linear-gradient(135deg, #ff6b6b 0%, #feca57 25%, #1dd1a1 50%, #48dbfb 75%, #5f27cd 100%);
    --gradient-secondary: linear-gradient(135deg, #ff9ff3 0%, #feca57 50%, #ff6b6b 100%);
    --gradient-success: linear-gradient(135deg, #1dd1a1 0%, #48dbfb 100%);

    /* Liquid Glass (Rainbow Tint) */
    --glass-bg: rgba(20, 20, 40, 0.45);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 25px 60px rgba(0, 0, 0, 0.5),
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    --liquid-glow: rgba(255, 107, 107, 0.5);
    --liquid-bg-hover: rgba(255, 107, 107, 0.15);

    /* Noise opacity higher for rainbow sandy effect */
    --noise-opacity: 0.06;
}

/* Rainbow Theme Body Background with Sandy Texture */
[data-theme="rainbow"] body {
    background-color: #0a0a1a;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E"),
        radial-gradient(at 0% 0%, rgba(255, 107, 107, 0.35) 0, transparent 50%),
        radial-gradient(at 50% 0%, rgba(254, 202, 87, 0.3) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(29, 209, 161, 0.35) 0, transparent 50%),
        radial-gradient(at 0% 100%, rgba(72, 219, 251, 0.3) 0, transparent 50%),
        radial-gradient(at 50% 100%, rgba(95, 39, 205, 0.35) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 107, 107, 0.25) 0, transparent 50%);
    background-blend-mode: overlay, normal, normal, normal, normal, normal, normal;
}

/* Rainbow Header */
[data-theme="rainbow"] .header {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15) 0%, rgba(254, 202, 87, 0.1) 25%, rgba(29, 209, 161, 0.1) 50%, rgba(72, 219, 251, 0.15) 75%, rgba(95, 39, 205, 0.1) 100%);
    backdrop-filter: blur(25px) saturate(2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Rainbow Sidebar */
[data-theme="rainbow"] .sidebar {
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.08) 0%, rgba(95, 39, 205, 0.08) 100%);
    backdrop-filter: blur(30px) saturate(2);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

[data-theme="rainbow"] .sidebar-item:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2) 0%, rgba(72, 219, 251, 0.15) 100%);
    border-left-color: #ff6b6b;
}

[data-theme="rainbow"] .sidebar-item.active {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.25) 0%, rgba(254, 202, 87, 0.15) 50%, rgba(72, 219, 251, 0.2) 100%);
    border-left-color: #ff6b6b;
    box-shadow: inset 4px 0 0 #ff6b6b, 0 0 20px rgba(255, 107, 107, 0.3);
}

/* Rainbow Cards */
[data-theme="rainbow"] .card {
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.6) 0%, rgba(30, 30, 60, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="rainbow"] .card:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.12) 0%, rgba(254, 202, 87, 0.08) 25%, rgba(72, 219, 251, 0.1) 100%);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(255, 107, 107, 0.25),
        0 0 40px rgba(72, 219, 251, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

[data-theme="rainbow"] .card:hover::after {
    background: linear-gradient(135deg,
            #ff6b6b 0%,
            #feca57 25%,
            #1dd1a1 50%,
            #48dbfb 75%,
            #5f27cd 100%);
    opacity: 0.7;
}

/* Rainbow Info Boxes */
[data-theme="rainbow"] .info-box {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.08) 0%, rgba(72, 219, 251, 0.06) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

[data-theme="rainbow"] .info-box:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15) 0%, rgba(254, 202, 87, 0.1) 50%, rgba(72, 219, 251, 0.12) 100%);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.2);
}

/* Rainbow Buttons */
[data-theme="rainbow"] .btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="rainbow"] .btn-primary:hover {
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4), 0 0 30px rgba(72, 219, 251, 0.3);
    transform: translateY(-2px);
}

/* Rainbow Tabs */
[data-theme="rainbow"] .tab.active {
    background: var(--gradient-primary);
    color: white;
}

/* Rainbow Inputs */
[data-theme="rainbow"] input,
[data-theme="rainbow"] select {
    background: rgba(20, 20, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="rainbow"] input:focus,
[data-theme="rainbow"] select:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.3);
}

/* Rainbow Result Box */
[data-theme="rainbow"] .result-box {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.08) 0%, rgba(72, 219, 251, 0.06) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Rainbow Footer */
[data-theme="rainbow"] .footer {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(95, 39, 205, 0.1) 100%);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Rainbow Title Text */
[data-theme="rainbow"] .content-header h2 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-deep);
    background-image:
        radial-gradient(at 0% 0%, var(--mesh-1) 0, transparent 50%),
        radial-gradient(at 50% 0%, var(--mesh-2) 0, transparent 50%),
        radial-gradient(at 100% 0%, var(--mesh-3) 0, transparent 50%),
        radial-gradient(at 0% 100%, var(--mesh-2) 0, transparent 50%),
        radial-gradient(at 50% 100%, var(--mesh-4) 0, transparent 50%),
        radial-gradient(at 100% 100%, var(--mesh-1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    grid-area: header;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-image {
    width: 50px;
    height: 50px;
    border-radius: 40% 60% 70% 30% / 40% 40% 60% 60%;
    overflow: hidden;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--liquid-accent);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo h1 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.logo span {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.theme-toggle {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.theme-toggle:hover {
    background: var(--accent-primary);
    transform: scale(1.1);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    padding: var(--spacing-md);
    overflow-y: auto;
    height: calc(100vh - 80px);
    position: sticky;
    top: 80px;
}

.sidebar-section {
    margin-bottom: var(--spacing-lg);
}

.sidebar-section h3 {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
}

.sidebar-item:hover {
    background: var(--glass-bg);
    color: var(--accent-primary);
    transform: translateX(5px);
}

.sidebar-item.active {
    background: var(--accent-primary);
    color: white;
}

.sidebar-item i {
    width: 20px;
    text-align: center;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    grid-area: main;
    padding: var(--spacing-lg);
    background: var(--bg-primary);
    overflow-y: auto;
}

.content-header {
    margin-bottom: var(--spacing-lg);
}

.content-header h2 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-header p {
    color: var(--text-muted);
    font-size: var(--font-size-base);
}

/* ============================================
   CARDS & LIQUID GLASS EFFECT
   ============================================ */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--liquid-blur)) saturate(var(--liquid-saturate));
    -webkit-backdrop-filter: blur(var(--liquid-blur)) saturate(var(--liquid-saturate));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
}

/* Noise/Grain Texture Overlay */
.card::before,
.glass-card::before,
.info-box::before {}

.card>*,
.glass-card>*,
.info-box>* {
    position: relative;
    z-index: 1;
}

.card:hover {
    transform: translateY(-6px) scale(1.008);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.06) 100%);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5),
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 50px var(--liquid-glow),
        inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

/* Liquid Illuminated Border (iOS 26 Style) */
.card::after,
.glass-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.25) 0%,
            rgba(255, 255, 255, 0) 30%,
            rgba(255, 255, 255, 0.05) 70%,
            rgba(255, 255, 255, 0.15) 100%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: all 0.5s ease;
    z-index: 2;
}

.card:hover::after,
.glass-card:hover::after {
    background: linear-gradient(135deg,
            var(--accent-primary) 0%,
            rgba(255, 255, 255, 0) 35%,
            var(--accent-secondary) 100%);
    opacity: 0.7;
}

.glass-card {
    position: relative;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(40px) saturate(2.5);
    -webkit-backdrop-filter: blur(40px) saturate(2.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.glass-card:hover {
    transform: translateY(-12px) rotate(0.5deg);
    background: var(--liquid-bg-hover);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.8), 0 0 40px var(--liquid-glow);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* ============================================
   INPUTS
   ============================================ */
.input-group {
    margin-bottom: var(--spacing-md);
}

.input-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   RESULT BOX
   ============================================ */
.result-box {
    background: var(--bg-tertiary);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.result-box h4 {
    color: var(--accent-primary);
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-lg);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    grid-area: footer;
    background: var(--bg-secondary);
    border-top: 1px solid var(--glass-border);
    padding: var(--spacing-lg);
    text-align: center;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
}

.footer-logo-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.footer-text p {
    margin: 0.25rem 0;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: var(--font-size-xl);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    z-index: 999;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
}

/* ============================================
   TAB CONTENT
   ============================================ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.mt-4 {
    margin-top: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-md);
}

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

.text-muted {
    color: var(--text-muted);
}

/* ============================================
   CHART INTERACTIVITY
   ============================================ */
.chart-container {
    position: relative;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    z-index: 10;
}

.zoom-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--liquid-glow);
}

/* Expanded Chart State */
.chart-container.expanded-chart {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh !important;
    max-height: none !important;
    max-width: none !important;
    width: 90vw !important;
    z-index: 2000;
    background: var(--bg-deep);
    padding: 2rem;
    border-radius: 24px;
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 40px var(--liquid-glow);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
}

.chart-container.expanded-chart canvas {
    width: 100% !important;
    height: 100% !important;
    flex: 1;
}

.chart-container.expanded-chart::before {
    content: "";
    position: fixed;
    inset: -200vw;
    background: rgba(0, 0, 0, 0.85);
    z-index: -1;
    backdrop-filter: blur(8px);
}

/* Close Button for Expanded Charts */
.close-chart-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--accent-danger);
    color: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    z-index: 2003;
    /* Higher than reset button */
    backdrop-filter: blur(5px);
}

.close-chart-btn:hover {
    background: var(--accent-danger);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Reset Zoom Button */
.reset-zoom-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    z-index: 2002;
    backdrop-filter: blur(5px);
}

.reset-zoom-btn:hover {
    background: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--liquid-glow);
}

.chart-container.expanded-chart::before {
    content: "";
    position: fixed;
    inset: -200vw;
    background: rgba(0, 0, 0, 0.85);
    z-index: -1;
    backdrop-filter: blur(8px);
}
/* ESTILOS PARA TARJETAS DE LIBROS MEJORADOS */
.libro-card {
    background: linear-gradient(135deg, var(--color-inicio), var(--color-fin));
    border-radius: 12px;
    padding: 20px;
    margin: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.libro-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    z-index: 10;
}

.libro-icono {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.libro-titulo {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.libro-desc {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}

.subcategoria-header {
    color: var(--text-primary);
    border-left: 4px solid #4F46E5;
    padding-left: 15px;
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

/* DEGRADADO POR SUBCATEGORÍA */
.informes-tecnicos { --color-inicio: #4F46E5; --color-fin: #7C3AED; }
.metodologia { --color-inicio: #0EA5E9; --color-fin: #06B6D4; }
.normativas { --color-inicio: #10B981; --color-fin: #059669; }
.cientifica { --color-inicio: #F59E0B; --color-fin: #D97706; }
.complementarios { --color-inicio: #8B5CF6; --color-fin: #7C3AED; }
