/* ============================================
   Fast2 — Components
   Rafine, sobre, pas triste
   ============================================ */

/* ── Buttons (pill shape comme Saxho) ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-sm);
    padding: var(--sp-sm) var(--sp-xl);
    font-family: var(--ff-body);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    line-height: 1.5;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}

.btn--primary {
    background: var(--c-primary);
    color: var(--c-white);
}
.btn--primary:hover {
    background: var(--c-primary-dark);
    color: var(--c-white);
    box-shadow: var(--shadow-glow-primary);
    transform: translateY(-1px);
}

.btn--secondary {
    background: var(--c-secondary);
    color: var(--c-white);
}
.btn--secondary:hover {
    background: var(--c-secondary-dark);
    color: var(--c-white);
    box-shadow: var(--shadow-glow-secondary);
    transform: translateY(-1px);
}

.btn--outline {
    background: transparent;
    color: var(--c-dark);
    border-color: var(--c-border);
}
.btn--outline:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: var(--c-primary-50);
}

.btn--outline-white {
    background: transparent;
    color: var(--c-white);
    border-color: rgba(255, 255, 255, 0.3);
}
.btn--outline-white:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    color: var(--c-white);
}

.btn--ghost {
    background: transparent;
    color: var(--c-text);
}
.btn--ghost:hover {
    background: var(--c-surface);
}

.btn--danger {
    background: var(--c-error);
    color: var(--c-white);
}
.btn--danger:hover {
    background: #DC2626;
    color: var(--c-white);
}

.btn--sm {
    padding: var(--sp-xs) var(--sp-md);
    font-size: var(--fs-xs);
}

.btn--lg {
    padding: var(--sp-md) var(--sp-2xl);
    font-size: var(--fs-body);
}

.btn--full { width: 100%; }

.btn:disabled, .btn.is-loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn .icon { flex-shrink: 0; }

/* ── Cards (warm surface) ── */
.card {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-xl);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: transparent;
    transform: translateY(-2px);
}

.card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-md);
    background: var(--c-primary-50);
    color: var(--c-primary);
}

.card__title {
    font-family: var(--ff-display);
    font-size: var(--fs-h4);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--sp-sm);
    color: var(--c-dark);
}

.card__text {
    color: var(--c-text-light);
    font-size: var(--fs-small);
    line-height: var(--lh-relaxed);
}

.card__footer {
    margin-top: var(--sp-md);
    padding-top: var(--sp-md);
    border-top: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-xs);
    padding: var(--sp-2xs) var(--sp-sm);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    border-radius: var(--radius-full);
    line-height: 1.5;
}

.badge--debutant    { background: #ECFDF5; color: #065F46; }
.badge--intermediaire { background: #EFF6FF; color: #1E40AF; }
.badge--avance      { background: #FFFBEB; color: #92400E; }
.badge--expert      { background: #FEF2F2; color: #991B1B; }

.badge--success     { background: #ECFDF5; color: #065F46; }
.badge--warning     { background: #FFFBEB; color: #92400E; }
.badge--error       { background: #FEF2F2; color: #991B1B; }
.badge--info        { background: #EFF6FF; color: #1E40AF; }
.badge--neutral     { background: var(--c-surface); color: var(--c-text-light); }
.badge--muted       { background: var(--c-surface); color: var(--c-text-light); }
.badge--danger      { background: #FEF2F2; color: #991B1B; }

.badge--popular {
    background: var(--c-primary);
    color: var(--c-white);
}

/* ── Forms ── */
.form-group {
    margin-bottom: var(--sp-lg);
}

.form-label {
    display: block;
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    color: var(--c-dark);
    margin-bottom: var(--sp-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--sp-sm) var(--sp-md);
    font-size: var(--fs-body);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    appearance: none;
    color: var(--c-text);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-50);
    background: var(--c-white);
}

.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
    border-color: var(--c-error);
}

.form-error {
    font-size: var(--fs-xs);
    color: var(--c-error);
    margin-top: var(--sp-xs);
}

.form-hint {
    font-size: var(--fs-xs);
    color: var(--c-text-light);
    margin-top: var(--sp-xs);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='2 4 6 8 10 4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-md) center;
    padding-right: var(--sp-2xl);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--c-primary);
    cursor: pointer;
}

/* ── Tables ── */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background: var(--c-white);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--c-surface);
    padding: var(--sp-sm) var(--sp-md);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    color: var(--c-text-light);
    text-align: left;
    border-bottom: 1px solid var(--c-border);
}

.table td {
    padding: var(--sp-sm) var(--sp-md);
    font-size: var(--fs-small);
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
}

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

.table tr:hover td {
    background: var(--c-light);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 13, 26, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    padding: var(--sp-md);
    backdrop-filter: blur(4px);
}

.modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--c-white);
    border-radius: var(--radius-xl);
    padding: var(--sp-xl);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px);
    transition: transform var(--transition-spring);
}

.modal-overlay.is-active .modal {
    transform: translateY(0);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-lg);
}

.modal__title {
    font-size: var(--fs-h3);
}

.modal__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

.modal__close:hover {
    background: var(--c-surface);
}

.modal__footer {
    margin-top: var(--sp-xl);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-sm);
}

/* ── Page hero banner ── */
.page-hero {
    background: var(--c-dark);
    color: var(--c-white);
    padding: var(--sp-3xl) 0 var(--sp-2xl);
    margin-bottom: var(--sp-3xl);
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 55% at 75% 45%, rgba(233, 30, 99, 0.16) 0%, transparent 65%),
        radial-gradient(ellipse 45% 45% at 15% 60%, rgba(27, 58, 158, 0.10) 0%, transparent 65%);
    pointer-events: none;
}

.page-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-primary-light), transparent);
    opacity: 0.3;
}

.page-hero__title {
    color: var(--c-white);
    margin-bottom: var(--sp-sm);
}

.page-hero__subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--fs-body);
    max-width: 600px;
    line-height: var(--lh-relaxed);
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: var(--sp-3xl) var(--sp-lg);
    color: var(--c-text-light);
}

.empty-state .icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--sp-md);
    opacity: 0.3;
}

.empty-state__title {
    font-size: var(--fs-h4);
    color: var(--c-dark);
    margin-bottom: var(--sp-sm);
}

/* ── Loading spinner ── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 40px; height: 40px; border-width: 4px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Stat card (admin) ── */
.stat-card {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--sp-md);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
}

.stat-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-primary-50);
    color: var(--c-primary);
    flex-shrink: 0;
}

.stat-card__value {
    font-family: var(--ff-display);
    font-size: var(--fs-h2);
    font-weight: var(--fw-bold);
    color: var(--c-dark);
    line-height: 1;
}

.stat-card__label {
    font-size: var(--fs-small);
    color: var(--c-text-light);
    margin-top: var(--sp-2xs);
}

/* ── Grid layouts ── */
.grid { display: grid; gap: var(--sp-lg); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ── Divider ── */
.divider {
    width: 48px;
    height: 3px;
    background: var(--c-primary);
    border-radius: var(--radius-full);
    margin: var(--sp-md) 0;
}

.divider--center {
    margin-inline: auto;
}

/* ── Utility classes ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--c-text-light); }
.text-small { font-size: var(--fs-small); }
.text-xs { font-size: var(--fs-xs); }
.text-gradient {
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.font-mono { font-family: var(--ff-mono); }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mt-xl { margin-top: var(--sp-xl); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.flex { display: flex; }
.flex-center { align-items: center; }
.flex-between { justify-content: space-between; }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.hidden { display: none !important; }
