/**
 * Estilos Mundial 2026 Prode
 * Diseño mobile-first, responsivo
 */

/* Reset y variables */
:root {
    --primary-color: #1a472a;
    --secondary-color: #b8860b;
    --accent-color: #c41e3a;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #dddddd;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Asegurar que imágenes sean responsive */
img, svg, video {
    max-width: 100%;
    height: auto;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), #2d5a3d);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    display: flex;
    gap: 1rem;
    list-style: none;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-menu li {
    flex-shrink: 0;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
    display: block;
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.1);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

/* Formularios */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

.form-checkbox {
    margin-right: 0.5rem;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #0f2918;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Partidos */
.partido-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.partido-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.partido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.partido-fecha {
    font-weight: 500;
}

.partido-fase {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

.partido-equipos {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.equipo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.equipo-derecha {
    flex-direction: row-reverse;
    text-align: right;
}

.bandera {
    width: 40px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
}

.equipo-nombre {
    font-weight: 500;
}

.vs {
    color: var(--text-light);
    font-weight: bold;
}

.pronostico-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
}

.pronostico-input {
    width: 100%;
    text-align: center;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: bold;
}

.pronostico-separator {
    font-size: 1.5rem;
    color: var(--text-light);
}

.partido-bloqueado {
    opacity: 0.7;
    background: #f9f9f9;
}

.mensaje-bloqueado {
    text-align: center;
    color: var(--warning-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Resultado final */
.resultado {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.puntos-badge {
    display: inline-block;
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Tabla de posiciones */
.tabla-posiciones {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.tabla-posiciones thead {
    background: var(--primary-color);
    color: white;
}

.tabla-posiciones th,
.tabla-posiciones td {
    padding: 0.75rem;
    text-align: left;
}

.tabla-posiciones tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.tabla-posiciones tbody tr:hover {
    background: rgba(26, 71, 42, 0.05);
}

.posicion {
    font-weight: bold;
    color: var(--secondary-color);
}

/* Wrapper responsive para tablas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), #2d5a3d);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

/* Grupos */
.grupos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.grupo-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1rem;
    border: 2px solid var(--primary-color);
}

.grupo-header {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 1rem;
}

.grupo-equipos {
    list-style: none;
}

.grupo-equipos li {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grupo-equipos li:last-child {
    border-bottom: none;
}

/* Responsivo - Mobile */
@media (max-width: 767px) {
    /* Navegación */
    .nav-menu {
        gap: 0.5rem;
        width: 100%;
    }
    
    .nav-menu a {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .header-content {
        gap: 0.5rem;
    }
    
    /* Cards y contenedores */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .card-header {
        font-size: 1.1rem;
    }
    
    /* Partido cards */
    .partido-card {
        padding: 0.75rem;
    }
    
    .partido-equipos {
        gap: 0.5rem;
        grid-template-columns: 1fr auto 1fr;
    }
    
    .equipo-nombre {
        font-size: 0.9rem;
    }
    
    .bandera {
        width: 30px;
    }
    
    .vs {
        font-size: 0.85rem;
    }
    
    .partido-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .partido-fase {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* Inputs de pronósticos */
    .pronostico-inputs {
        gap: 0.25rem;
    }
    
    .pronostico-input {
        width: 50px;
        padding: 0.5rem 0.25rem;
        font-size: 1rem;
    }
    
    .pronostico-separator {
        font-size: 1rem;
    }
    
    /* Tablas */
    .tabla-posiciones {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tabla-posiciones thead,
    .tabla-posiciones tbody,
    .tabla-posiciones tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .tabla-posiciones th,
    .tabla-posiciones td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    /* Botones */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-full {
        width: 100%;
    }
    
    /* Formularios */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-input,
    .form-select {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Estadísticas */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Filtros */
    .filtros {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filtros select {
        width: 100%;
    }
    
    /* Login */
    .login-card {
        padding: 1.5rem;
        width: 100%;
        max-width: none;
    }
    
    /* Perfil */
    .perfil-info {
        grid-template-columns: 1fr !important;
    }
    
    /* Admin dashboard */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
    }
    
    /* Tabla de usuarios en admin */
    .tabla-usuarios {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ocultar columnas menos importantes en móvil */
    .hide-mobile {
        display: none !important;
    }
}

/* Responsivo - Tablet */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }
    
    .partido-equipos {
        gap: 2rem;
    }
    
    .nav-menu {
        margin-top: 0;
        font-size: 1rem;
    }
    
    .nav-menu a {
        font-size: 1rem;
    }
}

/* Responsivo - Desktop */
@media (min-width: 1024px) {
    .partidos-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Utilidades */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Loading spinner */
.spinner {
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top: 3px solid var(--primary-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 3rem;
}

/* Clases auxiliares adicionales para responsive */
.w-100 {
    width: 100% !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.word-break {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Ocultar en desktop, mostrar en móvil */
.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
}

/* Touch-friendly sizing for mobile */
@media (max-width: 767px) {
    button, .btn, a.btn, input[type="submit"] {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    input, select, textarea {
        min-height: 44px;
    }
}
