@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Premium Global Typography */
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6, .font-display {
    font-family: 'Outfit', sans-serif;
}

/* Base Light Theme */
:root {
    --bg-mesh: radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.05) 0%, transparent 50%),
               radial-gradient(circle at 85% 30%, rgba(147, 51, 234, 0.05) 0%, transparent 50%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --border-light: rgba(0, 0, 0, 0.05);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    --metric-card-bg: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    --chat-bg: rgba(255, 255, 255, 0.95);
    --chat-border: rgba(0, 0, 0, 0.1);
    --code-bg: #f1f5f9;
}

/* Dark Theme Overrides */
html.dark {
    --bg-mesh: radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.1) 0%, transparent 50%),
               radial-gradient(circle at 85% 30%, rgba(147, 51, 234, 0.1) 0%, transparent 50%);
    --card-bg: rgba(3, 3, 5, 0.6);
    --border-light: rgba(255, 255, 255, 0.1);
    --card-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 8px 32px rgba(0, 0, 0, 0.4);
    --metric-card-bg: linear-gradient(145deg, rgba(30, 30, 40, 0.5) 0%, rgba(15, 15, 20, 0.5) 100%);
    --chat-bg: rgba(15, 15, 22, 0.85);
    --chat-border: rgba(255, 255, 255, 0.1);
    --code-bg: #030305;
}

/* Background Effects */
@keyframes mesh-float {
    0% { transform: scale(1.1) translate(0, 0) rotate(0deg); }
    33% { transform: scale(1.2) translate(1%, -1%) rotate(1deg); }
    66% { transform: scale(1.2) translate(-1%, 1%) rotate(-1deg); }
    100% { transform: scale(1.1) translate(0, 0) rotate(0deg); }
}

.bg-mesh {
    position: fixed;
    top: -10vh;
    left: -10vw;
    width: 120vw;
    height: 120vh;
    z-index: -2;
    background: var(--bg-mesh);
    pointer-events: none;
    transition: background 0.3s ease;
    animation: mesh-float 25s infinite ease-in-out;
}

#mouse-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.12) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
    transform: translate(-50%, -50%);
    opacity: 0; /* Hidden until mouse move */
    transition: opacity 0.6s ease;
}

html.dark #mouse-glow {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 60%);
}

.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Glassmorphism Components */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-light);
    border-radius: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-panel:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 20px rgba(79, 70, 229, 0.2);
}

html.dark .glass-panel:hover {
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(79, 70, 229, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.metric-card {
    background: var(--metric-card-bg);
    border: 1px solid var(--border-light);
    transition: all 0.4s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: rgba(79, 70, 229, 0.5);
    box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.2);
}

/* Premium Typography Gradients */
.text-gradient {
    background: linear-gradient(135deg, #475569 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
html.dark .text-gradient {
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
html.dark .text-gradient-primary {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* AI Chatbot Styles - MacOS Vibe */
#chat-widget {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(120%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    border: 1px solid var(--chat-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--chat-bg);
    backdrop-filter: blur(20px);
}
html.dark #chat-widget {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
#chat-widget.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Base Loader */
.loading-dots::after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { color: transparent; text-shadow: .25em 0 0 transparent, .5em 0 0 transparent; }
    40% { color: inherit; text-shadow: .25em 0 0 transparent, .5em 0 0 transparent; }
    60% { text-shadow: .25em 0 0 inherit, .5em 0 0 transparent; }
    80%, 100% { text-shadow: .25em 0 0 inherit, .5em 0 0 inherit; }
}

/* Markdown styling */
.ai-markdown strong {
    font-weight: 600;
    color: #4f46e5;
}
html.dark .ai-markdown strong {
    color: #a5b4fc;
}

.ai-markdown ul {
    list-style-type: none;
    padding-left: 0.5rem;
}

.ai-markdown li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: #475569;
}
html.dark .ai-markdown li {
    color: #cbd5e1;
}

.ai-markdown li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #6366f1;
}
html.dark .ai-markdown li::before {
    color: #818cf8;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Animated Day/Night Toggle Slider */
.theme-slider {
    width: 65px;
    height: 32px;
    background: #73C0FC; /* Day sky */
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    transition: background 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    overflow: hidden;
    display: block;
}

.theme-slider .sun-moon {
    width: 24px;
    height: 24px;
    background: #FFD43B;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 5px;
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), background 0.5s ease, box-shadow 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 212, 59, 0.6);
    z-index: 2;
}

/* Clouds for Day */
.theme-slider .scenery-day {
    position: absolute;
    width: 100%;
    height: 100%;
    /* Create couple cloud puffs */
    background: radial-gradient(circle at 65% 65%, white 4px, transparent 4px),
                radial-gradient(circle at 75% 70%, white 5px, transparent 5px),
                radial-gradient(circle at 85% 65%, white 3px, transparent 3px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
    z-index: 1;
}

/* Stars for Night */
.theme-slider .scenery-night {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 30%, white 1px, transparent 1px),
                radial-gradient(circle at 15% 60%, white 1.5px, transparent 1.5px),
                radial-gradient(circle at 45% 70%, white 1px, transparent 1px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    transform: translateY(10px);
    z-index: 1;
}

/* Dark Mode States */
html.dark .theme-slider {
    background: #1a1b32; /* Night sky */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

html.dark .theme-slider .sun-moon {
    transform: translateX(31px);
    background: #e2e8f0;
    box-shadow: inset -5px -2px 0 0 #cbd5e1; /* Creates crescent moon effect */
}

html.dark .theme-slider .scenery-day {
    opacity: 0;
    transform: translateY(15px);
}

html.dark .theme-slider .scenery-night {
    opacity: 1;
    transform: translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #f8fafc;
}
html.dark ::-webkit-scrollbar-track {
    background: #07070a;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
html.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}
