/* Tailwind CSS CDN */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* Google Fonts - Orbitron for tech feel */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* CSS Variables - Design System */
:root {
    /* Primary Colors - Neon Gradient */
    --primary-1: #00D4FF;
    --primary-2: #6366F1;
    --primary-3: #8B5CF6;
    --gradient-primary: linear-gradient(135deg, var(--primary-1), var(--primary-2), var(--primary-3));

    /* Background Colors - Dark Theme */
    --bg-dark: #0F172A;
    --bg-card: #1E293B;
    --bg-card-hover: #334155;
    --bg-darker: #020617;

    /* Text Colors */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    /* Functional Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    /* Special Effects */
    --glow-primary: 0 0 20px rgba(0, 212, 255, 0.3);
    --glow-success: 0 0 20px rgba(16, 185, 129, 0.3);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

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

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition-normal: 300ms ease-out;
    --transition-slow: 500ms ease-out;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Effects */
.bg-grid-pattern {
    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: 50px 50px;
}

.bg-gradient-radial {
    background: radial-gradient(ellipse at top, var(--bg-card) 0%, var(--bg-dark) 70%);
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.glass-card:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--glow-primary);
    transform: translateY(-4px);
}

/* Gradient Text */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Gradient Border Button */
.gradient-border-btn {
    position: relative;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.gradient-border-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.gradient-border-btn:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--glow-primary);
}

/* Primary Gradient Button */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--glow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

/* Navigation Styles */
.nav-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-darker);
    border-right: 1px solid var(--glass-border);
    padding: var(--space-xl);
    z-index: 100;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-sm);
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
}

.nav-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    padding: var(--space-2xl);
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-2xl);
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.page-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Task Card Grid */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.task-card {
    padding: var(--space-xl);
    cursor: pointer;
}

.task-card-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: var(--space-lg);
}

.task-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.task-card-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

.task-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    padding: 0.25rem 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--primary-1);
}

/* Demo Section Styles */
.demo-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.demo-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.demo-controls {
    display: flex;
    gap: var(--space-md);
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xl);
    padding: var(--space-xl);
    background: var(--bg-darker);
    border-radius: var(--radius-md);
}

.control-group {
    flex: 1;
    min-width: 200px;
}

.control-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.control-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-1);
}

/* Slider Styles */
.slider-container {
    margin-top: var(--space-md);
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--glow-primary);
    transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--glow-primary);
}

/* Chart Container */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

/* Animation Classes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: var(--glow-primary); }
    50% { box-shadow: 0 0 40px rgba(0, 212, 255, 0.6); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Stagger Animation */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }

/* Algorithm Tab */
.algorithm-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    border-color: var(--primary-1);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-lg);
}

.stat-card {
    padding: var(--space-lg);
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* Heatmap Styles */
.heatmap-container {
    display: grid;
    gap: 2px;
    padding: var(--space-lg);
    background: var(--bg-darker);
    border-radius: var(--radius-md);
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-container canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Grid World Cell */
.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: 1px solid var(--glass-border);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.grid-cell.goal { background: rgba(16, 185, 129, 0.3); color: var(--success); }
.grid-cell.hole { background: rgba(239, 68, 68, 0.3); color: var(--error); }
.grid-cell.start { background: rgba(59, 130, 246, 0.3); color: var(--info); }
.grid-cell.agent {
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    box-shadow: var(--glow-primary);
}
.grid-cell.frozen { background: rgba(147, 197, 253, 0.2); }

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.comparison-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.comparison-table td {
    font-weight: 500;
}

.comparison-table tr:hover td {
    background: rgba(99, 102, 241, 0.1);
}

/* Footer */
.footer {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-sidebar {
        width: 80px;
        padding: var(--space-lg);
    }

    .nav-item span {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: var(--space-md);
    }

    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .nav-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        padding: var(--space-sm);
    }

    .nav-item {
        flex: 1;
        flex-direction: column;
        gap: var(--space-xs);
        padding: var(--space-sm);
        font-size: 0.75rem;
    }

    .nav-item span {
        display: block;
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 80px;
        padding: var(--space-lg);
    }

    .task-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .control-panel {
        flex-direction: column;
    }
}

/* Utility Classes */
.text-gradient { background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.text-primary { color: var(--primary-1); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-muted); }

.bg-gradient { background: var(--gradient-primary); }
.bg-dark { background: var(--bg-dark); }
.bg-card { background: var(--bg-card); }
.bg-darker { background: var(--bg-darker); }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-md { border-radius: var(--radius-md); }

.shadow-lg { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.shadow-glow { box-shadow: var(--glow-primary); }

.transition { transition: all var(--transition-normal); }
.cursor-pointer { cursor: pointer; }

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary-1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--bg-darker);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-error { background: rgba(239, 68, 68, 0.2); color: var(--error); }
.badge-info { background: rgba(59, 130, 246, 0.2); color: var(--info); }
