/* ==========================================
   Sistema de Estadísticas Dominó - CSS
   Página de Comparación de Jugadores - VERSIÓN COMPACTA
   ========================================== */

/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales */
    --primary-green: #2d6a4f;
    --primary-green-dark: #1b4332;
    --primary-green-light: #40916c;
    --accent-green: #52b788;
    --background: #f8f9fa;
    --white: #ffffff;
    --text-dark: #212529;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --error-red: #dc3545;
    --success-green: #28a745;
    --warning-yellow: #ffc107;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Transiciones */
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Contenedor principal */
.container {
    margin: 5px 10px ;

    width: 100%;
    padding: 15px;
}

/* ==========================================
   HEADER
   ========================================== */
/* ==========================================
   HEADER - Compacto
   ========================================== */

.header {
    background: linear-gradient(135deg, #1e6b4f 0%, #145a40 100%);
    color: white;
    padding: 25px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
}

.header h1 {
    font-size: 2em;
    font-weight: 400;
    margin: 0;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1em;
    opacity: 0.9;
    margin-top: 5px;
    font-weight: 300;
}

/* ==========================================
   SECCIÓN DE COMPARACIÓN
   ========================================== */
.comparar-section {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.comparar-section h2 {
    color: var(--primary-green);
    font-size: 1.5rem;
    margin-bottom: 5px;
    font-weight: 300;
}

.comparar-section > p {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ==========================================
   FORMULARIO DE COMPARACIÓN
   ========================================== */
.comparar-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    color: var(--primary-green);
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.comparar-input {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--white);
}

.comparar-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.1);
}

.comparar-input::placeholder {
    color: #adb5bd;
}

.btn-comparar {
    padding: 10px 30px;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--primary-green-light) 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    height: fit-content;
}

.btn-comparar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-green-light) 0%, var(--accent-green) 100%);
}

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

/* ==========================================
   MENSAJES Y LOADING
   ========================================== */
.mensaje-error {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 0.9rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    gap: 12px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ==========================================
   RESULTADOS - TARJETAS DE JUGADORES (COMPACTO)
   ========================================== */
.comparar-resultados {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 25px;
}

.jugador-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.jugador-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-green);
}

/* Header de la tarjeta - COMPACTO */
.jugador-header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-light) 100%);
    color: var(--white);
    padding: 15px;
    text-align: center;
}

.jugador-header h3 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.jugador-pais {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    opacity: 0.95;
}

.bandera-icon {
    width: 22px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Estadísticas del jugador - COMPACTO Y CONSISTENTE */
.jugador-stats {
    padding: 15px;
}

/* Estadística por defecto (perdedora) - rojo suave */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #f8d7da 0%, #f8f9fa 100%);
    border-radius: 8px;
    transition: var(--transition);
    border-left: 3px solid #dc3545;
    min-height: 50px;
}

.stat-item:hover {
    background: #f5c2c7;
    transform: translateX(3px);
}

.stat-label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.4;
}

.stat-value {
    font-weight: 700;
    font-size: 1rem;
    color: #dc3545;
    line-height: 1.4;
}

/* Estadística destacada - la mejor - SOBRESCRIBE el rojo por defecto */
.stat-value.mejor-stat {
    color: var(--success-green);
    font-size: 1rem;
    animation: pulse 2s infinite;
}

