/* ============================================================================
   KITCHEN MANAGER — Design System
   ShadCN-inspired components · Lucide icons · HACCP compliance app
   Version: 1.0.0
   ============================================================================ */

/* ============================================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================================ */

:root {
    /* ── Brand Colors ── */
    --primary: #0f1739;
    --primary-light: #1a2550;
    --primary-lighter: #253368;
    --secondary: #a1c1db;
    --secondary-light: #c3d9ea;
    --secondary-dark: #7ba8c8;
    --tertiary: #02447d;
    --tertiary-light: #0960a8;

    /* ── Neutrals ── */
    --white: #ffffff;
    --black: #020202;
    --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;

    /* ── Semantic Colors ── */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #065f46;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-dark: #991b1b;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --info-dark: #1e40af;

    /* ── Surfaces ── */
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* ── Typography ── */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* ── Spacing Scale ── */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */

    /* ── Border Radius ── */
    --radius-sm: 0.375rem;    /* 6px */
    --radius-md: 0.5rem;      /* 8px */
    --radius-lg: 0.75rem;     /* 12px */
    --radius-xl: 1rem;        /* 16px */
    --radius-full: 9999px;

    /* ── Shadows (ShadCN-style) ── */
    --shadow-xs: 0 1px 2px rgba(15, 23, 57, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 57, 0.06), 0 1px 2px rgba(15, 23, 57, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 57, 0.07), 0 2px 4px -2px rgba(15, 23, 57, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 57, 0.08), 0 4px 6px -4px rgba(15, 23, 57, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 57, 0.1), 0 8px 10px -6px rgba(15, 23, 57, 0.06);

    /* ── Ring (focus) ── */
    --ring-color: rgba(2, 68, 125, 0.25);
    --ring-offset: 2px;

    /* ── Transitions ── */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Z-index Scale ── */
    --z-dropdown: 50;
    --z-sticky: 100;
    --z-overlay: 200;
    --z-modal: 300;
    --z-toast: 400;
}


/* ============================================================================
   2. RESET & BASE
   ============================================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;    /* 15px */
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--background);
    min-height: 100vh;
}

