/* ============================================
   SISTEMA DE BOTONES - LaCharocracia
   ============================================ */

/* Variables CSS para botones */
:root {
    /* Escala de padding */
    --btn-padding-xs: 4px 8px;
    --btn-padding-sm: 6px 12px;
    --btn-padding-md: 10px 16px;
    --btn-padding-lg: 14px 24px;
    --btn-padding-xl: 18px 32px;

    /* Escala de fuentes */
    --btn-font-xs: 0.5rem;
    --btn-font-sm: 0.6rem;
    --btn-font-md: 0.7rem;
    --btn-font-lg: 0.85rem;
    --btn-font-xl: 1rem;

    /* Colores de botón */
    --btn-bg-default: #3d3d3d;
    --btn-bg-hover: #555;
    --btn-border-default: #444;
    --btn-border-hover: var(--primary-red);
    --btn-text-default: white;

    /* Radios de borde */
    --btn-radius-sm: 4px;
    --btn-radius-md: 8px;
    --btn-radius-lg: 12px;
    --btn-radius-pill: 9999px;
}

/* ============================================
   CLASE BASE .btn
   ============================================ */

.btn {
    /* Reset y base */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    /* Tipografía */
    font-family: inherit;
    font-size: var(--btn-font-md);
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;

    /* Espaciado */
    padding: var(--btn-padding-md);

    /* Apariencia */
    background: var(--btn-bg-default);
    color: var(--btn-text-default);
    border: 2px solid var(--btn-border-default);
    border-radius: var(--btn-radius-md);

    /* Interacción */
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;

    /* Transiciones */
    transition: all 0.2s ease;

    /* Accesibilidad */
    min-height: 44px;
    min-width: 44px;
}

/* Estados del botón */
.btn:hover {
    background: var(--btn-bg-hover);
    border-color: var(--btn-border-hover);
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.98);
}

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

.btn:focus:not(:focus-visible) {
    outline: none;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    filter: grayscale(0.5);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

/* ============================================
   MODIFICADORES DE TAMAÑO
   ============================================ */

.btn--xs {
    padding: var(--btn-padding-xs);
    font-size: var(--btn-font-xs);
    min-height: 28px;
    min-width: 28px;
}

.btn--sm {
    padding: var(--btn-padding-sm);
    font-size: var(--btn-font-sm);
    min-height: 32px;
    min-width: 32px;
}

/* .btn--md es el tamaño por defecto */

.btn--lg {
    padding: var(--btn-padding-lg);
    font-size: var(--btn-font-lg);
    min-height: 48px;
}

.btn--xl {
    padding: var(--btn-padding-xl);
    font-size: var(--btn-font-xl);
    min-height: 56px;
}

/* ============================================
   VARIANTES DE COLOR
   ============================================ */

/* Primary (rojo PSOE) */
.btn--primary {
    background: var(--primary-red);
    border-color: #b30000;
}

.btn--primary:hover {
    background: #cc0000;
    border-color: #990000;
}

/* Secondary (gris claro) */
.btn--secondary {
    background: #e6e6e6;
    color: #666;
    border-color: #ccc;
}

.btn--secondary:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #999;
}

/* Ghost (transparente) */
.btn--ghost {
    background: transparent;
    border-color: white;
    color: white;
}

.btn--ghost:hover {
    background: white;
    color: #333;
}

