/**
 * KaKaPP - Modern CSS with Card-Based System
 * Kertas Kerja Perencanaan Pajak Pemerintah Kota Palembang
 */

/* ========================================
   CSS VARIABLES - Design System Tokens
   ======================================== */
:root {
    /* Colors - Light Theme (Default) */
    --color-primary: #0d9488;
    --color-primary-dark: #0f766e;
    --color-primary-light: #14b8a6;
    --color-primary-rgb: 13, 148, 136;
    
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-surface-hover: #f8fafc;
    --color-surface-elevated: #ffffff;
    
    --color-text-primary: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* 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 ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Layout */
    --header-height: 64px;
    --container-max: 1400px;
    --sidebar-width: 260px;
}

/* Dark Theme */
[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-hover: #334155;
    --color-surface-elevated: #1e293b;
    
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    
    --color-border: #334155;
    --color-border-light: #1e293b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    min-height: 100vh;
}

/* ========================================
   LAYOUT - App Wrapper
   ======================================== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* ========================================
   HEADER
   ======================================== */
.app-header {
    height: var(--header-height);
    background: linear-gradient(90deg, #2F4FB5 0%, #3C66C6 50%, #4A86E8 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.app-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

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

.brand-logo {
    font-size: var(--text-3xl);
    line-height: 1;
}

.brand-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: var(--text-xs);
    opacity: 0.9;
    font-weight: var(--font-medium);
}

/* Navigation */
.app-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    position: relative;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.theme-icon-light,
.theme-icon-dark {
    position: absolute;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.theme-icon-light {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-icon-dark {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: rotate(0deg);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-info {
    text-align: right;
    line-height: 1.3;
}

.user-info strong {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
}

.user-info small {
    font-size: var(--text-xs);
    opacity: 0.8;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition-fast);
}

/* ========================================
   FOOTER
   ======================================== */
.app-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-lg) 0;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.app-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-medium);
}

.app-footer a:hover {
    text-decoration: underline;
}

.app-footer .small {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* ========================================
   CARD SYSTEM
   ======================================== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-md);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-xs);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface-hover);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Card Variants */
.card-flat {
    box-shadow: none;
    border: 1px solid var(--color-border);
}

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

.card-accent {
    border-left: 4px solid var(--color-primary);
}

/* ========================================
   GRID SYSTEM
   ======================================== */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
}

