:root {
    /* Light Mode Colors */
    --deep-space-blue: #0D1B2A;
    --living-coral: #FF6F61;
    --future-white: #F0F4F8;
    --structure-grey: #415A77;
    --white: #FFFFFF;

    /* Theme Variables */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F0F4F8;
    --bg-accent: #0D1B2A;
    --text-primary: #0D1B2A;
    --text-secondary: #415A77;
    --text-light: #FFFFFF;
    --border-subtle: rgba(65, 90, 119, 0.2);
    --border-strong: rgba(65, 90, 119, 0.3);
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --deep-space-blue: #1e293b;
    --living-coral: #FF6F61;
    --future-white: #0f172a;
    --structure-grey: #94a3b8;
    --white: #0f172a;

    /* Theme Variables for Dark Mode */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-accent: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #f1f5f9;
    --border-subtle: rgba(148, 163, 184, 0.2);
    --border-strong: rgba(148, 163, 184, 0.3);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Updated color classes to use theme variables */
.bg-living-coral { background-color: var(--living-coral); }
.text-living-coral { color: var(--living-coral); }
.bg-deep-space-blue { background-color: var(--bg-accent); }
.text-deep-space-blue { color: var(--text-primary); }
.bg-future-white { background-color: var(--bg-primary); }
.text-future-white { color: var(--text-light); }
.bg-structure-grey { background-color: var(--text-secondary); }
.text-structure-grey { color: var(--text-secondary); }

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Poppins:wght@300;400;500;600;700&display=swap');

.font-sans-custom { font-family: 'Poppins', sans-serif; }
.font-serif-custom { font-family: 'Lora', serif; }
.font-display { font-family: 'Orbitron', 'Poppins', sans-serif; }

.container {
    max-width: 1280px;
}

.hero-gradient {
    background: linear-gradient(135deg, var(--deep-space-blue) 0%, #1a3a5d 100%);
    position: relative;
}

.shadow-subtle {
    box-shadow: 0 4px 12px rgba(13, 27, 42, 0.05), 0 2px 4px rgba(13, 27, 42, 0.05);
}

[data-theme="dark"] .shadow-subtle {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shadow-strong {
    box-shadow: 0 10px 25px rgba(13, 27, 42, 0.1), 0 5px 10px rgba(13, 27, 42, 0.08);
}

[data-theme="dark"] .shadow-strong {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 5px 10px rgba(0, 0, 0, 0.2);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background-color: var(--text-secondary);
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    padding: 3px;
}

.dark-mode-toggle:before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    left: 3px;
}

[data-theme="dark"] .dark-mode-toggle {
    background-color: var(--living-coral);
}

[data-theme="dark"] .dark-mode-toggle:before {
    transform: translateX(30px);
}

/* Center alignment utilities */
.text-center-force {
    text-align: center !important;
}

.mx-auto-force {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Navigation Dark Mode */
.nav-link {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--living-coral);
}

/* Cards Dark Mode */
.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--border-strong);
}

/* White cards should always have dark text, even in dark mode */
.bg-white h3,
.bg-white p,
.bg-white .text-deep-space-blue,
.bg-white .text-structure-grey {
    color: #0D1B2A !important;
}

.bg-white .text-structure-grey {
    color: #415A77 !important;
}

/* Ensure white cards stay white in dark mode */
[data-theme="dark"] .bg-white {
    background-color: #ffffff !important;
}

/* Icons in white cards should stay colored */
[data-theme="dark"] .bg-white .text-living-coral {
    color: #FF6F61 !important;
}

/* Form elements dark mode */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: var(--bg-secondary);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: var(--living-coral);
    box-shadow: 0 0 0 3px rgba(255, 111, 97, 0.1);
}

/* AI Agent Interface Dark Mode */
[data-theme="dark"] #ai-agent-interface {
    background-color: var(--bg-secondary);
    border-color: var(--border-subtle);
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.border-living-coral { border-color: var(--living-coral); }
.ring-living-coral { --tw-ring-color: var(--living-coral); }

