/**
 * BUSCAMINAS - ESTILOS PRINCIPALES
 * ================================
 * 
 * Hoja de estilos principal que contiene:
 * - Estilos base y tipografía
 * - Navegación y header
 * - Layout responsive
 * - Tema oscuro/claro
 * - Componentes generales
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500&display=swap');

/* ====================================
   ESTILOS BASE Y TIPOGRAFÍA
   ==================================== */

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', Arial, sans-serif;
    overflow-x: hidden;
    width: 100%;
}

/* ====================================
   NAVEGACIÓN Y HEADER
   ==================================== */

header {
    background-color: #009688; /* Verde moderno */
    width: 100%;
    left: 0;
    top: 0;
    position: relative;
    box-shadow: none;
    padding: 0;
    margin: 0;
}
nav {
    background-color: #009688;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 30px;
    height: 60px;
    position: relative;
    width: 100%;
    margin: 0;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 60px;
    gap: 40px;
    box-sizing: border-box;
}

nav ul li {
    margin: 0;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1em;
    padding: 8px 18px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

nav ul li a:hover {
    background: #fff;
    color: #222;
}

/* Estilos para el botón de tema en la navegación */
nav ul li button {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1em;
    padding: 8px 18px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

nav ul li button:hover {
    background: #fff;
    color: #222;
}


/* Estilos para el formulario de contacto */
main {
    max-width: 500px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}
form label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
}
form input, form textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}
form textarea {
    min-height: 100px;
    resize: vertical;
}
form button {
    margin-top: 20px;
    padding: 10px 20px;
    background: #009688;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
form button:hover {
    background: #00796b;
    color: #fff;
}

#nombre-container {
    text-align: center;
    margin-bottom: 20px;
}
#nombre-jugador {
    padding: 8px;
    font-size: 1em;
    border-radius: 4px;
    border: 1px solid #ccc;
}
#comenzar-juego {
    padding: 8px 18px;
    font-size: 1em;
    margin-left: 10px;
    border-radius: 4px;
    border: none;
    background: #009688;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
#comenzar-juego:hover {
    background: #00796b;
}
#error-nombre, #error-email, #error-mensaje {
    color: red;
    display: none;
    font-size: 0.95em;
    margin-bottom: 8px;
}
#mensaje-enviado {
    display: none;
    color: #009688;
    margin-top: 20px;
    font-weight: bold;
}
#tablero {
    display: none;
}
#reiniciar {
    display: none;
}
.resultados-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  margin-top: 40px;
}

.historial, .ranking {
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 8px;
  padding: 20px;
  max-width: 300px;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.historial h2, .ranking h2 {
  margin-top: 0;
  color: #009688;
  text-align: center;
  font-size: 1.3em;
}

#lista-historial, #lista-ranking {
  list-style: none;
  padding: 0;
  margin: 0;
}

#lista-historial li, #lista-ranking li {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 0.95em;
}
.boton-estadisticas {
    display: block;
    margin: 20px auto;
    padding: 10px 24px;
    background: #009688;
    color: #fff;
    text-align: center;
    font-weight: bold;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
}

.boton-estadisticas:hover {
    background: #00796b;
}

/* Modo oscuro */
body.tema-oscuro {
    background-color: #121212;
    color: #f1f1f1;
}

body.tema-oscuro main {
    background: #1e1e1e;
    box-shadow: 0 2px 8px rgba(255,255,255,0.05);
}

body.tema-oscuro nav ul li a {
    color: #f1f1f1;
}

body.tema-oscuro nav ul li a:hover {
    background: #f1f1f1;
    color: #121212;
}

body.tema-oscuro nav ul li button {
    color: #f1f1f1;
}

body.tema-oscuro nav ul li button:hover {
    background: #f1f1f1;
    color: #121212;
}

body.tema-oscuro .buscaminas-tabla {
    background: #333;
}

body.tema-oscuro .celda {
    background: #444;
    border: 2px solid #777;
    color: #eee;
}

body.tema-oscuro .celda.abierta {
    background: #1e1e1e;
    border: 2px solid #666;
    color: #fff;
}

body.tema-oscuro .modal-contenido {
    background: #2e2e2e;
    color: #f1f1f1;
}

body.tema-oscuro #contador-minas {
    background: #4e342e;
    border-color: #ffcc02;
    color: #ffccbc;
}

body.tema-oscuro #temporizador {
    background: #263238;
    color: #80deea;
}

body.tema-oscuro .boton-nivel {
    background: #444;
    color: #ccc;
}

body.tema-oscuro .boton-nivel:hover {
    background: #666;
    color: #fff;
}

body.tema-oscuro .boton-nivel.activo {
    background: #26a69a;
    color: #fff;
}

/* Media Queries para Responsive Mobile */
@media (max-width: 768px) {
    /* Navegación responsive */
    nav {
        height: auto;
        padding: 10px 20px;
    }
    
    nav ul {
        flex-direction: column;
        gap: 8px;
        padding: 10px 0;
        min-height: auto;
        width: 100%;
    }
    
    nav ul li {
        margin: 2px 0;
        width: 100%;
        text-align: center;
    }
    
    nav ul li a,
    nav ul li button {
        font-size: 1em;
        padding: 12px 20px;
        min-width: 150px;
        display: inline-block;
        width: 100%;
        max-width: 200px;
    }
    
    /* Main container */
    main {
        max-width: 95%;
        margin: 20px auto;
        padding: 20px;
    }
    
    /* Formularios */
    form input, 
    form textarea {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 12px;
    }
    
    /* Evitar zoom en inputs en iOS */
    input[type="text"],
    input[type="email"],
    textarea {
        font-size: 16px !important;
    }
    
    /* Botones */
    #comenzar-juego,
    form button {
        padding: 12px 24px;
        font-size: 1em;
        min-height: 44px; /* Tamaño mínimo para touch */
    }
    
    /* Contenedor de nombre */
    #nombre-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    #nombre-jugador {
        width: 100%;
        max-width: 300px;
        padding: 12px;
        font-size: 16px;
    }
    
    #comenzar-juego {
        margin-left: 0;
        margin-top: 10px;
    }
    
    /* Título */
    .titulo-buscaminas {
        font-size: 2em;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    /* Navegación para pantallas muy pequeñas */
    nav {
        padding: 8px 15px;
    }
    
    nav ul {
        gap: 6px;
        padding: 8px 0;
    }
    
    nav ul li a,
    nav ul li button {
        font-size: 0.9em;
        padding: 10px 16px;
        min-width: 120px;
        max-width: 180px;
    }
    
    /* Main container */
    main {
        max-width: 98%;
        margin: 15px auto;
        padding: 15px;
    }
    
    /* Título */
    .titulo-buscaminas {
        font-size: 1.8em;
        margin-top: 15px;
    }
}