/**
 * neubot Global UI Kit
 * A unified design system for visual consistency across all pages
 * Version: 1.0.0
 */

/* ============================================================================
   DESIGN TOKENS
   ============================================================================ */

:root {
    /* ===== Color Palette ===== */
    
    /* Primary Colors */
    --color-primary: #3498db;
    --color-primary-hover: #2980b9;
    --color-primary-light: rgba(52, 152, 219, 0.1);
    --color-primary-shadow: rgba(52, 152, 219, 0.3);
    
    /* Accent Colors */
    --color-accent-purple: #a78bfa;
    --color-accent-cyan: #06b6d4;
    --color-accent-blue: #6ea8fe;
    --color-accent-violet: #9b72ff;
    --color-accent-pink: #ff75b5;
    
    /* Semantic Colors */
    --color-success: #2ecc71;
    --color-success-dark: #27ae60;
    --color-warning: #f39c12;
    --color-error: #e74c3c;
    --color-error-dark: #c0392b;
    --color-info: #3498db;
    
    /* Neutral Colors - Dark Theme */
    --color-background-primary: #1a1a1a;
    --color-background-secondary: #2a2a2a;
    --color-background-tertiary: #333;
    --color-background-elevated: #383838;
    
    --color-surface-low: rgba(255, 255, 255, 0.04);
    --color-surface-mid: rgba(255, 255, 255, 0.06);
    --color-surface-high: rgba(255, 255, 255, 0.08);
    --color-surface-highest: rgba(255, 255, 255, 0.12);
    
    --color-text-primary: #ffffff;
    --color-text-secondary: #bbb;
    --color-text-tertiary: #888;
    --color-text-muted: #777;
    --color-text-disabled: #555;
    
    --color-border-subtle: rgba(255, 255, 255, 0.08);
    --color-border-medium: rgba(255, 255, 255, 0.12);
    --color-border-strong: rgba(255, 255, 255, 0.2);
    
    /* Show Mode Specific */
    --color-show-foreground: #f6f7fb;
    --color-show-muted: #aab1c2;
    --color-show-glass: rgba(255, 255, 255, 0.06);
    --color-show-glass-strong: rgba(255, 255, 255, 0.12);
    --color-show-glass-ring: rgba(110, 168, 254, 0.45);
    
    /* ===== Typography ===== */
    
    /* Font Families */
    --font-primary: 'Segoe UI', system-ui, -apple-system, Roboto, Tahoma, Geneva, Verdana, sans-serif;
    --font-display: 'Bernoru UltraExpanded', 'Segoe UI', sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    
    /* Font Sizes */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 28px;
    --text-4xl: 36px;
    --text-5xl: 48px;
    
    /* Font Weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --weight-black: 900;
    
    /* Line Heights */
    --leading-tight: 1.2;
    --leading-snug: 1.3;
    --leading-normal: 1.4;
    --leading-relaxed: 1.5;
    --leading-loose: 1.6;
    
    /* Letter Spacing */
    --tracking-tight: -0.5px;
    --tracking-normal: 0;
    --tracking-wide: 0.5px;
    --tracking-wider: 1px;
    
    /* ===== Spacing System ===== */
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 24px;
    --space-3xl: 32px;
    --space-4xl: 48px;
    --space-5xl: 64px;
    
    /* ===== Border Radius ===== */
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-2xl: 14px;
    --radius-3xl: 20px;
    --radius-full: 9999px;
    
    /* ===== Shadows ===== */
    
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 6px 18px rgba(0, 0, 0, 0.28);
    --shadow-2xl: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-3xl: 0 20px 50px rgba(0, 0, 0, 0.45);
    
    /* Colored Shadows */
    --shadow-primary: 0 4px 12px rgba(52, 152, 219, 0.25);
    --shadow-success: 0 4px 12px rgba(46, 204, 113, 0.25);
    --shadow-error: 0 4px 12px rgba(231, 76, 60, 0.25);
    
    /* Inner Shadows */
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-inner-strong: inset 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* ===== Transitions & Animations ===== */
    
    /* Durations */
    --duration-fast: 120ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 400ms;
    
    /* Easing Functions */
    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);
    
    /* ===== Z-Index Scale ===== */
    
    --z-base: 0;
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-fixed: 30;
    --z-modal-backdrop: 40;
    --z-modal: 50;
    --z-popover: 60;
    --z-tooltip: 70;
    
    /* ===== Layout ===== */
    
    --container-max-width: 900px;
    --container-padding: 20px;
    
    /* ===== Breakpoints (for reference in media queries) ===== */
    
    /* Mobile: < 640px */
    /* Tablet: 640px - 1024px */
    /* Desktop: > 1024px */
}

/* ============================================================================
   COMPONENT PATTERNS
   ============================================================================ */

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
    user-select: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

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

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

.btn--primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary);
}

.btn--primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn--secondary {
    background: var(--color-surface-mid);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-medium);
}

.btn--secondary:hover:not(:disabled) {
    background: var(--color-surface-high);
}

