/* ========================================
   STABLE SIMS - CENTRALIZED THEME
   ======================================== */

:root {
    /* Primary Color Palette */
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    /* Secondary Colors */
    --secondary-color: #64748b;
    --secondary-light: #94a3b8;
    --secondary-dark: #475569;
    /* Success Colors */
    --success-color: #10b981;
    --success-light: #34d399;
    --success-dark: #059669;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    /* Warning Colors */
    --warning-color: #f59e0b;
    --warning-light: #fbbf24;
    --warning-dark: #d97706;
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --danger-color: #ef4444;
    --danger-light: #f87171;
    --danger-dark: #dc2626;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    /* Info Colors */
    --info-color: #06b6d4;
    --info-light: #22d3ee;
    --info-dark: #0891b2;
    --info-gradient: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    /* Neutral Colors */
    --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;
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #1e293b;
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    /* Border Colors */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    /* Shadow Colors */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    /* Font Sizes */
    --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;
    /* Component Sizes */
    --btn-height-sm: 2rem;
    --btn-height-md: 2.5rem;
    --btn-height-lg: 3rem;
    --input-height-sm: 2rem;
    --input-height-md: 2.5rem;
    --input-height-lg: 3rem;
    --card-padding: 1.5rem;
    --section-padding: 2rem;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-white);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        color: var(--text-white);
    }

    .btn-primary:active {
        transform: translateY(0);
    }

    .btn-primary::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        transition: left 0.5s;
    }

    .btn-primary:hover::before {
        left: 100%;
    }

.btn-secondary {
    background: var(--bg-primary);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-secondary:hover {
        background: var(--gray-50);
        border-color: var(--primary-color);
        color: var(--primary-color);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

.btn-success {
    background: var(--success-gradient);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-white);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-success:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        color: var(--text-white);
    }

.btn-warning {
    background: var(--warning-gradient);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-white);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-warning:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        color: var(--text-white);
    }

.btn-danger {
    background: var(--danger-gradient);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-white);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-danger:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        color: var(--text-white);
    }


.btn-outline-secondary {
    background: transparent;
    /* border: 2px solid var(--secondary-color); */
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--secondary -color);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-outline-secondary:hover {
        background: var(--secondary-color);
        color: var(--text-white);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

.btn-outline-primary {
    background: transparent;
    /* border: 2px solid var(--primary-color); */
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--primary-color);
    height: var(--btn-height-md);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

    .btn-outline-primary:hover {
        background: var(--primary-color);
        color: var(--text-white);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

/* Button Sizes */
.btn-sm {
    height: var(--btn-height-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--text-xs);
}

.btn-lg {
    height: var(--btn-height-lg);
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--text-base);
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

.card-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: var(--card-padding);
}

.card-footer {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-light);
    padding: var(--spacing-lg);
}

/* Premium Card - Light Theme */
.card-premium {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

    .card-premium .card-header {
        background: var(--bg-tertiary);
        border-bottom: 1px solid var(--border-light);
        color: var(--text-primary);
        position: relative;
        /* z-index: 100; Lower than app header to prevent overlap */
    }

/* Page header specific styling to prevent overlap with app header */
.page-header {
    position: relative;
    z-index: 100;
}

/* ========================================
   FORMS
   ======================================== */

.form-control, .form-select {
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-sm);
    height: var(--input-height-md);
    background: var(--bg-primary);
    transition: all 0.3s ease;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
        background: var(--bg-primary);
        transform: translateY(-1px);
    }

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: var(--text-sm);
}

/* Form Groups */
.form-group {
    margin-bottom: var(--spacing-lg);
}

    .form-group label {
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: var(--spacing-sm);
        font-size: var(--text-sm);
        display: block;
    }

    .form-group .form-control,
    .form-group .form-select {
        height: var(--input-height-md);
        padding: var(--spacing-sm) var(--spacing-md);
        border: 2px solid var(--border-light);
        border-radius: var(--radius-md);
        background: var(--bg-primary);
        transition: all 0.3s ease;
        font-size: var(--text-sm);
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
    }

        .form-group .form-control:focus,
        .form-group .form-select:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
            background: var(--bg-primary);
            transform: translateY(-1px);
        }

    /* Custom select styling */
    .form-group .form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
        padding-right: 2.5rem;
    }

        .form-group .form-select:focus {
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234f46e5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
        }

/* Input Group Styling */
.input-group {
    border-radius: var(--radius-lg);
}

    .input-group .form-control,
    .input-group .input-group-text,
    .input-group .form-select {
        border-radius: var(--radius-lg);
    }

        .input-group .form-control:focus,
        .input-group .form-select:focus {
            border-radius: var(--radius-lg);
        }

.required-asterisk {
    color: var(--danger-color);
    font-weight: bold;
    margin-left: 0.25rem;
}

.validation-message {
    font-size: var(--text-xs);
    margin-top: var(--spacing-sm);
    padding-left: var(--spacing-sm);
    color: var(--danger-color);
}

/* ========================================
   SECTIONS
   ======================================== */

.section-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    overflow: hidden;
}

    .section-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

.section-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-md) var(--spacing-lg);
    position: relative;
}

.section-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-white);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

.form-section {
    padding: var(--section-padding);
}

/* ========================================
   STATS CARDS
   ======================================== */

.stats-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card-small {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card-small-2 {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
}

.stats-card-success::before {
    background: var(--success-gradient);
}

.stats-card-warning::before {
    background: var(--warning-gradient);
}

.stats-card-danger::before {
    background: var(--danger-gradient);
}

.stats-card-info::before {
    background: var(--info-gradient);
}

.stats-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-white);
    margin-bottom: var(--spacing-sm);
}

.stats-icon-small {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-white);
    margin-bottom: var(--spacing-xs);
}

.stats-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.stats-value-small {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.stats-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.stats-label-small {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.text-xs {
    font-size: 0.7rem;
}

.text-gray-300 {
    color: #dddfeb !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

/* ========================================
   TABLES
   ======================================== */

.table {
    background: var(--bg-primary);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-rounded {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background: var(--bg-tertiary);
    border: none;
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
    padding: var(--spacing-md) var(--spacing-lg);
}

.table tbody td {
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
}

.badge-primary {
    background: var(--primary-color);
    color: var(--text-white);
}

.badge-success {
    background: var(--success-color);
    color: var(--text-white);
}

.badge-warning {
    background: var(--warning-color);
    color: var(--text-white);
}

.badge-danger {
    background: var(--danger-color);
    color: var(--text-white);
}

.badge-secondary {
    background: var(--secondary-color);
    color: var(--text-white);
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--text-sm);
    font-weight: 500;
}

.alert-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-dark);
    border-left: 4px solid var(--primary-color);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-dark);
    border-left: 4px solid var(--success-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-dark);
    border-left: 4px solid var(--warning-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-dark);
    border-left: 4px solid var(--danger-color);
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* ========================================
   UTILITIES
   ======================================== */

.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}
/* .bg-secondary { background-color: var(--bg-secondary) !important; } */
.bg-light {
    background-color: var(--bg-tertiary) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.border-light {
    border-color: var(--border-light) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.rounded-lg {
    border-radius: var(--radius-lg) !important;
}

.rounded-xl {
    border-radius: var(--radius-xl) !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .card-body {
        padding: var(--spacing-md);
    }

    .form-section {
        padding: var(--spacing-md);
    }

    .section-header {
        padding: var(--spacing-md);
    }

    .btn {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }

    .btn-group .btn {
        width: auto;
        margin-bottom: 0;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .btn, .loading-overlay, .card-premium::before {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid var(--border-medium) !important;
    }
}
