/* ========================================================
   BioGestion — Design System CSS
   Mobile-first, modern, clean
   ======================================================== */

/* ?? CSS Variables ???????????????????????????????????????? */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #111827;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.18s ease;
}

/* ?? Reset & Base ????????????????????????????????????????? */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

/* ?? Brand ???????????????????????????????????????????????? */
.brand-logo { font-size: 1.4rem; }
.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
    margin-left: 4px;
}

/* ?? AUTH LAYOUT ?????????????????????????????????????????? */
.auth-body {
    background: linear-gradient(135deg, #f0f0ff 0%, #faf5ff 50%, #f0fdf4 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-brand { margin-bottom: 1.5rem; }

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-100);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

/* ?? Form Controls ???????????????????????????????????????? */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--gray-200);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--gray-50);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: #fff;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 5px;
}

/* ?? Buttons ?????????????????????????????????????????????? */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* ?? DASHBOARD LAYOUT ????????????????????????????????????? */
.dashboard-body { overflow-x: hidden; }

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    padding: 0.25rem 0.5rem;
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-link i { font-size: 1rem; width: 18px; text-align: center; }

.nav-link:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--gray-800);
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.user-avatar-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

/* ?? STAT CARDS ??????????????????????????????????????????? */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12.5px;
    color: var(--gray-500);
    margin-top: 4px;
}

.stat-sub {
    font-size: 11.5px;
    font-weight: 500;
    margin-top: 6px;
}

/* ?? Soft color backgrounds ??????????????????????????????? */
.bg-primary-soft { background: #ede9fe; }
.bg-info-soft    { background: #cffafe; }
.bg-success-soft { background: #d1fae5; }
.bg-warning-soft { background: #fef3c7; }
.bg-danger-soft  { background: #fee2e2; }

/* ?? QUICK ACTIONS ???????????????????????????????????????? */
.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 1.25rem 1rem;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 13px;
    transition: all var(--transition);
    aspect-ratio: 1;
}

.quick-action-card i { font-size: 1.5rem; color: var(--primary); }

.quick-action-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ?? PAGE HEADER ?????????????????????????????????????????? */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

/* ?? CARDS ???????????????????????????????????????????????? */
.card {
    border-radius: var(--radius);
    border: 1px solid var(--gray-100);
}

.card-body { padding: 1.25rem; }

/* ?? TABLES ??????????????????????????????????????????????? */
.table { font-size: 13.5px; }
.table th { font-weight: 600; color: var(--gray-600); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--gray-50); }

/* ?? BADGES ??????????????????????????????????????????????? */
.badge { font-weight: 500; border-radius: 6px; }

/* ?? ALERTS ??????????????????????????????????????????????? */
.alert { border-radius: var(--radius-sm); font-size: 13.5px; }

/* ?? MOBILE ??????????????????????????????????????????????? */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
}
