/**
 * Estilos Base de Botones - Centralizados
 * Evita duplicación y conflictos entre componentes
 */

/* ========================================
   ESTILOS BASE PARA BOTONES
   ======================================== */

.btn-base {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn-base:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.btn-base:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   VARIANTES DE TAMAÑO
   ======================================== */

.btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    min-height: 28px;
}

.btn-md {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
    min-height: 36px;
}

.btn-lg {
    padding: 12px 20px;
    font-size: var(--font-size-base);
    min-height: 44px;
}

/* ========================================
   VARIANTES DE COLOR
   ======================================== */

.btn-primary {
    background: var(--btn-primary-bg);
    color: white;
    border: 1px solid var(--btn-primary-bg);
}

.btn-primary:hover:not(:disabled) {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--control-hover);
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--btn-success-bg);
    color: white;
    border: 1px solid var(--btn-success-bg);
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--btn-warning-bg);
    color: white;
    border: 1px solid var(--btn-warning-bg);
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--btn-danger-bg);
    color: white;
    border: 1px solid var(--btn-danger-bg);
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-1px);
}

/* ========================================
   VARIANTES ESPECIALES
   ======================================== */

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--control-hover);
    border-color: var(--border-light);
}

.btn-outline {
    background: transparent;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-blue);
    color: white;
}

/* ========================================
   ESTADOS ESPECIALES
   ======================================== */

.btn-loading {
    pointer-events: none;
    position: relative;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: btn-spin 1s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-active {
    background: var(--control-active);
    color: white;
    border-color: var(--control-active);
}

/* ========================================
   ICONOS EN BOTONES
   ======================================== */

.btn-icon-left {
    gap: 8px;
}

.btn-icon-right {
    gap: 8px;
    flex-direction: row-reverse;
}

.btn-icon-only {
    padding: 8px;
    width: var(--control-height);
    height: var(--control-height);
}

/* ========================================
   GRUPOS DE BOTONES
   ======================================== */

.btn-group {
    display: flex;
    gap: 0;
}

.btn-group .btn-base {
    border-radius: 0;
}

.btn-group .btn-base:first-child {
    border-top-left-radius: var(--border-radius-md);
    border-bottom-left-radius: var(--border-radius-md);
}

.btn-group .btn-base:last-child {
    border-top-right-radius: var(--border-radius-md);
    border-bottom-right-radius: var(--border-radius-md);
}

.btn-group .btn-base:not(:last-child) {
    border-right: none;
}

/* ========================================
   RESPONSIVIDAD
   ======================================== */

@media (max-width: 768px) {
    .btn-base {
        min-height: 44px; /* Tamaño táctil mínimo */
        min-width: 44px;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 8px 12px;
    }
}