.btn--outline {
    background: transparent;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-medium);
}

.btn--outline:hover:not(:disabled) {
    background: var(--color-surface-low);
    border-color: var(--color-border-strong);
}

.btn--danger {
    background: rgba(231, 76, 60, 0.18);
    color: var(--color-text-primary);
    border: 1px solid rgba(231, 76, 60, 0.6);
}

.btn--danger:hover:not(:disabled) {
    background: rgba(231, 76, 60, 0.25);
    box-shadow: var(--shadow-error);
}

.btn--success {
    background: var(--color-success);
    color: var(--color-text-primary);
}

.btn--success:hover:not(:disabled) {
    background: var(--color-success-dark);
    box-shadow: var(--shadow-success);
}

.btn--sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
}

.btn--lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--text-lg);
}

.btn--icon {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: var(--radius-xl);
    background: var(--color-surface-mid);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-medium);
}

.btn--icon:hover:not(:disabled) {
    background: var(--color-surface-high);
    transform: translateY(-1px);
}

.btn--icon:active:not(:disabled) {
    transform: translateY(0);
}

/* ===== Inputs ===== */

.input {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    color: var(--color-text-primary);
    background: var(--color-background-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-3xl);
    outline: none;
    transition: all var(--duration-normal) var(--ease-out);
}

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

.input:focus {
    background: var(--color-background-tertiary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-shadow);
}

.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input--error {
    border-color: var(--color-error);
}

.input--error:focus {
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

textarea.input {
    resize: vertical;
    min-height: 100px;
    border-radius: var(--radius-xl);
}

/* ===== Cards ===== */

.card {
    background: var(--color-surface-mid);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    transition: all var(--duration-normal) var(--ease-out);
}

.card--elevated {
    box-shadow: var(--shadow-md);
}

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

.card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
}

.card--glass {
    background: var(--color-show-glass);
    backdrop-filter: blur(10px) saturate(120%);
    border: 1px solid var(--color-show-glass-strong);
}

/* ===== Avatars ===== */

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--color-surface-mid);
    overflow: hidden;
}

.avatar--sm {
    width: 32px;
    height: 32px;
}

.avatar--md {
    width: 40px;
    height: 40px;
}

.avatar--lg {
    width: 48px;
    height: 48px;
}

.avatar--xl {
    width: 64px;
    height: 64px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Badges & Tags ===== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    border-radius: var(--radius-full);
    background: var(--color-surface-high);
    color: var(--color-text-secondary);
}

.badge--primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.badge--success {
    background: rgba(46, 204, 113, 0.1);
    color: var(--color-success);
}

.badge--warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--color-warning);
}

.badge--error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--color-error);
}

/* ===== Modals ===== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-slow) var(--ease-out),
                visibility var(--duration-slow) var(--ease-out);
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    z-index: var(--z-modal);
    pointer-events: none;
}

.modal-content {
    max-width: 600px;
    width: 100%;
    background: var(--color-background-secondary);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-3xl);
    pointer-events: auto;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all var(--duration-slow) var(--ease-out);
}

.modal-backdrop.open + .modal-container .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2xl);
    border-bottom: 1px solid var(--color-border-subtle);
}

.modal-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    margin: 0;
}

.modal-body {
    padding: var(--space-2xl);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-2xl);
    border-top: 1px solid var(--color-border-subtle);
}

/* ===== Toggle Switch ===== */

.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--color-surface-high);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.toggle__slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--color-text-primary);
    border-radius: var(--radius-full);
    transition: all var(--duration-normal) var(--ease-out);
}

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

.toggle input:checked + .toggle__slider::before {
    transform: translateX(24px);
}

.toggle input:focus-visible + .toggle__slider {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===== Dividers ===== */

.divider {
    height: 1px;
    background: var(--color-border-subtle);
    margin: var(--space-2xl) 0;
}

.divider--strong {
    background: var(--color-border-medium);
}

.divider--vertical {
    width: 1px;
    height: auto;
    margin: 0 var(--space-2xl);
}

/* ===== Loading States ===== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-surface-low) 0%,
        var(--color-surface-mid) 50%,
        var(--color-surface-low) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-surface-high);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spinner-rotate 0.8s linear infinite;
}

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

/* ===== Utility Classes ===== */

/* Animations */
.fade-in {
    animation: fade-in var(--duration-slow) var(--ease-out);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slide-up var(--duration-slow) var(--ease-out);
}

@keyframes slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Text Utilities */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-muted { color: var(--color-text-muted); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.weight-normal { font-weight: var(--weight-normal); }
.weight-medium { font-weight: var(--weight-medium); }
.weight-semibold { font-weight: var(--weight-semibold); }
.weight-bold { font-weight: var(--weight-bold); }

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

/* Display Utilities */
.hidden { display: none; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex Utilities */
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Accessibility */
.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;
}

/* Focus Styles */
.focus-ring:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

/* ============================================================================
   RESPONSIVE UTILITIES
   ============================================================================ */

@media (max-width: 639px) {
    :root {
        --container-padding: 16px;
    }
}

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