a {
    color: var(--tertiary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

img, svg {
    display: block;
    max-width: 100%;
}

/* Focus-visible for accessibility */
:focus-visible {
    outline: 2px solid var(--tertiary);
    outline-offset: var(--ring-offset);
    border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}


/* ============================================================================
   3. TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--gray-900);
    font-weight: 600;
    line-height: 1.3;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-6);
}

.page-title .page-title-sub {
    font-weight: 400;
    color: var(--gray-500);
    font-size: 1rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-4);
}

.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 0.9375rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-tertiary { color: var(--tertiary); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }


/* ============================================================================
   4. BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.5625rem 1.125rem;   /* 9px 18px */
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.btn:focus-visible {
    outline: 2px solid var(--tertiary);
    outline-offset: var(--ring-offset);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Lucide icons inside buttons */
.btn svg,
.btn [data-lucide] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: inherit;
    transition: color var(--transition-fast);
}

/* ── Primary ── */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: white; color: var(--primary); border-color: var(--primary);
    color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover svg,
.btn-primary:hover [data-lucide] {
    color: var(--primary);
}

/* ── Secondary ── */
.btn-secondary {
    background: var(--secondary);
    color: var(--primary);
    border-color: var(--secondary);
}
.btn-secondary:hover {
    background: white; color: var(--gray-700); border-color: var(--gray-200);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Outline ── */
.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border-color: var(--border);
}
.btn-outline:hover {
    background: var(--primary); color: white; border-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ── Ghost ── */
.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* —— Destructive —— */
.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: white; color: var(--danger); border-color: var(--danger);
    color: var(--danger);
    border-color: var(--danger);
}

/* —— Destructive Outline (inverse) —— */
.btn-danger-outline {
    background: var(--white);
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger-outline:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover svg,
.btn-danger:hover [data-lucide] {
    color: var(--danger);
}

/* ── Success ── */
.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}
.btn-success:hover {
    background: white; color: var(--success); border-color: var(--success);
    color: var(--success);
    border-color: var(--success);
}
.btn-success:hover svg,
.btn-success:hover [data-lucide] {
    color: var(--success);
}

/* ── Warning ── */
.btn-warning {
    background: var(--warning);
    color: var(--white);
    border-color: var(--warning);
}
.btn-warning:hover {
    background: var(--white);
    color: var(--warning);
    border-color: var(--warning);
}
.btn-warning:hover svg,
.btn-warning:hover [data-lucide] {
    color: var(--warning);
}

/* ── Sizes ── */
.btn-xs {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* ── Icon-only button ── */
.btn-icon {
    padding: 0.5rem;
    aspect-ratio: 1;
}

.btn-icon svg,
.btn-icon [data-lucide] {
    width: 16px;
    height: 18px;
}


/* ============================================================================
   5. CARDS
   ============================================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    gap: var(--space-4);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.card-content {
    /* Container for card body content */
}

.card-footer {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

/* Card with danger/warning left border */
.card-alert-danger {
    border-left: 4px solid var(--danger);
}

.card-alert-warning {
    border-left: 4px solid var(--warning);
}

.card-alert-success {
    border-left: 4px solid var(--success);
}

/* Compact card (less padding) */
.card-compact {
    padding: var(--space-4);
}


/* ============================================================================
   6. STAT CARDS
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.stat-card-icon svg,
.stat-card-icon [data-lucide] {
    width: 16px;
    height: 20px;
}

.stat-card-icon.icon-primary {
    background: rgba(15, 23, 57, 0.08);
    color: var(--primary);
}

.stat-card-icon.icon-success {
    background: var(--success-light);
    color: var(--success);
}

.stat-card-icon.icon-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card-icon.icon-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card-icon.icon-tertiary {
    background: rgba(2, 68, 125, 0.08);
    color: var(--tertiary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

/* Colored stat values */
.stat-card.success .stat-value,
.stat-value.text-success { color: var(--success); }
.stat-card.warning .stat-value,
.stat-value.text-warning { color: var(--warning); }
.stat-card.danger .stat-value,
.stat-value.text-danger { color: var(--danger); }


/* ============================================================================
   7. FORMS
   ============================================================================ */

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-label-required::after {
    content: ' *';
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5625rem 0.875rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--gray-300);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--tertiary);
    box-shadow: 0 0 0 3px var(--ring-color);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input.error,
.form-select.error {
    border-color: var(--danger);
}

.form-input.error:focus,
.form-select.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Select arrow */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.625rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: var(--space-1);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

/* Form row (inline fields) */
.form-row {
    display: grid;
    gap: var(--space-4);
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

@media (max-width: 640px) {
    .form-row-2,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }
}

/* Input group (icon inside input) */
.input-group {
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.input-group .input-icon svg,
.input-group .input-icon [data-lucide] {
    width: 16px;
    height: 18px;
}

.input-group .form-input {
    padding-left: 2.5rem;
}


/* ============================================================================
   8. TABLES
   ============================================================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead {
    background: var(--gray-50);
}

.table th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-500);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Compact table */
.table-compact th,
.table-compact td {
    padding: 0.5rem 0.75rem;
}

/* Striped table */
.table-striped tbody tr:nth-child(even) {
    background: var(--gray-50);
}


/* ============================================================================
   9. BADGES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge svg,
.badge [data-lucide] {
    width: 16px;
    height: 12px;
}

.badge-primary {
    background: rgba(15, 23, 57, 0.08);
    color: var(--primary);
}

.badge-secondary {
    background: rgba(161, 193, 219, 0.25);
    color: var(--tertiary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.badge-info {
    background: var(--info-light);
    color: var(--info-dark);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Dot indicator */
.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}


/* ============================================================================
   10. ALERTS / FLASH MESSAGES
   ============================================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
}

.alert svg,
.alert [data-lucide] {
    width: 16px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-success {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: #a7f3d0;
}

.alert-error,
.alert-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border-color: #fcd34d;
}

.alert-info {
    background: var(--info-light);
    color: var(--info-dark);
    border-color: #bfdbfe;
}

.alert-dismissible {
    position: relative;
    padding-right: 2.5rem;
}

.alert-close {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0.25rem;
    transition: opacity var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}


/* ============================================================================
   11. BREADCRUMBS
   ============================================================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-bottom: var(--space-6);
}

.breadcrumb a {
    color: var(--gray-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--tertiary);
}

.breadcrumb-separator {
    color: var(--gray-300);
}

.breadcrumb-current {
    color: var(--gray-900);
    font-weight: 500;
}


/* ============================================================================
   12. EMPTY STATES
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
    color: var(--gray-500);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.empty-state-icon svg,
.empty-state-icon [data-lucide] {
    width: 16px;
    height: 24px;
}

.empty-state p {
    font-size: 0.9375rem;
    margin-bottom: var(--space-4);
}


/* ============================================================================
   13. MODAL / DIALOG
   ============================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 57, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.modal-close:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
}

/* Large modal */
.modal-lg {
    max-width: 700px;
}

.modal-xl {
    max-width: 900px;
}

/* Fullscreen on mobile */
@media (max-width: 640px) {
    .modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        min-height: 100vh;
    }
}


/* ============================================================================
   14. DROPDOWN
   ============================================================================ */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: var(--space-1) 0;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu,
.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: background var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.dropdown-item svg,
.dropdown-item [data-lucide] {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

.dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: var(--space-1) 0;
}


/* ============================================================================
   15. TABS
   ============================================================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.tab-item {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-item:hover {
    color: var(--gray-700);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}


/* ============================================================================
   16. PAGINATION
   ============================================================================ */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    justify-content: center;
    margin-top: var(--space-6);
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.pagination-item:hover {
    background: var(--gray-100);
}

.pagination-item.active {
    background: var(--primary);
    color: var(--white);
}


/* ============================================================================
   17. TOOLTIPS
   ============================================================================ */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: var(--white);
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-toast);
}

