:root {
    /* Light theme - Light Blue & Light Green */
    --primary-color: #1976d2;
    --primary-light: #e3f2fd;
    --primary-dark: #1565c0;
    --secondary-color: #388e3c;
    --secondary-light: #e8f5e9;
    --secondary-dark: #2e7d32;
    --accent-gradient: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    
    --background: #fafafa;
    --surface: #ffffff;
    --surface-hover: #f5f5f5;
    --text-primary: #212121;
    --text-secondary: #757575;
    --text-muted: #9e9e9e;
    --border-color: #e0e0e0;
    --border-radius: 12px;
    --border-radius-lg: 20px;
    
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196f3;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
}

[data-bs-theme="dark"] {
    /* Dark theme */
    --primary-color: #64b5f6;
    --primary-light: #1a2f4a;
    --primary-dark: #90caf9;
    --secondary-color: #81c784;
    --secondary-light: #1a3d1f;
    --secondary-dark: #a5d6a7;
    --accent-gradient: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    
    --background: #0a0a0a;
    --surface: #1a1a1a;
    --surface-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --border-color: #333333;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.brand-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    color: var(--text-secondary) !important;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary-color) !important;
    background-color: var(--primary-light);
}

.nav-link i {
    margin-left: 0.5rem;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-bs-theme="light"] .theme-icon-dark {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-light {
    display: none;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.footer h5, .footer h6 {
    color: var(--text-primary);
}

.footer a {
    color: var(--text-secondary);
}

.footer a:hover {
    color: var(--primary-color);
}

.footer-brand {
    font-weight: 700;
    color: var(--primary-color);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
    padding: 3rem 0;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* Model Card */
.model-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.model-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.model-card-header {
    background: var(--accent-gradient);
    padding: 2rem;
    text-align: center;
}

.model-icon {
    width: 80px;
    height: 80px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 2rem;
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

.model-card-body {
    padding: 1.5rem;
    flex: 1;
}

.model-card-body .card-title {
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.model-card-body .card-text {
    font-size: 0.9rem;
    line-height: 1.6;
}

.model-tabs-preview {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.model-tabs-preview .badge {
    font-weight: 500;
}

.model-card-footer {
    padding: 1rem 1.5rem 1.5rem;
}

/* Stat Card (Admin) */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.stat-content p {
    color: var(--text-secondary);
    margin: 0;
}

/* ==========================================================================
   Section Titles
   ========================================================================== */

.section-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--primary-color);
}

/* ==========================================================================
   Dataset Page
   ========================================================================== */

.dataset-header {
    background: var(--accent-gradient);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
}

.dataset-icon {
    width: 80px;
    height: 80px;
    background: var(--surface);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

/* Model Tabs */
.model-tabs {
    border-bottom: 2px solid var(--border-color);
}

.model-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 1rem 1.5rem !important;
    font-weight: 600;
    color: var(--text-secondary) !important;
    margin-bottom: -2px;
}

.model-tabs .nav-link:hover {
    border-bottom-color: var(--primary-light);
    background: transparent;
}

.model-tabs .nav-link.active {
    color: var(--primary-color) !important;
    border-bottom-color: var(--primary-color);
    background: transparent;
}

/* Model Info Card */
.model-info-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.developer-info {
    background: var(--accent-gradient);
    padding: 1rem;
    border-radius: var(--border-radius);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.prediction-form-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
}

.field-group {
    background: var(--surface-hover);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.field-group-title {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.field-group-title small {
    font-weight: 400;
    color: var(--text-muted);
}

/* Form Field Wrapper */
.form-field-wrapper {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-field-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* Bilingual Label */
.form-label-bilingual {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form-label-fa {
    font-weight: 600;
    color: var(--text-primary);
}

.form-label-en {
    font-size: 0.85rem;
    color: var(--text-muted);
    direction: ltr;
}

.label-separator {
    width: 1px;
    height: 16px;
    background: var(--border-color);
}

/* Form Controls */
.form-control, .form-select {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.625rem 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.5rem;
    background-color: var(--surface);
    border: 2px solid var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
}

.btn i {
    margin-left: 0.5rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Results Display
   ========================================================================== */

.prediction-result {
    animation: fadeIn 0.3s ease;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    height: 100%;
}

.result-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.probability-display {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.risk-badge .badge {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

.shap-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: white;
}

[data-bs-theme="dark"] .shap-image {
    filter: invert(0.85) hue-rotate(180deg);
}

.interpretation-card {
    background: var(--accent-gradient);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

.interpretation-card h5 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.interpretation-card ul {
    margin-bottom: 0;
    padding-right: 1.5rem;
}

/* ==========================================================================
   Patient Modal
   ========================================================================== */

.patient-code-display {
    font-size: 3rem;
    font-weight: 800;
    font-family: monospace;
    letter-spacing: 0.5rem;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    display: inline-block;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    background: var(--surface);
    padding: 2rem 3rem;
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.loading-text {
    color: var(--text-secondary);
    margin-top: 1rem;
    margin-bottom: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state i {
    color: var(--text-muted);
}

/* ==========================================================================
   Admin Sidebar
   ========================================================================== */

.admin-sidebar {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    position: sticky;
    top: 80px;
}

.admin-sidebar .nav-link {
    color: var(--text-secondary) !important;
    padding: 0.75rem 1rem !important;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-sidebar .nav-link:hover {
    background: var(--surface-hover);
    color: var(--primary-color) !important;
}

.admin-sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary-color) !important;
    font-weight: 600;
}

.admin-sidebar .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    margin: 0;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    border-radius: var(--border-radius);
    border: none;
}

.alert i {
    margin-left: 0.5rem;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 992px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .navbar-collapse {
        background: var(--surface);
        padding: 1rem;
        margin-top: 1rem;
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
    }
    
    .admin-sidebar {
        position: static;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .form-label-bilingual {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .label-separator {
        display: none;
    }
    
    .probability-display {
        font-size: 2.5rem;
    }
    
    .patient-code-display {
        font-size: 2rem;
        letter-spacing: 0.25rem;
        padding: 1rem 1.5rem;
    }
    
    .dataset-header {
        padding: 1.5rem;
    }
    
    .model-tabs .nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem;
    }
    
    .field-group {
        padding: 1rem;
    }
    
    .prediction-form-card {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .btn-lg {
        width: 100%;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .navbar, .footer, .theme-toggle, .btn {
        display: none !important;
    }
    
    .prediction-result {
        break-inside: avoid;
    }
}
