/**
 * BOCID Button System - Style simplifié 2025.12.14
 * Design glassmorphism épuré en accord avec le système BOCID
 *
 * @author BOCID Team
 * @version 2025.12.14
 * @requires bocid-variables.css
 */

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

.bocid-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    /* Taille */
    min-height: 40px;
    padding: 0.5rem 1.25rem;

    /* Typography */
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;

    /* Style glassmorphism */
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-medium);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Interactions */
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    outline: none;
}

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

.bocid-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =============================================================================
   TAILLES
   ============================================================================= */

.bocid-btn-xs {
    min-height: 28px;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: var(--radius-small);
}

.bocid-btn-sm {
    min-height: 32px;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-small);
}

.bocid-btn-lg {
    min-height: 48px;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.bocid-btn-xl {
    min-height: 56px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* =============================================================================
   VARIANTE PRIMARY - Bleu electrique Radix
   ============================================================================= */

.bocid-btn-primary {
    background: #0090ff;
    color: #ffffff;
    border-color: #0090ff;
}

.bocid-btn-primary:hover:not(:disabled) {
    background: #0072cc;
    border-color: #0072cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 144, 255, 0.4);
}

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

/* =============================================================================
   VARIANTE SECONDARY - Gris neutre Radix
   ============================================================================= */

.bocid-btn-secondary {
    background: #6e7681;
    color: #ffffff;
    border-color: #6e7681;
}

.bocid-btn-secondary:hover:not(:disabled) {
    background: #57606a;
    border-color: #57606a;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(110, 118, 129, 0.4);
}

/* =============================================================================
   VARIANTE SUCCESS - Vert naturel Radix
   ============================================================================= */

.bocid-btn-success {
    background: #46a758;
    color: #ffffff;
    border-color: #46a758;
}

.bocid-btn-success:hover:not(:disabled) {
    background: #3d9a4e;
    border-color: #3d9a4e;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(70, 167, 88, 0.4);
}

/* =============================================================================
   VARIANTE DANGER - Rouge coral Radix
   ============================================================================= */

.bocid-btn-danger {
    background: #e5484d;
    color: #ffffff;
    border-color: #e5484d;
}

.bocid-btn-danger:hover:not(:disabled) {
    background: #ce3e42;
    border-color: #ce3e42;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 72, 77, 0.4);
}

/* =============================================================================
   VARIANTE WARNING - Ambre dore Radix
   ============================================================================= */

.bocid-btn-warning {
    background: #ffb224;
    color: #ffffff;
    border-color: #ffb224;
}

.bocid-btn-warning:hover:not(:disabled) {
    background: #e5a01f;
    border-color: #e5a01f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 178, 36, 0.4);
}

/* =============================================================================
   VARIANTE INFO - Cyan ocean Radix
   ============================================================================= */

.bocid-btn-info {
    background: #00a2c7;
    color: #ffffff;
    border-color: #00a2c7;
}

.bocid-btn-info:hover:not(:disabled) {
    background: #0090b0;
    border-color: #0090b0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 162, 199, 0.4);
}

/* =============================================================================
   VARIANTES OUTLINE - Transparent avec bordure
   ============================================================================= */

.bocid-btn-outline-primary {
    background: transparent;
    color: #0090ff;
    border-color: #0090ff;
}

.bocid-btn-outline-primary:hover:not(:disabled) {
    background: rgba(0, 144, 255, 0.1);
    color: #0072cc;
}

.bocid-btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.bocid-btn-outline-secondary:hover:not(:disabled) {
    background: var(--bg-item-hover);
    color: var(--text-primary);
}

.bocid-btn-outline-success {
    background: transparent;
    color: #46a758;
    border-color: #46a758;
}

.bocid-btn-outline-success:hover:not(:disabled) {
    background: rgba(70, 167, 88, 0.1);
    color: #3d9a4e;
}

.bocid-btn-outline-danger {
    background: transparent;
    color: #e5484d;
    border-color: #e5484d;
}

.bocid-btn-outline-danger:hover:not(:disabled) {
    background: rgba(229, 72, 77, 0.1);
    color: #ce3e42;
}

.bocid-btn-outline-warning {
    background: transparent;
    color: #ffb224;
    border-color: #ffb224;
}

.bocid-btn-outline-warning:hover:not(:disabled) {
    background: rgba(255, 178, 36, 0.1);
    color: #e5a01f;
}

.bocid-btn-outline-info {
    background: transparent;
    color: #00a2c7;
    border-color: #00a2c7;
}

.bocid-btn-outline-info:hover:not(:disabled) {
    background: rgba(0, 162, 199, 0.1);
    color: #0090b0;
}

/* =============================================================================
   VARIANTE GHOST - Transparent minimal
   ============================================================================= */

.bocid-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-primary);
}

