/* MisiBot Premium Design System */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-main: #f8fafc;
    --bg-sidebar: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif !important;
    overflow-x: hidden;
}

/* Sidebar Layout Structural Changes */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    color: white;
    position: fixed;
    height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-backdrop.active {
    display: block;
}

.mobile-toggle-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 3rem 4rem;
    transition: all 0.3s ease;
    background: radial-gradient(circle at 50% 0%, #f1f5f9 0%, #f8fafc 100%);
    position: relative;
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar-header {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 32px;
    height: auto;
}

.sidebar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #94a3b8;
    text-decoration: none !important;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-item i {
    width: 20px;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Premium Card Components */
.premium-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.kpi-row,
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

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

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

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.kpi-value {
    font-size: 1.875rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.05em;
    color: var(--text-main);
}

.kpi-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

/* Chart Refinement */
.chart-card {
    height: 100%;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* Compatibility Layer for Legacy Premium Components */
.dashboard-container,
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
}

.modern-card {
    background: white;
    border-radius: 1.25rem;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
}

.card-title-modern {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

/* Modern Navigation & Headers */
.modern-nav {
    background: transparent;
    padding: 0;
    margin-bottom: 3rem;
    overflow: hidden;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-logo {
    max-height: 48px !important;
    width: auto !important;
    object-fit: contain;
    border-radius: 0.75rem;
}

.nav-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.04em;
}

.nav-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

/* Enrollment Wizard Styling */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    position: relative;
    padding: 0 1rem;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.wizard-step {
    position: relative;
    z-index: 2;
    background: white;
    text-align: center;
    width: 32px;
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8125rem;
    color: #94a3b8;
    transition: all 0.3s ease;
    margin: 0 auto 0.5rem;
}

.wizard-step.active .step-indicator {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.wizard-step.completed .step-indicator {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    position: absolute;
    width: 100px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.wizard-step.active .step-label {
    color: var(--primary);
}

.wizard-content {
    min-height: 350px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-content.active {
    display: block;
}

.contact-card-selectable {
    border: 2px solid #f1f5f9;
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
}

.contact-card-selectable:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.contact-card-selectable.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
}

.btn-info-modern {
    background: var(--info);
    color: white;
}

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

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

.btn-secondary-modern {
    background: var(--secondary);
    color: white;
}

.btn-ghost-modern {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
}

/* Table Compatibility */
.table-modern {
    width: 100%;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
}

.table-modern th {
    background: #f8fafc;
    padding: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
}

.table-modern td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
}

/* Animations - Desktop Only */
@media (min-width: 1025px) {
    .animate-in {
        animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button Overrides */
.btn-premium {
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

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

.btn-premium-primary:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* Responsive Structural Adjustments */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar-brand,
    .sidebar-item span {
        display: none;
    }

    .main-content {
        margin-left: 80px;
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
    }

    .sidebar.sidebar-open {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0;
        padding: 5rem 1.5rem 1.5rem;
    }

    .kpi-row,
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .d-flex.gap-3,
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1.5rem;
    }

    header.d-flex>div:last-child {
        width: 100%;
    }

    .btn-premium {
        width: 100%;
        justify-content: center;
    }
}

/* Enrollment Wizard Extra Styles */
.group-chip {
    transition: all 0.2s ease;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    background: #fff;
    color: #475569;
    font-weight: 500;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
}

.group-chip:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.group-chip.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
}

.empty-state-wizard {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 2.5rem;
    text-align: center;
}