/**
 * Composants Button
 * Styles réutilisables pour tous les boutons
 */

/* ===== BUTTON BASE ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 16px 32px;
    font-family: var(--font-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    text-decoration: none;
    text-align: center;
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition:
        transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1),
        background 300ms cubic-bezier(0.4, 0, 0.2, 1),
        color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        border-color 300ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

/* ===== VARIANTS - COULEURS ===== */

/* Primary (Gradient Bleu - Design par défaut moderne) */
.btn--primary {
    background: var(--gradient-main);
    color: var(--color-white);
    box-shadow: 0 4px 14px 0 rgba(12, 129, 228, 0.25);
    border: none;
}

.btn--primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px 0 rgba(12, 129, 228, 0.35);
}

/* Secondary (Blanc avec bordure bleue) */
.btn--secondary {
    background: var(--color-white);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.btn--secondary:hover:not(:disabled) {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 4px 14px 0 rgba(12, 129, 228, 0.25);
}

/* Dark (Noir) */
.btn--dark {
    color: var(--color-white);
    background: var(--color-black);
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.15);
}

.btn--dark:hover:not(:disabled) {
    background: #1a1a1a;
    box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.25);
}

/* Success (Vert) */
.btn--success {
    color: var(--color-white);
    background: var(--color-success);
    box-shadow: 0 4px 14px 0 rgba(48, 147, 68, 0.25);
}

.btn--success:hover:not(:disabled) {
    background: #267a35;
    box-shadow: 0 6px 20px 0 rgba(48, 147, 68, 0.35);
}

/* Error (Rouge) */
.btn--error {
    color: var(--color-white);
    background: var(--color-error);
    box-shadow: 0 4px 14px 0 rgba(209, 0, 0, 0.25);
}

.btn--error:hover:not(:disabled) {
    background: #a80000;
    box-shadow: 0 6px 20px 0 rgba(209, 0, 0, 0.35);
}

/* Outline Primary */
.btn--outline {
    color: var(--color-primary);
    background: transparent;
    border: 2px solid var(--color-primary);
    box-shadow: none;
}

.btn--outline:hover:not(:disabled) {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 4px 14px 0 rgba(12, 129, 228, 0.25);
}

/* Outline Dark */
.btn--outline-dark {
    color: var(--color-black);
    background: transparent;
    border: 2px solid var(--color-black);
    box-shadow: none;
}

.btn--outline-dark:hover:not(:disabled) {
    background: var(--color-black);
    color: var(--color-white);
}

/* Ghost (Sans bordure ni fond) */
.btn--ghost {
    color: var(--color-gray-dark);
    background: transparent;
    box-shadow: none;
}

.btn--ghost:hover:not(:disabled) {
    background: var(--color-gray-light);
}

/* Link (Comme un lien) */
.btn--link {
    color: var(--color-primary);
    background: transparent;
    box-shadow: none;
    padding: 0;
    text-decoration: underline;
}

.btn--link:hover:not(:disabled) {
    color: var(--color-primary-dark);
    background: transparent;
    transform: none;
}

/* ===== SIZES ===== */

/* Small */
.btn--small,
.btn--sm {
    padding: 12px 24px;
    font-size: var(--font-size-sm);
}

/* Large */
.btn--large,
.btn--lg {
    padding: 18px 40px;
    font-size: var(--font-size-lg);
}

/* Enhanced - Style optimisé pour les formulaires (équivalent py-4 px-8 de Tailwind) */
.btn--enhanced {
    padding: 16px 32px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    min-height: 52px;
}

/* Full width */
.btn--full {
    width: 100%;
}

/* ===== FORMES ===== */

/* Arrondi complet (pill) */
.btn--pill {
    border-radius: var(--border-radius-full);
}

/* Carré */
.btn--square {
    border-radius: var(--border-radius-md);
}

/* Icône seule */
.btn--icon {
    padding: 16px;
    aspect-ratio: 1;
}

.btn--icon.btn--small {
    padding: 12px;
}

.btn--icon.btn--large {
    padding: 20px;
}

/* ===== GROUPES DE BOUTONS ===== */

.btn-group {
    display: inline-flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.btn-group--vertical {
    flex-direction: column;
}

.btn-group--center {
    justify-content: center;
}

.btn-group--end {
    justify-content: flex-end;
}

/* ===== LOADING STATE ===== */

.btn--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn--loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: btn-spin 0.6s linear infinite;
}

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

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
    .btn {
        font-size: var(--font-size-sm);
        padding: 12px 24px;
    }

    .btn--small,
    .btn--sm {
        font-size: 13px;
        padding: 10px 20px;
    }

    .btn--large,
    .btn--lg {
        font-size: var(--font-size-base);
        padding: 14px 28px;
    }
}