.stat-item:has(.mejor-stat) {
    background: linear-gradient(90deg, #d4edda 0%, #f8f9fa 100%);
    border-left-color: var(--success-green);
    box-shadow: var(--shadow-sm);
}

.stat-item:has(.mejor-stat):hover {
    background: #c3e6cb;
}

/* Estadística destacada - la peor - MANTIENE el estilo por defecto */
.stat-value.peor-stat {
    color: #dc3545;
    font-size: 1rem;
}

.stat-item:has(.peor-stat) {
    background: linear-gradient(90deg, #f8d7da 0%, #f8f9fa 100%);
    border-left-color: #dc3545;
    box-shadow: var(--shadow-sm);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Efectividad especial - COMPACTO Y CONSISTENTE - Por defecto rojo (perdedor) */
.stat-item.efectividad {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
    border: 2px solid #dc3545;
    margin-top: 8px;
    padding: 14px 15px;
    min-height: 56px;
}

.stat-item.efectividad .stat-label {
    color: #721c24;
    font-size: 0.95rem;
}

.stat-item.efectividad .stat-value {
    font-size: 1.15rem;
    color: #dc3545;
}

/* Efectividad cuando es la mejor - SOBRESCRIBE el rojo */
.stat-item.efectividad:has(.mejor-stat) {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: var(--success-green);
}

.stat-item.efectividad:has(.mejor-stat) .stat-label {
    color: var(--primary-green-dark);
}

.stat-item.efectividad .stat-value.mejor-stat {
    font-size: 1.15rem;
    color: var(--success-green);
}

/* Efectividad cuando es la peor - MANTIENE estilo por defecto */
.stat-item.efectividad:has(.peor-stat) {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
    border-color: #dc3545;
}

.stat-item.efectividad .stat-value.peor-stat {
    font-size: 1.15rem;
    color: #dc3545;
}

/* ==========================================
   BOTÓN VOLVER
   ========================================== */
.back-button-container {
    text-align: center;
    margin: 30px 0 15px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 25px;
    background: var(--white);
    color: var(--primary-green);
    text-decoration: none;
    border: 2px solid var(--primary-green);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-back:hover {
    background: var(--primary-green);
    color: var(--white);
    transform: translateX(-3px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    background: linear-gradient(135deg, #1e6b4f 0%, #145a40 100%);
    color: white;
    padding: 25px 30px;
    margin: 10px 15px;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    font-weight: 500;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
}

.footer-link {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    font-weight: 400;
    font-size: 0.95em;
}

.footer-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.footer-link span {
    margin-right: 8px;
    font-size: 1.1em;
}

.footer-bottom {
    padding-top: 20px;

    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
}

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

/* Tablets */
@media (max-width: 1024px) {
    .header h1 {
        font-size: 1.6rem;
    }
    
    .comparar-form {
        grid-template-columns: 1fr;
    }
    
    .btn-comparar {
        width: 100%;
    }
    
    .comparar-resultados {
        gap: 15px;
    }
}

/* Móviles */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .header p {
        font-size: 0.85rem;
    }
    
    .comparar-section {
        padding: 18px 15px;
    }
    
    .comparar-section h2 {
        font-size: 1.3rem;
    }
    
    .comparar-resultados {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .jugador-header h3 {
        font-size: 1.05rem;
    }
    
    .stat-item {
        padding: 11px 12px;
        min-height: 48px;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    .stat-value {
        font-size: 0.95rem;
    }
    
    .stat-item.efectividad {
        padding: 13px 12px;
        min-height: 52px;
    }
    
    .stat-item.efectividad .stat-value {
        font-size: 1.1rem;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.25rem;
    }
    
    .comparar-input {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .btn-comparar {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .jugador-header {
        padding: 12px;
    }
    
    .jugador-stats {
        padding: 12px;
    }
    
    .stat-item {
        padding: 10px 12px;
        min-height: 46px;
    }
    
    .stat-item.efectividad {
        padding: 12px;
        min-height: 50px;
    }
}

/* ==========================================
   ANIMACIONES ADICIONALES
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comparar-resultados {
    animation: fadeIn 0.5s ease-out;
}

.jugador-card {
    animation: fadeIn 0.6s ease-out;
}

.jugador-card:nth-child(2) {
    animation-delay: 0.1s;
}

/* ==========================================
   MODO IMPRESIÓN
   ========================================== */
@media print {
    body {
        background: white;
    }
    
    .btn-comparar,
    .btn-back,
    .footer {
        display: none;
    }
    
    .jugador-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}