/* ============================ */
/* Google Fonts Import */
/* ============================ */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;600;700&family=Inter:wght@400;600;700;900&display=swap');

/* ============================ */
/* CSS Variables - Dark Theme (Default) */
/* ============================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --bg-dark: #0a0a0f;
    --bg-surface: rgba(15, 23, 42, 0.5);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(99, 102, 241, 0.15);
    --code-bg: rgba(13, 17, 23, 0.7);
    --code-header-bg: rgba(0, 0, 0, 0.3);
}

/* ============================ */
/* Light Theme Variables */
/* ============================ */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: rgba(99, 102, 241, 0.2);
    --code-bg: rgba(241, 245, 249, 0.9);
    --code-header-bg: rgba(226, 232, 240, 0.5);
}

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

body { 
    font-family: 'Hind Siliguri', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.inter { font-family: 'Inter', sans-serif; }

/* ============================ */
/* Animated Background Layers */
/* ============================ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 15% 30%, rgba(99, 102, 241, 0.2), transparent 40%),
        radial-gradient(circle at 85% 70%, rgba(139, 92, 246, 0.2), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.15), transparent 50%);
    animation: gradientMove 15s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}

[data-theme="light"]::before {
    opacity: 0.4;
}

@keyframes gradientMove {
    0% { transform: scale(1) rotate(0deg); opacity: 0.4; }
    100% { transform: scale(1.1) rotate(5deg); opacity: 0.7; }
}

/* Particle Canvas */
#particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Subtle Grid Overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
}

[data-theme="light"]::after {
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.08) 1px, transparent 1px);
}

/* ============================ */
/* Glass Morphism */
/* ============================ */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

[data-theme="light"] .glass {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ============================ */
/* Header */
/* ============================ */
header {
    position: relative;
    z-index: 50;
    height: 64px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    transition: all 0.3s ease;
}

/* ============================ */
/* Theme Toggle Button */
/* ============================ */
.theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s;
}

.theme-toggle-btn:hover::before {
    opacity: 1;
}

.theme-toggle-btn:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.theme-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.theme-toggle-btn:hover .theme-icon {
    color: var(--primary);
}

/* ============================ */
/* Logo Box & Shimmer Animation */
/* ============================ */
.logo-box {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.logo-box::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* ============================ */
/* Sidebar */
/* ============================ */
#sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    width: 280px;
    padding: 1.5rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
}

#sidebar.open { transform: translateX(0); }
#sidebar.collapsed { transform: translateX(-100%); }

@media (min-width: 1024px) {
    #sidebar {
        position: relative;
        top: 0;
        transform: translateX(0);
        border-right: 1px solid var(--border-color);
    }
    #sidebar.collapsed {
        transform: translateX(-100%);
        position: fixed;
    }
}

/* Sidebar Toggle Button (Desktop) */
.sidebar-toggle {
    position: fixed;
    left: 280px;
    top: 80px;
    z-index: 45;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

@media (min-width: 1024px) {
    .sidebar-toggle { display: flex; }
    .sidebar-toggle.collapsed { left: 16px; }
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.6);
}

/* ============================ */
/* Search Box */
/* ============================ */
.search-container { position: relative; margin-bottom: 1.5rem; }

.search-box {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.3s;
    color: var(--text-primary);
}

.search-box:focus {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

/* ============================ */
/* Topic Buttons */
/* ============================ */
.topic-btn {
    width: 100%;
    text-align: left;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: all 0.3s;
    border: 1px solid transparent;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: transparent;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.topic-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    opacity: 0;
    transition: opacity 0.3s;
}

.topic-btn:hover::before { opacity: 1; }

.topic-btn:hover {
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--primary);
    transform: translateX(4px);
}

/* ============================ */
/* Main Content & Code Blocks */
/* ============================ */
main {
    position: relative;
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    z-index: 1;
    transition: margin-left 0.3s;
}

main.sidebar-collapsed { margin-left: 0; }

.code-block {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.code-block:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.code-header {
    padding: 0.875rem 1.25rem;
    background: var(--code-header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

pre {
    padding: 1.25rem;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ============================ */
/* Inputs & Buttons */
/* ============================ */
input, select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    outline: none;
    transition: all 0.3s;
    color: var(--text-primary);
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

input::placeholder { color: rgba(100, 116, 139, 0.5); }

.btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover::before { opacity: 1; }

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* ============================ */
/* Loader & Float Animation */
/* ============================ */
.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.float-anim { animation: float 4s ease-in-out infinite; }

/* ============================ */
/* Content Text Styles */
/* ============================ */
.hero-title {
    color: var(--text-primary);
}

.hero-subtitle {
    color: var(--text-secondary);
}

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

.content-title {
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content-desc {
    color: var(--text-secondary);
}

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

.tip-text {
    color: var(--text-secondary);
}

[data-theme="light"] .content-title {
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================ */
/* Scrollbar Styling */
/* ============================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

/* ============================ */
/* Responsive Styles */
/* ============================ */
@media (max-width: 1023px) {
    main { padding: 1.25rem; }
    header { padding: 0 1rem; }
    #sidebar { width: 260px; }
}

@media (max-width: 640px) {
    .mobile-hide { display: none !important; }
    main { padding: 1rem; }
}

/* ============================ */
/* Badges & Info Boxes */
/* ============================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.info-box {
    padding: 0.625rem;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    transition: all 0.3s ease;
}

[data-theme="light"] .info-box {
    background: rgba(16, 185, 129, 0.1);
}

/* ============================ */
/* Tip Box */
/* ============================ */
.tip-box {
    transition: all 0.3s ease;
}