.bocid-btn-ghost:hover:not(:disabled) {
    background: var(--bg-item-hover);
}

.bocid-btn-ghost-primary {
    background: transparent;
    border-color: transparent;
    color: #0090ff;
}

.bocid-btn-ghost-primary:hover:not(:disabled) {
    background: rgba(0, 144, 255, 0.1);
}

/* =============================================================================
   DARK MODE - Boutons solid -> outline automatique
   ============================================================================= */

/* Primary : solid -> outline en dark mode */
body.dark-mode .bocid-btn-primary {
    background: transparent;
    color: #52a9ff;
    border-color: #52a9ff;
}

body.dark-mode .bocid-btn-primary:hover:not(:disabled) {
    background: rgba(82, 169, 255, 0.15);
    color: #7ec2ff;
    border-color: #7ec2ff;
    box-shadow: 0 4px 14px rgba(82, 169, 255, 0.25);
}

/* Secondary : solid -> outline en dark mode */
body.dark-mode .bocid-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

body.dark-mode .bocid-btn-secondary:hover:not(:disabled) {
    background: var(--bg-item-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
    box-shadow: none;
}

/* Success : solid -> outline en dark mode */
body.dark-mode .bocid-btn-success {
    background: transparent;
    color: #5ccc6e;
    border-color: #5ccc6e;
}

body.dark-mode .bocid-btn-success:hover:not(:disabled) {
    background: rgba(92, 204, 110, 0.15);
    color: #7ddb8b;
    border-color: #7ddb8b;
    box-shadow: 0 4px 14px rgba(92, 204, 110, 0.25);
}

/* Danger : solid -> outline en dark mode */
body.dark-mode .bocid-btn-danger {
    background: transparent;
    color: #f87171;
    border-color: #f87171;
}

body.dark-mode .bocid-btn-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
    border-color: #fca5a5;
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.25);
}

/* Warning : solid -> outline en dark mode */
body.dark-mode .bocid-btn-warning {
    background: transparent;
    color: #ffc94d;
    border-color: #ffc94d;
}

body.dark-mode .bocid-btn-warning:hover:not(:disabled) {
    background: rgba(255, 201, 77, 0.15);
    color: #ffd97a;
    border-color: #ffd97a;
    box-shadow: 0 4px 12px rgba(255, 201, 77, 0.25);
}

/* Info : solid -> outline en dark mode */
body.dark-mode .bocid-btn-info {
    background: transparent;
    color: #22d3ee;
    border-color: #22d3ee;
}

body.dark-mode .bocid-btn-info:hover:not(:disabled) {
    background: rgba(34, 211, 238, 0.15);
    color: #67e8f9;
    border-color: #67e8f9;
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.25);
}

/* =============================================================================
   DARK MODE - Variantes outline (restent outline mais couleurs adaptees)
   ============================================================================= */

body.dark-mode .bocid-btn-outline-primary {
    color: #52a9ff;
    border-color: #52a9ff;
}

body.dark-mode .bocid-btn-outline-primary:hover:not(:disabled) {
    background: rgba(82, 169, 255, 0.15);
    color: #7ec2ff;
}

body.dark-mode .bocid-btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

body.dark-mode .bocid-btn-outline-secondary:hover:not(:disabled) {
    background: var(--bg-item-hover);
    color: var(--text-primary);
}

