/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Color Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #14b8a6;
    --secondary-dark: #0d9488;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Christmas Color Theme */
body.christmas-theme {
    --primary: #dc2626;
    --primary-dark: #b91c1c;
    --primary-light: #ef4444;
    --secondary: #16a34a;
    --secondary-dark: #15803d;
    --accent: #fbbf24;
    --accent-light: #fcd34d;
    --bg-primary: #fef2f2;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1a1a1a;
    --bg-sidebar-hover: #2d2d2d;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border-color: #fecaca;
    background: linear-gradient(135deg, #fef2f2 0%, #dcfce7 100%);
}

body.christmas-theme .sidebar {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
}

body.christmas-theme .sidebar-header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

body.christmas-theme .main-nav a.active {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

body.christmas-theme .page-title {
    background: linear-gradient(135deg, #dc2626 0%, #16a34a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.christmas-theme h2 {
    color: #b91c1c;
}

body.christmas-theme h3 {
    color: #dc2626;
}

body.christmas-theme th {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

body.christmas-theme .btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

body.christmas-theme .btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

body.christmas-theme .safety-notice {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #fbbf24;
}

body.christmas-theme .bibliography li {
    border-left: 3px solid #dc2626;
}

body.christmas-theme tr:nth-child(even) {
    background-color: #fef2f2;
}

body.christmas-theme tr:hover {
    background-color: #fee2e2;
}

body {
    font-family: 'Quicksand', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    min-height: 100vh;
    display: flex;
}

/* Floating Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, #0f172a 100%);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    border-radius: 0;
}

/* Snow container - separate layer to prevent layout shifts */
.snow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 0;
    position: relative;
    z-index: 2;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.site-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.main-nav {
    padding: 1.5rem 0;
    position: relative;
    z-index: 2;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.main-nav li {
    margin: 0;
    width: 100%;
    display: block;
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    padding: 0.875rem 1.5rem;
    border-radius: 0;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
}

.main-nav a:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}

.main-nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem 3rem;
    max-width: calc(100% - 280px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Page Title */
.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--border-color);
}

/* Content Sections */
.content-section {
    background: var(--bg-secondary);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

h2 {
    color: var(--primary-dark);
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h3 {
    color: var(--primary);
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    text-align: justify;
    color: var(--text-primary);
    line-height: 1.8;
}

ul, ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

th, td {
    border: 1px solid var(--border-color);
    padding: 1rem;
    text-align: left;
}

th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f8fafc;
}

tr:hover {
    background-color: #f1f5f9;
}

/* Graph Container */
.graph-container {
    background: var(--bg-secondary);
    padding: 2.5rem;
    margin: 2rem 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-color);
}

.graph-placeholder {
    border: 2px dashed var(--border-color);
    padding: 3rem;
    margin: 2rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-md);
}

/* Navigation Buttons */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    gap: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--text-secondary) 0%, #475569 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, var(--text-secondary) 100%);
}

/* Safety Notice */
.safety-notice {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.safety-notice h3 {
    color: #92400e;
    margin-top: 0;
}

/* Bibliography */
.bibliography {
    list-style: none;
    margin-left: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.bibliography li {
    margin-bottom: 1rem;
    padding: 1.25rem 1.5rem 1.25rem 2rem;
    text-indent: -1.5rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

/* Footer */
footer {
    background: transparent;
    color: var(--text-secondary);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

footer p {
    margin: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
        max-width: calc(100% - 240px);
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-radius: 0;
        max-height: 400px;
    }
    
    .sidebar-header {
        border-radius: 0;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .site-title {
        font-size: 1.25rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .page-nav {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    .main-nav a {
        padding: 1rem;
    }
    
    .nav-text {
        display: block;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .content-section {
        padding: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
}

/* Print Styles */
@media print {
    .sidebar, footer, .page-nav {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 0;
    }
    
    .content-section {
        box-shadow: none;
        page-break-inside: avoid;
        border: none;
    }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Snow Effect for Sidebar */
.snowflake {
    position: absolute;
    top: -10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    user-select: none;
    pointer-events: none;
    will-change: transform, opacity;
    animation: snowfall linear forwards;
}

@keyframes snowfall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) translateX(20px) rotate(360deg);
        opacity: 0;
    }
}

