/* ═══════════════════════════════════════════════════════════
   AXIOMICA ADA — PROFESSIONAL DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════ */

:root {
    /* Colors */
    --primary-50: #f0f4f8;
    --primary-100: #d9e2ec;
    --primary-200: #bcccdc;
    --primary-300: #9fb3c8;
    --primary-400: #829ab1;
    --primary-500: #627d98;
    --primary-600: #486581;
    --primary-700: #334e68;
    --primary-800: #243b53;
    --primary-900: #102a43;
    
    --accent-50: #f0f9ff;
    --accent-100: #e0f2fe;
    --accent-200: #bae6fd;
    --accent-300: #7dd3fc;
    --accent-400: #38bdf8;
    --accent-500: #0ea5e9;
    --accent-600: #0284c7;
    --accent-700: #0369a1;
    
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--gray-900);
    color: white;
    padding: var(--space-6);
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--gray-700);
    margin-bottom: var(--space-6);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.sidebar-brand-text span {
    font-size: 12px;
    color: var(--gray-400);
}

.sidebar-nav { display: flex; flex-direction: column; gap: var(--space-1); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--gray-800);
    color: white;
}

.sidebar-link.active {
    background: var(--accent-600);
    color: white;
}

.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }

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

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

.page-header p {
    color: var(--gray-500);
    margin-top: var(--space-1);
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

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

.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--accent-50); color: var(--accent-600); }
.stat-icon.green { background: var(--success-50); color: var(--success-600); }
.stat-icon.yellow { background: var(--warning-50); color: var(--warning-600); }
.stat-icon.red { background: var(--danger-50); color: var(--danger-600); }

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: var(--space-2);
}

.stat-change.positive { color: var(--success-600); }
.stat-change.negative { color: var(--danger-600); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-600);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-700);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-danger {
    background: var(--danger-600);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-600);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: 16px;
}

/* Grid */
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Table */
.table-container {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th {
    background: var(--gray-50);
    padding: var(--space-4) var(--space-6);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: var(--space-4) var(--space-6);
    font-size: 14px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

tr:hover td { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.badge-blue { background: var(--accent-50); color: var(--accent-700); }
.badge-green { background: var(--success-50); color: var(--success-700); }
.badge-yellow { background: var(--warning-50); color: var(--warning-700); }
.badge-red { background: var(--danger-50); color: var(--danger-700); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body { padding: var(--space-6); }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

/* Forms */
.form-group { margin-bottom: var(--space-5); }

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-input:not([type="range"]) {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-900);
    background: white;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-input::placeholder { color: var(--gray-400); }

textarea.form-input:not([type="range"]) { min-height: 100px; resize: vertical; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary-800) 100%);
    padding: var(--space-8);
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
}

.login-brand {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto var(--space-4);
}

.login-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.login-brand p {
    color: var(--gray-500);
    margin-top: var(--space-1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    font-size: 32px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: var(--space-6);
}

/* Responsive */
@media (max-width: 1024px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .main-content { padding: var(--space-4); }
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}



/* Range slider - undo global input styles */
input[type="range"] {
    padding: 0;
    border: 0;
    background: transparent;
    width: 100%;
}

/* Tabs */
.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover {
    color: var(--gray-700);
}
.tab.active {
    color: var(--accent-600);
    border-bottom-color: var(--accent-600);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar { width: 0; padding: 0; overflow: hidden; position: fixed; height: 100%; z-index: 100; transition: width 0.3s; }
    .sidebar.open { width: 280px; }
    .main-content { margin-left: 0 !important; padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start !important; gap: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr !important; }
    .grid.grid-2 { grid-template-columns: 1fr !important; }
    .grid.grid-3 { grid-template-columns: 1fr !important; }
    .modal { max-width: 95vw !important; margin: 16px; }
    h1 { font-size: 20px !important; }
    .card-header { flex-direction: column; gap: 8px; align-items: flex-start !important; }
    .btn-sm { font-size: 12px; padding: 4px 8px; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Login page styles */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-600) 0%, var(--accent-800) 100%);
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-brand {
    text-align: center;
    margin-bottom: 32px;
}
.login-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 16px 0 8px;
}
.login-brand p {
    font-size: 14px;
    color: var(--gray-500);
}