/* Gold (ascensión) */
.btn--gold {
    background: linear-gradient(180deg, #d4af37, #b8962e);
    border-color: #8b6914;
    color: #2d1810;
}

.btn--gold:hover {
    background: linear-gradient(180deg, #e8c547, #d4af37);
    border-color: #6b4423;
}

/* Danger (rojo peligro) */
.btn--danger {
    background: #dc3545;
    border-color: #bd2130;
}

.btn--danger:hover {
    background: #c82333;
    border-color: #a71d2a;
}

/* Warning (naranja/amarillo) */
.btn--warning {
    background: linear-gradient(180deg, #f39c12, #e67e22);
    border-color: #d35400;
    color: #2d1810;
}

.btn--warning:hover {
    background: linear-gradient(180deg, #f1c40f, #f39c12);
    border-color: #e67e22;
}

.btn--warning:disabled {
    background: linear-gradient(180deg, #95a5a6, #7f8c8d);
    border-color: #6c7a7d;
    color: #555;
}

/* Purple (morado) */
.btn--purple {
    background: #9b59b6;
    border-color: #7d3c98;
}

.btn--purple:hover {
    background: #8e44ad;
    border-color: #6c3483;
}

/* Blue (azul) */
.btn--blue {
    background: #4a90d9;
    border-color: #3a7abd;
}

.btn--blue:hover {
    background: #5aa0e9;
    border-color: #4a90d9;
}

/* BCE (europeo) */
.btn--bce {
    background: linear-gradient(135deg, #003399, #0044aa);
    color: #ffcc00;
    border-color: #ffcc00;
}

.btn--bce:hover {
    background: linear-gradient(135deg, #0044aa, #0055bb);
    box-shadow: 0 2px 8px rgba(0, 51, 153, 0.4);
}

/* ============================================
   VARIANTES DE PARTIDOS
   ============================================ */

.btn--psoe {
    background: linear-gradient(135deg, #e60000 0%, #b30000 100%);
    border-color: white;
    color: white;
}

.btn--pp {
    background: linear-gradient(135deg, #0066cc 0%, #003d7a 100%);
    border-color: white;
    color: white;
}

.btn--vox {
    background: linear-gradient(135deg, #63be21 0%, #4a9518 100%);
    border-color: white;
    color: white;
}

.btn--podemos {
    background: linear-gradient(135deg, #7b297b 0%, #5a1f5a 100%);
    border-color: white;
    color: white;
}

/* ============================================
   MODIFICADORES DE FORMA
   ============================================ */

/* Circular */
.btn--circle {
    border-radius: 50%;
    padding: 0;
    width: 48px;
    height: 48px;
}

.btn--circle.btn--sm {
    width: 40px;
    height: 40px;
}

.btn--circle.btn--lg {
    width: 56px;
    height: 56px;
}

/* Pill (bordes redondeados) */
.btn--pill {
    border-radius: var(--btn-radius-pill);
}

/* Icono solo */
.btn--icon {
    padding: 8px;
    font-size: 1.3rem;
}

/* Ancho completo */
.btn--block {
    width: 100%;
    max-width: none;
}

/* ============================================
   EFECTO 3D (Start Screen)
   ============================================ */

.btn--3d {
    box-shadow: 0 6px 0 #cccccc;
    transform: translateY(0);
}

.btn--3d:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #cccccc;
}

.btn--3d:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #cccccc;
}

/* Variante primaria con efecto 3D */
.btn--3d.btn--primary {
    box-shadow: 0 6px 0 #990000;
}

.btn--3d.btn--primary:hover {
    box-shadow: 0 8px 0 #990000;
}

.btn--3d.btn--primary:active {
    box-shadow: 0 0 0 #990000;
}

/* Variante gold con efecto 3D */
.btn--3d.btn--gold {
    box-shadow: 0 6px 0 #6b4423;
}

.btn--3d.btn--gold:hover {
    box-shadow: 0 8px 0 #6b4423;
}

.btn--3d.btn--gold:active {
    box-shadow: 0 0 0 #6b4423;
}

/* ============================================
   BOTONES DE TOOLBAR
   ============================================ */

.btn--toolbar {
    width: 40px;
    height: 40px;
    border-radius: var(--btn-radius-md);
    padding: 0;
    font-size: 1.3rem;
    box-shadow: none;
}

.btn--toolbar:hover {
    transform: scale(1.1);
}

/* Colores específicos de toolbar */
.btn--toolbar-audio {
    background: #444;
}

.btn--toolbar-achievements {
    background: #8B7500;
}

.btn--toolbar-stats {
    background: #4a90d9;
}

.btn--toolbar-help {
    background: #9b59b6;
}

.btn--toolbar-ascension {
    background: linear-gradient(145deg, #8b6914, #d4af37);
    border-color: #4a3728;
}

.btn--toolbar-pause {
    background: #ffc107;
    border-color: #d39e00;
    color: #000;
}

.btn--toolbar-more {
    background: #3a3a3a;
    border-color: #555;
    color: #fff;
}

.btn--toolbar-more:hover {
    background: #4a4a4a;
    border-color: var(--primary-red);
}

.btn--toolbar-newgame {
    background: var(--primary-red);
}

.btn--toolbar-kofi {
    background: linear-gradient(135deg, #ff5f5f, #c41e3a);
    border-color: #a01020;
    animation: kofi-pulse 3s ease-in-out infinite;
    position: relative;
}

@keyframes kofi-pulse {
    0%, 70%, 100% { transform: scale(1); box-shadow: none; }
    75%, 85% { transform: scale(1.1); box-shadow: 0 0 15px 5px rgba(255, 95, 95, 0.6); }
}

/* Badge amarillo de notificación */
.btn--toolbar-kofi::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #ffcc00;
    border-radius: 50%;
    animation: badge-pulse 1.5s infinite;
}

@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Botón Ko-fi en victoria */
.btn--kofi-victory {
    background: linear-gradient(135deg, #ff5f5f, #c41e3a);
    border-color: #a01020;
    color: white;
    padding: 12px 24px;
    font-size: calc(0.75rem * var(--font-scale, 1));
    animation: kofi-pulse 3s ease-in-out infinite;
}

.btn--kofi-victory:hover {
    background: linear-gradient(135deg, #ff7070, #d42e4a);
    transform: scale(1.05);
}

/* Botón Ko-fi prominente (modal About) */
.btn--lg.btn--kofi-prominent {
    background: linear-gradient(135deg, #ff5f5f, #c41e3a);
    border-color: #a01020;
    color: white;
    display: inline-block;
    margin-top: 10px;
    animation: kofi-pulse 3s ease-in-out infinite;
}

/* ============================================
   BOTONES DE OVERLAY
   ============================================ */

.btn--overlay {
    padding: 15px 40px;
    font-size: calc(1rem * var(--font-scale, 1));
    border: 4px solid white;
    background: transparent;
    color: white;
}

.btn--overlay:hover {
    background: white;
    color: #333;
}

/* Variante progresista para derrota */
.btn--overlay-progresista {
    background: linear-gradient(135deg, #7b297b, #9b3a9b);
    border-color: #ffcc00;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 30px;
    white-space: normal;
}

.btn--overlay-progresista:hover {
    background: linear-gradient(135deg, #9b3a9b, #bb4abb);
    color: white;
}

.btn--overlay-progresista .btn-desc {
    font-size: calc(0.5rem * var(--font-scale, 1));
    opacity: 0.8;
    margin-top: 5px;
    display: block;
}

/* ============================================
   BOTONES DE EVENTO
   ============================================ */

.btn--event {
    padding: 15px 20px;
    border: 2px solid var(--primary-red);
    background: white;
    color: inherit;
    border-radius: var(--btn-radius-md);
    width: 100%;
}

.btn--event:hover {
    background: var(--primary-red);
    color: white;
    transform: none;
}

.btn--event:active {
    transform: scale(0.98);
}

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

.btn--event.disabled:hover {
    background: white;
    color: inherit;
}

/* ============================================
   BOTONES DE MULTIPLICADOR
   ============================================ */

.btn--multiplier {
    padding: 5px 10px;
    border: none;
    background: #555;
    color: white;
    border-radius: 3px;
    font-size: calc(0.55rem * var(--font-scale, 1));
    min-height: 32px;
    min-width: 40px;
}

.btn--multiplier:hover {
    background: #666;
    transform: none;
}

.btn--multiplier.active {
    background: var(--primary-red);
    box-shadow: 0 0 5px rgba(230, 0, 0, 0.5);
}

/* ============================================
   BOTONES DE PANEL
   ============================================ */

.btn--panel-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 0 5px;
    color: #666;
    min-width: 44px;
    min-height: 44px;
}

.btn--panel-close:hover {
    color: #333;
    background: none;
    transform: none;
}

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

@media (max-width: 480px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .btn--lg {
        padding: 12px 20px;
        font-size: calc(0.8rem * var(--font-scale, 1));
    }

    .btn--xl {
        padding: 15px 25px;
        font-size: calc(0.9rem * var(--font-scale, 1));
    }

    .btn--toolbar {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .btn--overlay {
        padding: 12px 30px;
        font-size: calc(0.8rem * var(--font-scale, 1));
    }

    .btn--multiplier {
        padding: 4px 6px;
        font-size: calc(0.45rem * var(--font-scale, 1));
        min-height: 28px;
        min-width: 32px;
    }
}
