/* Flux3D - Advanced 3D Model Viewer */
/* Main Styles - Enhanced Professional Design */

:root {
    /* Dimensions */
    --header-height: 60px;
    --sidebar-width: 300px;
    --sidebar-collapsed: 52px;

    /* Animations */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Accent Colors (shared between themes) */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    --accent-gradient-hover: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c4b5fd 100%);
    --accent-glow: 0 0 20px rgba(99, 102, 241, 0.4), 0 0 40px rgba(139, 92, 246, 0.2);
    --accent-glow-intense: 0 0 30px rgba(99, 102, 241, 0.6), 0 0 60px rgba(139, 92, 246, 0.3);

    /* Status Colors (shared between themes) */
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --error: #ef4444;
    --error-light: #f87171;
    --info: #3b82f6;
    --info-light: #60a5fa;

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}

/* Dark Theme (Default) */
body, body.theme-dark {
    /* Colors - Rich dark palette */
    --bg-primary: #07070a;
    --bg-secondary: #0d0d12;
    --bg-tertiary: #141419;
    --bg-elevated: #1a1a21;
    --bg-hover: #1f1f28;
    --bg-active: #252530;

    --text-primary: #f5f5f7;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --text-inverse: #07070a;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(99, 102, 241, 0.5);

    /* Shadows - Deeper, more dramatic */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05);

    /* Viewport background for dark theme */
    --viewport-bg: linear-gradient(180deg, #0d0d14 0%, #12121c 50%, #0a0a10 100%);
    --viewport-grid-color: rgba(99, 102, 241, 0.1);
}

/* Light Theme */
body.theme-light {
    /* Colors - Clean, professional light palette */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f4f4f5;
    --bg-elevated: #ffffff;
    --bg-hover: #f0f0f2;
    --bg-active: #e4e4e7;

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --text-inverse: #fafafa;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.05);
    --border-focus: rgba(99, 102, 241, 0.5);

    /* Shadows - Subtle, professional */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.1);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.8);

    /* Glass Effect - Light version */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.06);

    /* Viewport background for light theme */
    --viewport-bg: linear-gradient(180deg, #e8e8ec 0%, #f0f0f4 50%, #e4e4e8 100%);
    --viewport-grid-color: rgba(99, 102, 241, 0.15);
}

/* ========================================
   Accessibility Styles
   ======================================== */

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    z-index: 100001;
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 0;
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Focus Visible Styles */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Specific focus styles for buttons */
button:focus-visible,
.header-btn:focus-visible,
.preset-btn:focus-visible,
.mode-btn:focus-visible,
.icon-btn:focus-visible,
.full-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Focus styles for inputs */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 0;
    border-color: var(--accent-primary);
}

/* Focus styles for checkboxes */
input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .loader-logo {
        animation: none;
    }

    .loader-spinner {
        animation: none;
        border: 3px solid var(--accent-primary);
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root,
    body,
    body.theme-dark {
        --border-color: #808080;
        --border-light: #a0a0a0;
    }

    body.theme-light {
        --border-color: #404040;
        --border-light: #606060;
    }

    button,
    input,
    select {
        border-width: 2px;
    }
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Loading Screen - Enhanced */
#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#loading-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 20% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

#loading-screen.hidden {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.loader-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.loader-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 32px;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(99, 102, 241, 0.3));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid transparent;
    border-radius: 50%;
    margin: 0 auto 20px;
    position: relative;
    animation: spinnerRotate 2s linear infinite;
}

.loader-spinner::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-secondary);
    animation: spinnerGlow 2s linear infinite;
}

.loader-spinner::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-bottom-color: var(--accent-tertiary);
    animation: spinnerRotate 1.5s linear infinite reverse;
}

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

@keyframes spinnerGlow {
    0%, 100% { filter: drop-shadow(0 0 8px var(--accent-primary)); }
    50% { filter: drop-shadow(0 0 16px var(--accent-secondary)); }
}

.loader-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.loader-progress {
    width: 200px;
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 16px auto 0;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    width: 0%;
    animation: progressIndeterminate 2s ease-in-out infinite;
}

@keyframes progressIndeterminate {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#app.ready {
    opacity: 1;
}

/* Header - Enhanced with glass morphism */
.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    flex-shrink: 0;
    position: relative;
    backdrop-filter: blur(var(--glass-blur));
}

.app-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    pointer-events: none;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-primary) 50%, transparent 100%);
    opacity: 0.3;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.3));
    transition: all var(--transition-normal);
}

