/* --- DESIGN TOKENS (Base du UI Kit) --- */
:root {
    /* Palette Principale */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --on-primary: #ffffff;
    /* Fondations */
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --border: #e5e7eb;
    /* Typographie */
    --text-main: #111827;
    --text-secondary: #6b7280;
    --text-disabled: #9ca3af;
    /* Status */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    /* Dimensions */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- RESET & GLOBAL --- */
html, body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden; /* Important pour le layout sidebar fixe */
}

a {
    text-decoration: none;
    color: inherit;
}

* {
    box-sizing: border-box;
}

/* --- TYPOGRAPHY UTILS --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    margin-top: 0;
}

.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-secondary);
}

/* --- COMPONENT CLASSES (Pour usage rapide sans composant Razor) --- */

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

/* Inputs */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--bg-surface);
    transition: border 0.2s, box-shadow 0.2s;
}

    .form-control:focus {
        border-color: var(--primary);
        outline: none;
        box-shadow: 0 0 0 3px var(--primary-light);
    }

/* Grids */
.ui-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* Data Tables */
.datagrid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

    .datagrid th {
        text-align: left;
        padding: 1rem;
        background: #f9fafb;
        color: var(--text-secondary);
        font-weight: 600;
        border-bottom: 1px solid var(--border);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
    }

    .datagrid td {
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .datagrid tr:last-child td {
        border-bottom: none;
    }

/* ============================================= */
/* --- UTILITY CLASSES (Bootstrap-compatible) --- */
/* ============================================= */

/* Display */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline-flex { display: inline-flex; }

/* Flex */
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }

/* Gap */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Margins */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }

/* Width */
.w-100 { width: 100%; }

/* Text */
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-xs { font-size: 0.75rem; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-white { color: #ffffff !important; }
.text-white-50 { color: rgba(255,255,255,0.5) !important; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }

/* Borders */
.border-info { border-color: var(--info) !important; }
.border-success { border-color: var(--success) !important; }
.border-warning { border-color: var(--warning) !important; }
.border-danger { border-color: var(--danger) !important; }

/* Form Small Variants */
.form-control-sm {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}
.form-select, .form-select-sm {
    width: 100%;
    padding: 0.35rem 1.8rem 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--bg-surface);
    appearance: auto;
    cursor: pointer;
}
.form-select:focus, .form-select-sm:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Spinner (Bootstrap-compatible) */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
    vertical-align: -0.125em;
}
@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Global Buttons (non-scoped fallback) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-secondary); padding: 0; }
.btn-close:hover { color: var(--text-main); }

/* Modal (shared across pages) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}
.modal-content {
    width: 100%;
    max-width: 600px;
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-body { margin-bottom: 0.5rem; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* Row/Col Grid */
.row { display: flex; gap: 1rem; }
.col-6 { flex: 1; }

/* Page title */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* --- BLAZOR SPECIFIC --- */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.loading-progress-text {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
    font-weight: bold;
}

/* ============================================= */
/* --- AUTH PAGES (Login, Forgot, Reset...) --- */
/* ============================================= */

.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, var(--primary-light) 100%);
    overflow-y: auto;
    padding: 2rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Brand / Logo */
.auth-brand {
    text-align: center;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1rem auto;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.auth-app-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.5px;
}

.auth-tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

/* Auth Card */
.auth-card {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
}

/* Form wrapper inside card */
.auth-form-wrapper {
    width: 100%;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 0.25rem 0;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

/* Fields */
.auth-field {
    margin-bottom: 1.25rem;
}

.auth-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

    .auth-label i {
        color: var(--text-secondary);
        width: 16px;
        text-align: center;
        font-size: 0.8rem;
    }

.auth-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    background: var(--bg-surface);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .auth-input:focus {
        border-color: var(--primary);
        outline: none;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }

    .auth-input::placeholder {
        color: var(--text-disabled);
        font-weight: 400;
    }

.auth-validation-error {
    display: block;
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.3rem;
}

/* Options row (remember + forgot) */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 400;
}

.auth-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.auth-forgot-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

    .auth-forgot-link:hover {
        color: var(--primary-dark);
        text-decoration: underline;
    }

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

    .auth-submit-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
    }

    .auth-submit-btn:active {
        transform: translateY(0);
    }

/* Alert */
.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.auth-alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Back link */
.auth-back-link {
    text-align: center;
    margin-top: 1.25rem;
}

    .auth-back-link a {
        color: var(--text-secondary);
        font-size: 0.85rem;
        font-weight: 500;
        text-decoration: none;
        transition: color 0.2s;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
    }

        .auth-back-link a:hover {
            color: var(--primary);
        }

/* Blocked icon (Register disabled, confirmations) */
.auth-blocked-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

/* Footer */
.auth-footer {
    font-size: 0.8rem;
    color: var(--text-disabled);
    text-align: center;
}