.form-label .required {
    color: var(--color-danger);
    margin-left: var(--space-xs);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.form-control {
    width: 100%;
    padding: var(--space-md);
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

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

.form-control:disabled {
    background: var(--color-surface-hover);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.form-control.error {
    border-color: var(--color-danger);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Form Row (Horizontal) */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    align-items: end;
}

/* Form Row with specific column sizes */
.form-row .col-2 {
    grid-column: span 1;
}

.form-row .col-4 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .form-row .col-2,
    .form-row .col-4 {
        grid-column: span 1;
    }
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.form-check-label {
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    cursor: pointer;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    font-family: inherit;
    line-height: 1.5;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

/* Button Variants */
.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

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

.btn-secondary {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

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

.btn-success {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

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

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-xs);
}

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

/* Button Group Action (for Print/Export buttons) */
.btn-group-action {
    display: flex;
    gap: var(--space-sm);
    align-items: stretch;
}

.btn-group-action .btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 44px;
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .btn-group-action {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-action .btn-action {
        width: 100%;
    }
}

/* ========================================
   TABLES
   ======================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: var(--color-surface);
}

.table thead th {
    background: var(--color-surface-hover);
    color: var(--color-text-secondary);
    font-weight: var(--font-semibold);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.table tbody td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text-primary);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--color-surface-hover);
}

.table tbody tr:hover td {
    color: var(--color-text-primary);
}

/* Table Variants */
.table-striped tbody tr:nth-child(even) {
    background: var(--color-surface-hover);
}

.table-compact thead th,
.table-compact tbody td {
    padding: var(--space-sm) var(--space-md);
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #065f46;
}

[data-theme="dark"] .alert-success {
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

[data-theme="dark"] .alert-danger {
    color: #f87171;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
}

[data-theme="dark"] .alert-warning {
    color: #fbbf24;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

[data-theme="dark"] .alert-info {
    color: #60a5fa;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

/* ========================================
   AI ANALYSIS COMPONENT
   ======================================== */
.ai-box,
.ai-section {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.1) 0%, rgba(var(--color-primary-rgb), 0.05) 100%);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-top: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.ai-box::before,
.ai-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
}

.ai-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.ai-icon {
    font-size: var(--text-2xl);
}

.ai-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.ai-content {
    font-size: var(--text-base);
    line-height: 1.8;
    color: var(--color-text-primary);
}

.ai-content p {
    margin-bottom: var(--space-md);
}

.ai-content ul,
.ai-content ol {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.ai-content li {
    margin-bottom: var(--space-sm);
}

.ai-content strong {
    color: var(--color-primary);
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--color-text-secondary);
    font-style: italic;
}

.ai-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.ai-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.ai-error::before {
    background: var(--color-danger);
}

/* Additional AI Section Styles */
.ai-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.ai-placeholder {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--space-xl);
}

.ai-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.btn-ai {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: white;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-ai:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.ai-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.ai-result {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.ai-result h4 {
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

.ai-result ul {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.ai-result li {
    margin-bottom: var(--space-sm);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    gap: var(--space-md);
    flex-wrap: wrap;
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

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

.page-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-actions {
        width: 100%;
    }
    
    .page-actions .btn {
        flex: 1;
    }
}

/* ========================================
   STATS CARDS (Dashboard)
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.stat-icon.icon-blue {
    background: rgba(59, 130, 246, 0.15);
}

.stat-icon.icon-green {
    background: rgba(16, 185, 129, 0.15);
}

.stat-icon.icon-orange {
    background: rgba(245, 158, 11, 0.15);
}

.stat-icon.icon-purple {
    background: rgba(139, 92, 246, 0.15);
}

.stat-content h3 {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.stat-number {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.stat-content small {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart Card */
.chart-card {
    margin-bottom: var(--space-xl);
}

.chart-card .card-body {
    height: 320px;
}

/* ========================================
   PAGE SPECIFIC - SKENARIO GRID
   ======================================== */
.skenario-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.skenario-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.skenario-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: all var(--transition-base);
}

.skenario-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.skenario-card.konservatif {
    border-color: var(--color-danger);
}

.skenario-card.konservatif .skenario-label {
    color: var(--color-danger);
}

.skenario-card.moderat {
    border-color: var(--color-warning);
}

.skenario-card.moderat .skenario-label {
    color: var(--color-warning);
}

.skenario-card.optimis {
    border-color: var(--color-success);
}

.skenario-card.optimis .skenario-label {
    color: var(--color-success);
}

.skenario-label {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.skenario-value {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --header-height: 60px;
    }
    
    .app-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: #2F4FB5;
        flex-direction: column;
        padding: var(--space-md);
        gap: var(--space-xs);
    }
    
    .app-nav.active {
        display: flex;
    }
    
    .nav-link {
        padding: var(--space-md);
        border-radius: var(--radius-md);
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .header-actions {
        gap: var(--space-sm);
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: var(--text-base);
    }
    
    .user-info {
        display: none;
    }
    
    .skenario-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
    }
    
    html {
        font-size: 14px;
    }
    
    .skenario-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .table-container {
        border-radius: var(--radius-md);
    }
    
    .table thead th,
    .table tbody td {
        padding: var(--space-sm);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .app-header,
    .app-footer,
    .menu-toggle,
    .theme-toggle,
    .btn {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--color-text-muted); }

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

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.hidden { display: none; }
.sr-only { position: absolute; left: -9999px; }

/* ========================================
   APPENDIX: ADDITIONAL COMPONENTS
   ======================================== */

/* === TAMBAHAN: Skenario & AI === */
.skenario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.skenario-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.skenario-card {
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface-hover);
  text-align: center;
}

.skenario-card.s-konservatif { border-top: 3px solid var(--color-info); }
.skenario-card.s-moderat     { border-top: 3px solid var(--color-success); }
.skenario-card.s-optimis     { border-top: 3px solid var(--color-warning); }

.skenario-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.skenario-nilai {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.skenario-desc { font-size: var(--text-xs); color: var(--color-text-muted); }
.skenario-gap  { font-size: var(--text-xs); margin-top: var(--space-xs); }

/* AI Result Box */
.ai-result-box {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-md);
}

.ai-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-hover);
  border-bottom: 1px solid var(--color-border);
}

.ai-result-body {
  padding: var(--space-md);
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--color-text-primary);
}

.ai-result-body p    { margin-bottom: var(--space-sm); }
.ai-result-body strong { font-weight: var(--font-semibold); }

.ai-result-footer {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-hover);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-primary);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.ai-placeholder-box {
  padding: var(--space-xl);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.ai-loading-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin-rotate 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

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

/* Collapsible */
.collapsible-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.collapsible-body.collapsed { max-height: 0 !important; opacity: 0; }

.btn-collapse {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  transition: background var(--transition-fast);
}

.btn-collapse:hover { background: var(--color-surface-hover); }

/* Input with checkbox inline */
.input-inline-check {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.input-inline-check input[type="number"] { flex: 1; }

.input-inline-check label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

/* Value color helpers */
.val-up   { color: var(--color-success); font-weight: var(--font-semibold); }
.val-down { color: var(--color-danger);  font-weight: var(--font-semibold); }
.val-zero { color: var(--color-text-muted); }

/* Row styles for tables */
tr.row-partial td { opacity: 0.6; font-style: italic; }
tr.row-rekomendasi { background: rgba(13,148,136,0.07); }
tr.row-rekomendasi td { font-weight: var(--font-semibold); }

/* Badge outline variant */
.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* Additional responsive */
@media (max-width: 768px) {
  .skenario-grid    { grid-template-columns: 1fr; }
  .skenario-results { grid-template-columns: 1fr; }
}

/* Gap Analysis */
.gap-analysis {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.gap-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.gap-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.gap-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.gap-value.positive { color: var(--color-success); }
.gap-value.negative { color: var(--color-danger); }

/* ========================================
   METODE PAGE - MODERN DESIGN
   ======================================== */

/* Hero Section */
.hero {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    margin-bottom: var(--space-xl);
    background: linear-gradient(135deg, rgba(47, 79, 181, 0.08) 0%, rgba(74, 134, 232, 0.05) 100%);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(47, 79, 181, 0.15);
}

.hero-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-sm);
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.highlight-box {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: linear-gradient(90deg, #2F4FB5 0%, #3C66C6 50%, #4A86E8 100%);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    font-size: var(--text-base);
    box-shadow: var(--shadow-md);
}

.highlight-icon {
    font-size: var(--text-xl);
}

/* Decision Guide */
.decision-guide {
    margin-bottom: var(--space-xl);
}

.guide-grid {
    display: grid;
    gap: var(--space-md);
}

.guide-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface-hover);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.guide-condition {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 180px;
}

.condition-icon {
    font-size: var(--text-xl);
}

.condition-text {
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
}

.guide-arrow {
    color: var(--color-text-muted);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

.guide-method {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
}

.method-name {
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.recommended-guide {
    background: rgba(47, 79, 181, 0.08);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

.recommended-tag {
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    margin-left: auto;
}

/* Complexity Badges */
.badge-easy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.badge-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.badge-hard {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

/* Methods Grid Modern */
.methods-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.method-card-modern {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.method-card-modern:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.method-recommended {
    border: 2px solid #2F4FB5;
    background: linear-gradient(135deg, rgba(47, 79, 181, 0.03) 0%, rgba(74, 134, 232, 0.03) 100%);
    box-shadow: 0 0 20px rgba(47, 79, 181, 0.15);
}

.method-header-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    cursor: pointer;
    background: var(--color-surface);
    transition: background var(--transition-fast);
}

.method-header-modern:hover {
    background: var(--color-surface-hover);
}

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

.method-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
}

.recommended-star {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.method-title-group h3 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.method-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.method-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.recommended-badge {
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

.expand-icon {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    transition: transform var(--transition-fast);
}

.method-body {
    padding: 0 var(--space-lg) var(--space-lg);
}

.method-summary {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

/* Use Case */
.use-case {
    background: rgba(47, 79, 181, 0.05);
    border-left: 3px solid #2F4FB5;
    padding: var(--space-md);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: var(--space-md);
}

.use-case strong {
    color: #2F4FB5;
    font-size: var(--text-sm);
}

.use-case ul {
    margin: var(--space-sm) 0 0;
    padding-left: var(--space-lg);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.use-case li {
    margin-bottom: var(--space-xs);
}

/* Formula Box Modern */
.formula-box-modern {
    background: #1e293b;
    color: #e2e8f0;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}

.formula-label {
    display: block;
    font-size: var(--text-xs);
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.formula-code {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: #60a5fa;
    margin-bottom: var(--space-sm);
}

.formula-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: #94a3b8;
}

.formula-legend code {
    color: #fbbf24;
}

.formula-recommended {
    border: 1px solid rgba(47, 79, 181, 0.3);
    background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 100%);
}

/* Pros & Cons */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.pros, .cons {
    font-size: var(--text-sm);
}

.pros h5, .cons h5 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-sm);
}

.pros h5 {
    color: var(--color-success);
}

.cons h5 {
    color: var(--color-danger);
}

.pros ul, .cons ul {
    margin: 0;
    padding-left: var(--space-md);
    color: var(--color-text-secondary);
}

.pros li, .cons li {
    margin-bottom: var(--space-xs);
}

/* Recommendation Reasons */
.recommendation-reasons {
    background: linear-gradient(135deg, rgba(47, 79, 181, 0.08) 0%, rgba(74, 134, 232, 0.05) 100%);
    border: 1px solid rgba(47, 79, 181, 0.2);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.recommendation-reasons h5 {
    color: #2F4FB5;
    font-size: var(--text-sm);
    margin-bottom: var(--space-sm);
}

.recommendation-reasons ul {
    margin: 0;
    padding-left: var(--space-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.recommendation-reasons li {
    margin-bottom: var(--space-xs);
}

/* Comparison Table */
.comparison-card {
    margin-bottom: var(--space-xl);
}

.comparison-table th,
.comparison-table td {
    padding: var(--space-md);
    vertical-align: middle;
}

.comparison-table td:first-child {
    font-weight: var(--font-medium);
}

/* Tips Card */
.tips-card {
    margin-bottom: var(--space-xl);
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface-hover);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.tip-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.tip-item p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.tip-item strong {
    color: var(--color-text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: var(--space-xl) var(--space-md);
    }
    
    .hero-title {
        font-size: var(--text-2xl);
    }
    
    .highlight-box {
        flex-direction: column;
        text-align: center;
        padding: var(--space-md);
    }
    
    .guide-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .guide-arrow {
        display: none;
    }
    
    .guide-method {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .methods-grid-modern {
        grid-template-columns: 1fr;
    }
    
    .pros-cons {
        grid-template-columns: 1fr;
    }
    
    .method-header-right {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: var(--space-xs);
    }
    
    .recommended-badge {
        display: none;
    }
}

/* ========================================
   METRICS & BACKTESTING STYLES
   ======================================== */

/* Metrics Section */
.metrics-section {
    margin-top: var(--space-xl);
}

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

.metrics-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.metrics-legend {
    display: flex;
    gap: var(--space-md);
    font-size: var(--text-xs);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.high { background: var(--color-success); }
.legend-dot.medium { background: var(--color-warning); }
.legend-dot.low { background: var(--color-danger); }

/* Metrics Table */
.metrics-table th,
.metrics-table td {
    text-align: center;
    vertical-align: middle;
}

.metrics-table td:first-child {
    text-align: left;
    font-weight: var(--font-medium);
}

.metrics-table .text-right {
    text-align: right;
}

/* Confidence Badges */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}

.confidence-high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.confidence-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.confidence-low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

/* Best Method Row */
.row-best {
    background: rgba(47, 79, 181, 0.08) !important;
    border-left: 3px solid #2F4FB5;
}

.row-best td {
    font-weight: var(--font-semibold);
}

/* Recommended Badge */
.badge-recommended {
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

/* Data Warning Alert */
.alert-data-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #92400e;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

[data-theme="dark"] .alert-data-warning {
    color: #fbbf24;
}

/* Metric Value Styling */
.metric-value {
    font-family: var(--font-mono);
    font-weight: var(--font-semibold);
}

.metric-good { color: var(--color-success); }
.metric-medium { color: var(--color-warning); }
.metric-poor { color: var(--color-danger); }

/* Method Rank */
.method-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-surface-hover);
    border-radius: 50%;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--color-text-secondary);
}

.method-rank.top {
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
}

/* Backtest Info Box */
.backtest-info {
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-lg);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.backtest-info strong {
    color: var(--color-text-primary);
}

/* Fetch Metrics Button */
.btn-fetch-metrics {
    background: linear-gradient(90deg, #2F4FB5 0%, #4A86E8 100%);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-fetch-metrics:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-fetch-metrics:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Metrics Loading State */
.metrics-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-xl);
    color: var(--color-text-secondary);
}

/* Responsive Metrics */
@media (max-width: 768px) {
    .metrics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .metrics-legend {
        flex-wrap: wrap;
    }
    
    .metrics-table {
        font-size: var(--text-xs);
    }
    
    .metrics-table th,
    .metrics-table td {
        padding: var(--space-sm);
    }
}


/* ========================================
   APPENDIX: INPUT GROUP ADDON FIX
   ======================================== */

/* Input group addon (missing class fix) */
.input-group-addon {
    display: flex;
    align-items: center;
    padding: 0 var(--space-sm);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.input-group-addon input[type="checkbox"] {
    margin-right: 4px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
    flex: 1;
}


/* ========================================
   MODAL STYLES
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: var(--color-surface);
    margin: 5% auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-hover);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    cursor: pointer;
    color: var(--color-text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-border);
    color: var(--color-text-primary);
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-hover);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@media (max-width: 768px) {
    .modal-content {
        margin: 10% var(--space-md);
        max-width: none;
    }
}
