/* ============================================
   DAA Algorithm Visualizer - Styles
   Design System: Acid Neon + Tech Minimal
   ============================================ */

:root {
    /* Acid Neon Color Palette */
    --primary: #CCFF00;
    --primary-dark: #99CC00;
    --accent: #FF3CAC;
    --accent-secondary: #784BA0;
    --bg-dark: #0D0D0D;
    --bg-darker: #080808;
    --bg-card: #1A1A2E;
    --bg-sidebar: #111118;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0B0;
    --text-muted: #6B6B7B;
    --border: #2A2A3E;
    --border-light: #3A3A4E;
    --success: #00FF88;
    --warning: #FFB800;
    --error: #FF4444;
    
    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(204, 255, 0, 0.3);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: flex;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

#login-page {
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 50%, #1A1A2E 100%);
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1200px;
    width: 100%;
    min-height: 600px;
    background: var(--bg-card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-left {
    padding: var(--space-2xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, rgba(204, 255, 0, 0.05) 0%, transparent 100%);
    position: relative;
}

.login-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(204, 255, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 60, 172, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.logo {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-dark);
}

.logo svg {
    width: 32px;
    height: 32px;
}

.brand h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    line-height: 1.5;
}

.features {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.feature {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.feature-icon {
    color: var(--primary);
    font-size: 0.75rem;
}

/* Login Right Side */
.login-right {
    padding: var(--space-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

.login-form-container h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.input-group {
    position: relative;
}

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

.input-group input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    padding-right: 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-display);
    transition: all var(--transition-normal);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.1);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-icon {
    position: absolute;
    right: var(--space-md);
    bottom: var(--space-md);
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.input-icon:hover {
    color: var(--primary);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.checkbox input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox input:checked + .checkmark::after {
    content: '✓';
    color: var(--bg-dark);
    font-size: 12px;
    font-weight: bold;
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.forgot-link:hover {
    opacity: 0.8;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: var(--primary);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-login svg {
    width: 20px;
    height: 20px;
}

.demo-credentials {
    margin-top: var(--space-xl);
    padding: var(--space-md);
    background: rgba(204, 255, 0, 0.1);
    border: 1px solid rgba(204, 255, 0, 0.2);
    border-radius: 8px;
    text-align: center;
}

.demo-credentials p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.demo-credentials code {
    color: var(--primary);
    font-family: var(--font-mono);
    font-weight: 600;
}

/* ============================================
   DASHBOARD PAGE
   ============================================ */

#dashboard-page {
    flex-direction: row;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.logo-small {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-dark);
}

.logo-small svg {
    width: 24px;
    height: 24px;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md) 0;
}

.nav-section {
    margin-bottom: var(--space-md);
}

.nav-label {
    display: block;
    padding: var(--space-sm) var(--space-xl);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-xl);
    margin: 0 var(--space-sm);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(204, 255, 0, 0.1);
    color: var(--primary);
}

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

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--bg-dark);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    color: var(--error);
    background: rgba(255, 68, 68, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: var(--space-xl);
    min-height: 100vh;
    background: var(--bg-dark);
}

/* Dashboard Header */
.dashboard-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(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

#algo-title {
    font-size: 1.75rem;
    font-weight: 600;
}

.category-badge {
    padding: var(--space-xs) var(--space-md);
    background: rgba(204, 255, 0, 0.1);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-right {
    display: flex;
    gap: var(--space-md);
}

.btn-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-header:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-header.btn-primary {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
    font-weight: 600;
}

.btn-header.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-header svg {
    width: 18px;
    height: 18px;
}

/* Visualization Container */
.visualization-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: var(--space-xl);
    overflow: hidden;
}

.viz-controls {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
}

.control-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.control-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.btn-play, .btn-pause {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-play {
    background: var(--success);
    color: var(--bg-dark);
}

.btn-play:hover:not(:disabled) {
    background: #00CC6A;
}

.btn-pause {
    background: var(--warning);
    color: var(--bg-dark);
}

.btn-pause:hover:not(:disabled) {
    background: #CC9400;
}

.btn-play:disabled, .btn-pause:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Visualization Canvas */
.viz-canvas {
    height: 400px;
    padding: var(--space-xl);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.bar {
    flex: 1;
    max-width: 40px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.bar.comparing {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-secondary) 100%);
    transform: scaleY(1.05);
}

.bar.swapping {
    background: linear-gradient(180deg, var(--success) 0%, #00CC6A 100%);
}

.bar.sorted {
    background: linear-gradient(180deg, var(--success) 0%, #00CC6A 100%);
    opacity: 0.8;
}

.bar-value {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.bar:hover .bar-value {
    opacity: 1;
}

/* Graph Visualization */
.graph-node {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-normal);
    z-index: 10;
}

.graph-node.visited {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-dark);
}

.graph-node.current {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 60, 172, 0.5);
}

.graph-edge {
    position: absolute;
    height: 2px;
    background: var(--border);
    transform-origin: left center;
    z-index: 1;
    transition: all var(--transition-normal);
}

.graph-edge.visited {
    background: var(--success);
    height: 3px;
}

.graph-edge.current {
    background: var(--accent);
    height: 3px;
}

/* Step Info */
.step-info {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-darker);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.step-text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Info Panels */
.info-panels {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.code-tabs {
    display: flex;
    gap: var(--space-xs);
}

.tab-btn {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.tab-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    font-weight: 600;
}

.panel-content {
    padding: var(--space-lg);
    max-height: 400px;
    overflow-y: auto;
}

.panel-content pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}

.panel-content code {
    color: var(--text-primary);
}

/* Syntax Highlighting */
.code-keyword { color: var(--accent); }
.code-function { color: var(--primary); }
.code-string { color: var(--success); }
.code-number { color: var(--warning); }
.code-comment { color: var(--text-muted); font-style: italic; }

/* Complexity Panel */
.complexity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.complexity-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--bg-darker);
    border-radius: 8px;
}

.complexity-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.complexity-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.algo-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Responsive */
@media (max-width: 1200px) {
    .info-panels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .login-container {
        grid-template-columns: 1fr;
    }
    
    .login-left {
        display: none;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

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

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

/* Array Grid for DP */
.dp-grid {
    display: grid;
    gap: 2px;
    margin: var(--space-md) 0;
}

.dp-cell {
    width: 50px;
    height: 50px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
}

.dp-cell.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.dp-cell.computed {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-dark);
}

/* Chess Board for N-Queens */
.chess-board {
    display: grid;
    gap: 0;
    border: 2px solid var(--border);
}

.chess-cell {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chess-cell.light {
    background: #D4C5A9;
}

.chess-cell.dark {
    background: #8B7355;
}

.chess-cell.queen {
    color: var(--accent);
    font-weight: bold;
}

.chess-cell.attacking {
    background: rgba(255, 68, 68, 0.3);
}

/* Tree Visualization */
.tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
}

.tree-level {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin: var(--space-md) 0;
}

.tree-node {
    width: 50px;
    height: 50px;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
}

.tree-node.visited {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-dark);
}

.tree-node.current {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    animation: pulse 1s ease-in-out infinite;
}

/* Huffman Tree */
.huffman-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: var(--space-xs);
}

.huffman-char {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.huffman-freq {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}