[data-tooltip]:hover::after {
    opacity: 1;
}


/* ============================================================================
   18. TOAST / NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3) var(--space-4);
    min-width: 300px;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: toast-in 0.3s ease forwards;
}

.toast.toast-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}


/* ============================================================================
   19. AVATAR
   ============================================================================ */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.125rem; }
.avatar-xl { width: 56px; height: 56px; font-size: 1.25rem; }

.avatar-primary {
    background: var(--primary);
    color: var(--white);
}

.avatar-secondary {
    background: var(--secondary);
    color: var(--primary);
}

.avatar-tertiary {
    background: var(--tertiary);
    color: var(--white);
}


/* ============================================================================
   20. SEPARATOR / DIVIDER
   ============================================================================ */

.separator {
    height: 1px;
    background: var(--border);
    margin: var(--space-6) 0;
    border: none;
}

.separator-sm {
    margin: var(--space-3) 0;
}


/* ============================================================================
   21. LOADING / SKELETON
   ============================================================================ */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 28px; height: 28px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ============================================================================
   22. UTILITY CLASSES
   ============================================================================ */

/* ── Display ── */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

/* ── Flex ── */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* ── Gap ── */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Spacing ── */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* ── Text alignment ── */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Width ── */
.w-full { width: 100%; }

/* ── Overflow ── */
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }

/* ── Border ── */
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* ── Cursor ── */
.cursor-pointer { cursor: pointer; }

/* ── Responsive visibility ── */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}


/* ============================================================================
   23. PAGE-LEVEL LAYOUT HELPERS
   ============================================================================ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.page-header-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    align-items: end;
}

.filter-bar .form-group {
    margin-bottom: 0;
}


/* ============================================================================
   24. CHART.JS OVERRIDES (Admin / Stats)
   ============================================================================ */

/*
   Use these colors in Chart.js config:
   
   const chartPalette = {
       primary:   '#0f1739',
       secondary: '#a1c1db',
       tertiary:  '#02447d',
       success:   '#10b981',
       warning:   '#f59e0b',
       danger:    '#ef4444',
       series: ['#0f1739', '#02447d', '#a1c1db', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899']
   };
*/

.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}


/* ============================================================================
   25. LUCIDE ICON UTILITIES
   ============================================================================ */

/* Default icon size in text context */
[data-lucide] {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    stroke-width: 2;
}

/* Named sizes */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }


/* ============================================================================
   26. PRINT STYLES
   ============================================================================ */

@media print {
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    .no-print,
    .sidebar,
    .header,
    .btn,
    .admin-nav,
    .admin-header {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .table th,
    .table td {
        border: 1px solid #ccc;
    }
}


/* ============================================================================
   27. ANIMATIONS
   ============================================================================ */

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fade-in 0.2s ease;
}

.animate-slide-up {
    animation: slide-up 0.3s ease;
}

.animate-slide-down {
    animation: slide-down 0.3s ease;
}


/* ============================================================================
   28. SCROLLBAR (Webkit)
   ============================================================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
/* Fix date inputs sur mobile */
input[type="date"] {
    min-height: 2.75rem;
}