.header-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.5));
}

.header-title {
    font-size: 22px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    padding-left: 14px;
    margin-left: 2px;
    border-left: 2px solid var(--accent-primary);
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 32px;
    position: relative;
    z-index: 1;
}

.upload-zone-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.upload-zone-mini::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.upload-zone-mini:hover {
    border-color: var(--accent-primary);
    border-style: solid;
    background: transparent;
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--accent-glow);
}

.upload-zone-mini:hover::before {
    opacity: 0.1;
}

.upload-zone-mini .upload-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 1;
}

.upload-zone-mini:hover .upload-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

.upload-zone-mini span {
    position: relative;
    z-index: 1;
}

.header-right {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.header-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.header-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.header-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 1;
}

.header-btn:hover {
    background: transparent;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.2);
}

.header-btn:hover::before {
    opacity: 0.15;
}

.header-btn:hover svg {
    fill: var(--accent-primary);
    transform: scale(1.1);
}

.header-btn:active {
    transform: translateY(0);
}

.header-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.header-btn:disabled:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    transform: none;
    box-shadow: none;
}

.header-btn:disabled svg {
    fill: var(--text-muted);
    transform: none;
}

/* Main Content Area */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Viewport - Enhanced with gradient background */
.viewport-container {
    flex: 1;
    position: relative;
    background: var(--viewport-bg);
    overflow: hidden;
}

.viewport-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 100% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

#viewport {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 0;
}

#viewport canvas {
    display: block;
    outline: none;
}

/* Viewport Overlays */
.viewport-overlay {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

.viewport-overlay > * {
    pointer-events: auto;
}

.viewport-overlay.top-left {
    top: 20px;
    left: 20px;
}

.viewport-overlay.top-right {
    top: 20px;
    right: 20px;
}

.viewport-overlay.bottom-left {
    bottom: 20px;
    left: 20px;
}

.viewport-overlay.bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.viewport-overlay.bottom-right {
    bottom: 20px;
    right: 20px;
}

/* Stats Panel - Enhanced glass effect */
.stats-panel {
    background: rgba(10, 10, 18, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Fira Code', monospace;
    min-width: 160px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-row:first-child {
    padding-top: 0;
}

.stat-row span:first-child {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-row span:last-child {
    color: var(--accent-primary);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Axis Gizmo */
.axis-gizmo {
    width: 100px;
    height: 100px;
    background: transparent;
    border-radius: 50%;
    overflow: visible;
}

.axis-gizmo canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Transform Info */
.transform-info {
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 11px;
    font-family: 'SF Mono', 'Monaco', monospace;
}

.info-row {
    display: flex;
    gap: 8px;
    padding: 3px 0;
}

.info-row span:first-child {
    color: var(--text-muted);
    width: 60px;
}

.info-row span:last-child {
    color: var(--text-secondary);
}

/* Quick Actions - Enhanced with hover effects */
.quick-actions {
    display: flex;
    gap: 10px;
}

.quick-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 18, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.quick-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.quick-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 1;
}

.quick-btn:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--accent-glow);
}

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

.quick-btn:hover svg {
    fill: white;
    transform: scale(1.1);
}

.quick-btn:active {
    transform: translateY(0);
}

.quick-btn.active {
    border-color: var(--accent-primary);
    box-shadow: var(--accent-glow);
}

.quick-btn.active::before {
    opacity: 1;
}

.quick-btn.active svg {
    fill: white;
}

/* Animation Controls - Enhanced glass morphism */
.animation-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(10, 10, 18, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.anim-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.anim-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.anim-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
    position: relative;
    z-index: 1;
    transition: all var(--transition-normal);
}

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

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

.anim-btn:hover svg {
    fill: white;
}

.anim-btn.active::before {
    opacity: 1;
}

.anim-btn.active svg {
    fill: white;
}

.anim-slider {
    width: 220px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.anim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.5);
    transition: all var(--transition-fast);
}

.anim-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.7);
}

.anim-time {
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Fira Code', monospace;
    min-width: 90px;
    text-align: center;
}

.anim-speed {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.anim-speed:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Modal - Enhanced glass morphism */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.modal-close:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    max-height: calc(85vh - 88px);
}

/* Shortcuts Grid */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.shortcut-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

.shortcut span {
    color: var(--text-muted);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: white;
}

/* Additional utility classes */
.glassmorphism {
    background: rgba(10, 10, 18, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.glow-effect {
    box-shadow: var(--accent-glow);
}

.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--accent-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