body.dark-mode .bocid-btn-outline-success {
    color: #5ccc6e;
    border-color: #5ccc6e;
}

body.dark-mode .bocid-btn-outline-success:hover:not(:disabled) {
    background: rgba(92, 204, 110, 0.15);
    color: #7ddb8b;
}

body.dark-mode .bocid-btn-outline-danger {
    color: #f87171;
    border-color: #f87171;
}

body.dark-mode .bocid-btn-outline-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
}

body.dark-mode .bocid-btn-outline-warning {
    color: #ffc94d;
    border-color: #ffc94d;
}

body.dark-mode .bocid-btn-outline-warning:hover:not(:disabled) {
    background: rgba(255, 201, 77, 0.15);
    color: #ffd97a;
}

body.dark-mode .bocid-btn-outline-info {
    color: #22d3ee;
    border-color: #22d3ee;
}

body.dark-mode .bocid-btn-outline-info:hover:not(:disabled) {
    background: rgba(34, 211, 238, 0.15);
    color: #67e8f9;
}

body.dark-mode .bocid-btn-ghost-primary {
    color: #52a9ff;
}

body.dark-mode .bocid-btn-ghost-primary:hover:not(:disabled) {
    background: rgba(82, 169, 255, 0.15);
}

/* =============================================================================
   BOUTONS SPÉCIAUX
   ============================================================================= */

/* Bouton icône seulement */
.bocid-btn-icon-only {
    min-width: auto;
    padding: 0.5rem;
    aspect-ratio: 1;
}

.bocid-btn-icon-only.bocid-btn-sm {
    padding: 0.375rem;
}

.bocid-btn-icon-only.bocid-btn-lg {
    padding: 0.75rem;
}

/* Bouton pleine largeur */
.bocid-btn-block {
    width: 100%;
    justify-content: center;
}

/* Bouton de fermeture */
.bocid-btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: var(--bg-item-hover);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bocid-btn-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* =============================================================================
   GROUPE DE BOUTONS
   ============================================================================= */

.bocid-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bocid-btn-group-attached {
    display: inline-flex;
    align-items: center;
}

.bocid-btn-group-attached .bocid-btn {
    border-radius: 0;
    margin-left: -1px;
}

.bocid-btn-group-attached .bocid-btn:first-child {
    border-top-left-radius: var(--radius-medium);
    border-bottom-left-radius: var(--radius-medium);
    margin-left: 0;
}

.bocid-btn-group-attached .bocid-btn:last-child {
    border-top-right-radius: var(--radius-medium);
    border-bottom-right-radius: var(--radius-medium);
}

/* =============================================================================
   DROPDOWN TOGGLE
   ============================================================================= */

.bocid-btn.dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.5rem;
    content: "";
    border-top: 0.25rem solid;
    border-right: 0.25rem solid transparent;
    border-left: 0.25rem solid transparent;
    transition: transform 0.15s ease;
}

.bocid-btn.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.bocid-btn.dropdown-toggle-split {
    padding-right: 0.625rem;
    padding-left: 0.625rem;
}

.bocid-btn.dropdown-toggle-split::after {
    margin-left: 0;
}

/* =============================================================================
   ÉTATS SPÉCIAUX
   ============================================================================= */

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

.bocid-btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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

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

@media (max-width: 576px) {
    .bocid-btn {
        min-height: 44px; /* WCAG mobile */
    }

    .bocid-btn-mobile-block {
        width: 100%;
    }

    .bocid-btn-group {
        gap: 0.375rem;
    }
}

/* =============================================================================
   ACCESSIBILITÉ
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .bocid-btn {
        transition: none;
    }

    .bocid-btn:hover:not(:disabled) {
        transform: none;
    }

    .bocid-btn-loading::after {
        animation: none;
    }
}

/* =============================================================================
   COMPATIBILITÉ BOOTSTRAP
   ============================================================================= */

.bocid-btn.btn {
    background: unset;
    border: unset;
    color: unset;
    padding: unset;
    box-shadow: unset;
}