.bg-living-coral\/10 { background-color: rgba(255, 111, 97, 0.1); }
.text-future-white\/80 { color: rgba(240, 244, 248, 0.8); }
.text-future-white\/90 { color: rgba(240, 244, 248, 0.9); }

/* Animation Keyframes */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out forwards;
}

/* For elements initially hidden for scroll animations */
[data-initial-hidden] {
    opacity: 0;
}

[data-scroll-fade] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-scroll-fade].is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Custom prose styles */
.prose {
    --tw-prose-body: var(--structure-grey);
    --tw-prose-headings: var(--deep-space-blue);
    --tw-prose-lead: var(--structure-grey);
    --tw-prose-links: var(--living-coral);
    --tw-prose-bold: var(--deep-space-blue);
    --tw-prose-counters: var(--structure-grey);
    --tw-prose-bullets: var(--structure-grey);
    --tw-prose-hr: #e5e7eb;
    --tw-prose-quotes: var(--deep-space-blue);
    --tw-prose-quote-borders: var(--living-coral);
    --tw-prose-captions: #6b7280;
    --tw-prose-code: var(--deep-space-blue);
    --tw-prose-pre-code: #e5e7eb;
    --tw-prose-pre-bg: var(--deep-space-blue);
    --tw-prose-th-borders: #d1d5db;
    --tw-prose-td-borders: #e5e7eb;
}

#nav-menu.hidden {
    display: none;
}

@media (min-width: 768px) {
    #nav-menu.hidden {
        display: flex;
    }
}

/* Project Filter Buttons */
.filter-btn {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.filter-btn:hover {
    background-color: var(--living-coral);
    color: white;
    border-color: var(--living-coral);
}

.filter-btn.active {
    background-color: var(--living-coral);
    color: white;
    border-color: var(--living-coral);
    box-shadow: 0 4px 12px rgba(255, 111, 97, 0.3);
}

/* Project Cards */
.project-card {
    will-change: transform, box-shadow;
}

.project-card:hover {
    transform: translateY(-8px);
}

/* Line clamp utility for project descriptions */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stat cards on project hero */
.stat-card {
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Subtle grid pattern */
.subtle-grid-pattern {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Dark mode adjustments for projects */
[data-theme="dark"] .project-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
}

[data-theme="dark"] .project-card h3,
[data-theme="dark"] .project-card p {
    color: var(--text-primary);
}

[data-theme="dark"] .filter-btn {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

[data-theme="dark"] .filter-btn:hover,
[data-theme="dark"] .filter-btn.active {
    background-color: var(--living-coral);
    color: white;
    border-color: var(--living-coral);
}

/* AI Avatar Styles */
.ai-avatar-overlay {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 9999;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

#ai-avatar-container.visible .ai-avatar-overlay {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.ai-avatar-window {
    background: linear-gradient(135deg, var(--deep-space-blue) 0%, #1a3a5d 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(13, 27, 42, 0.4);
    overflow: hidden;
    width: 320px;
    backdrop-filter: blur(10px);
}

.ai-avatar-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}

.ai-avatar-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
}

#avatar-canvas {
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 30px;
}

.visualizer-bar {
    width: 4px;
    height: 8px;
    background: var(--living-coral);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.audio-visualizer.active .visualizer-bar {
    animation: visualizer-bounce 0.6s ease-in-out infinite;
}

.audio-visualizer.active .visualizer-bar:nth-child(1) {
    animation-delay: 0s;
}

.audio-visualizer.active .visualizer-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.audio-visualizer.active .visualizer-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.audio-visualizer.active .visualizer-bar:nth-child(4) {
    animation-delay: 0.1s;
}

.audio-visualizer.active .visualizer-bar:nth-child(5) {
    animation-delay: 0s;
}

@keyframes visualizer-bounce {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 24px;
    }
}

.ai-avatar-footer {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Close button */
#close-avatar {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#close-avatar:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ai-avatar-overlay {
        right: 15px;
        bottom: 80px;
    }

    .ai-avatar-window {
        width: 280px;
    }

    #avatar-canvas {
        width: 240px;
        height: 240px;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .ai-avatar-window {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-accent) 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* ElevenLabs widget positioning adjustments */
elevenlabs-convai {
    z-index: 9998 !important;
}
