/**
 * DORA Design System - Boutons Unifiés
 * Version: 2.0
 *
 * 4 variantes de boutons au lieu de 15+:
 * - .btn-cta      : CTA principal orange (conversion)
 * - .btn-primary  : Bouton primaire gradient bleu/violet
 * - .btn-secondary: Bouton secondaire outline
 * - .btn-ghost    : Bouton ghost pour navigation
 *
 * Tailles: .btn-sm, .btn-lg
 * Variantes: .btn-block (full width)
 */

/* ========================================
   BASE BUTTON
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--duration-moderate) var(--ease-in-out);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

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

/* Icon spacing */
.btn i,
.btn svg {
    font-size: 1.1em;
    transition: transform var(--duration-fast) var(--ease-out);
}

.btn:hover i,
.btn:hover svg {
    transform: translateX(3px);
}

/* ========================================
   CTA PRINCIPAL - Orange Conversion
   Le bouton le plus important pour les conversions
   ======================================== */
.btn-cta {
    background: var(--gradient-cta);
    color: var(--color-white);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    border: none;
    box-shadow: var(--shadow-cta);
    position: relative;
    overflow: hidden;
}

.btn-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left var(--duration-slow) var(--ease-out);
}

.btn-cta:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-cta-hover);
}

.btn-cta:hover::before {
    left: 100%;
}

.btn-cta:active {
    transform: translateY(-1px);
}

.btn-cta:focus-visible {
    outline: 3px solid var(--color-cta-300);
    outline-offset: 3px;
}

/* Animation pulse optionnelle pour CTA */
.btn-cta.pulse {
    animation: pulse-cta 2s infinite;
}

@keyframes pulse-cta {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 107, 53, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
    }
}

/* ========================================
   BOUTON PRIMAIRE - Gradient Bleu/Violet
   Pour les actions principales
   ======================================== */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--color-white);
    padding: var(--space-3) var(--space-8);
    border-radius: var(--radius-xl);
    font-weight: var(--font-semibold);
    border: none;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 45px rgba(39, 76, 119, 0.4);
    filter: brightness(1.05);
}

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

.btn-primary:focus-visible {
    outline: 3px solid var(--color-primary-300);
    outline-offset: 3px;
}

/* ========================================
   BOUTON SECONDAIRE - Outline
   Pour les actions secondaires
   ======================================== */
.btn-secondary {
    background: transparent;
    color: var(--color-primary-600);
    padding: var(--space-3) var(--space-8);
    border-radius: var(--radius-xl);
    border: 2px solid var(--color-primary-500);
    font-weight: var(--font-semibold);
}

.btn-secondary:hover {
    background: var(--color-primary-600);
    border-color: var(--color-primary-600);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

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

.btn-secondary:focus-visible {
    outline: 3px solid var(--color-primary-300);
    outline-offset: 3px;
}

/* Variante sur fond sombre */
.btn-secondary.on-dark {
    color: var(--color-white);
    border-color: var(--color-white);
}

.btn-secondary.on-dark:hover {
    background: var(--color-white);
    color: var(--color-primary-700);
}

/* ========================================
   BOUTON GHOST - Navigation/Liens
   Pour les actions tertiaires
   ======================================== */
.btn-ghost {
    background: transparent;
    color: var(--color-neutral-700);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    border: none;
    font-weight: var(--font-medium);
}

.btn-ghost:hover {
    background: var(--color-neutral-100);
    color: var(--color-primary-600);
}

.btn-ghost:active {
    background: var(--color-neutral-200);
}

.btn-ghost:focus-visible {
    outline: 2px solid var(--color-primary-400);
    outline-offset: 2px;
}

/* Variante sur fond sombre */
.btn-ghost.on-dark {
    color: var(--text-on-dark-secondary);
}

.btn-ghost.on-dark:hover {
    background: var(--glass-bg-light);
    color: var(--color-white);
}

/* ========================================
   TAILLES
   ======================================== */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    border-radius: var(--radius-lg);
    gap: var(--space-1);
}

.btn-lg {
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-xl);
    border-radius: var(--radius-2xl);
    gap: var(--space-3);
}

/* CTA tailles */
.btn-cta.btn-sm {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

.btn-cta.btn-lg {
    padding: var(--space-5) var(--space-12);
    font-size: var(--text-xl);
}

/* ========================================
   VARIANTES
   ======================================== */

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

/* Avec icône seulement */
.btn-icon {
    padding: var(--space-3);
    border-radius: var(--radius-full);
}

.btn-icon.btn-sm {
    padding: var(--space-2);
}

.btn-icon.btn-lg {
    padding: var(--space-4);
}

/* Loading state */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 1.25em;
    height: 1.25em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.75s linear infinite;
}

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

/* ========================================
   GROUPE DE BOUTONS
   ======================================== */
.btn-group {
    display: inline-flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

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

/* ========================================
   MICRO-COPY SOUS CTA
   ======================================== */
.cta-micro-copy {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-on-dark-muted);
    text-align: center;
}

.cta-micro-copy i {
    margin-right: var(--space-1);
    font-size: 0.9em;
}

/* Version sur fond clair */
.cta-micro-copy.on-light {
    color: var(--color-neutral-500);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .btn {
        padding: var(--space-3) var(--space-5);
    }

    .btn-cta {
        padding: var(--space-4) var(--space-6);
        font-size: var(--text-base);
    }

    .btn-lg {
        padding: var(--space-4) var(--space-8);
        font-size: var(--text-lg);
    }

    /* Stack sur mobile */
    .btn-group-mobile-stack {
        flex-direction: column;
        width: 100%;
    }

    .btn-group-mobile-stack .btn {
        width: 100%;
    }
}

/* ========================================
   LEGACY COMPATIBILITY
   Classes pour migration progressive
   ======================================== */

/* Ancien .dora-cta-button -> nouveau .btn-cta */
.dora-cta-button {
    background: var(--gradient-cta);
    color: var(--color-white);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    border: none;
    box-shadow: var(--shadow-cta);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
    transition: all var(--duration-moderate) var(--ease-in-out);
    cursor: pointer;
}

.dora-cta-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-cta-hover);
}

/* Ancien .cta-button -> nouveau .btn-primary */
.cta-button {
    background: var(--gradient-primary);
    color: var(--color-white);
    padding: var(--space-3) var(--space-8);
    border-radius: var(--radius-xl);
    font-weight: var(--font-semibold);
    border: none;
    box-shadow: var(--shadow-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
    transition: all var(--duration-moderate) var(--ease-in-out);
    cursor: pointer;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 45px rgba(39, 76, 119, 0.4);
}

/* Ancien .saas-cta-button */
.saas-cta-button {
    background: var(--gradient-cta);
    color: var(--color-white);
    padding: var(--space-4) var(--space-10);
    border-radius: var(--radius-full);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-cta);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
    transition: all var(--duration-moderate) var(--ease-in-out);
    cursor: pointer;
}

.saas-cta-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-cta-hover);
}
