/* ---
 * Hoja de Estilos Principal - Concurso Claro
 --- */

/* 1. Globales y Reseteo
-------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial,
        sans-serif;
    background-color: #ffffff; /* Fondo blanco para Claro */
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* Override para páginas admin */
body.admin-page {
    display: block;
    padding: 0;
    background-color: #f8f9fa;
}

/* 2. Contenedor Principal (La "Tarjeta" Blanca)
-------------------------------------------------- */
main.container {
    max-width: 100%; /* Ancho completo */
    width: 100%;
    margin: 0 auto;
    padding: 0; /* Sin padding para que la imagen quede pegada */
    background-color: #ffffff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden; /* Clave para que la imagen respete los bordes redondeados */
}

/* 3. Cabecera (Imagen Peugeot 2008)
-------------------------------------------------- */
.header-image {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.header-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center center;
    display: block;
}

/* 4. Contenido (Formularios, Gracias, Admin)
-------------------------------------------------- */
.form-container,
.quiz-container,
.thankyou-container,
.admin-dashboard,
.admin-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 25px 35px;
    background: #fff;
}

/* 5. Tipografía
-------------------------------------------------- */
.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111;
    margin-bottom: 30px;
    text-align: center;
}

.form-container p,
.quiz-container h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111;
    margin-bottom: 20px;
}

legend {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
}

/* 6. Estilos de Formularios
-------------------------------------------------- */
form {
    width: 100%;
}

.form-group,
.form-check,
fieldset {
    margin-bottom: 15px;
    border: none;
    padding: 0;
}

label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

/* Estilo de Inputs, Selects y Textarea */
input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #000000; /* Bordes negros */
    border-radius: 8px; /* Bordes redondeados */
    font-size: 1rem;
    color: #333;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: #e30613; /* Color rojo Claro al enfocar */
    outline: none;
}

textarea {
    min-height: 80px;
    resize: vertical;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
}

textarea:focus {
    border-color: #e30613;
}

/* Grupo para campos en la misma línea */
.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

/* Grupo para campos de fecha (Día, Mes, Año) */
.date-group {
    display: flex;
    gap: 10px;
}
.date-group select {
    flex: 1;
}

/* Estilos para Checkboxes */
.form-check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 0;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.form-check label {
    display: block;
    margin-bottom: 0;
    font-weight: normal;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.4;
}

.form-check label a {
    color: #E30613;
    text-decoration: underline;
}

/* Estilos para Radio Buttons (Quiz) */
.radio-option {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.radio-option label {
    display: inline;
    font-weight: normal;
    margin-bottom: 0;
    font-size: 1rem;
}

/* 7. Botón Principal (Magenta)
-------------------------------------------------- */
.submit-btn {
    background-color: #e30613;
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    width: 100%;
    max-width: 300px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 25px;
    text-transform: none;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    background-color: #b00510;
}

.submit-btn:active {
    transform: scale(0.99);
}

/* 8. Página de Gracias
-------------------------------------------------- */
.thankyou-container {
    text-align: center;
    padding: 40px;
}
.thankyou-container h1 {
    color: #e30613;
    margin-bottom: 15px;
}

.reglas-link {
    text-align: center;
    margin-top: 25px;
}

.reglas-link a {
    color: #E30613;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.reglas-link a:hover {
    opacity: 0.8;
}

.error-message {
    color: red;
    background: #ffe0e0;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* 9. Estilos de Admin (Básicos)
-------------------------------------------------- */
.admin-dashboard .stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
.admin-dashboard .stats p {
    font-size: 1.1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th,
td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}
th {
    background-color: #f9f9f9;
}
.admin-detail ul {
    list-style: none;
    padding-left: 0;
}
.admin-detail li {
    margin-bottom: 10px;
    font-size: 1.05rem;
}
.responses-list .response-item {
    border: 1px solid #eee;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: #fafafa;
}

/* 10. Diseño Responsivo (Móvil)
-------------------------------------------------- */
@media (max-width: 600px) {
    body {
        background-color: #ffffff; /* El fondo se vuelve blanco */
        padding: 0;
        display: block; /* Ensure block display on mobile */
    }

    main.container {
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    /* Adaptar banner a la pantalla */
    .header-image {
        height: auto !important;
    }

    .header-image img {
        height: auto;
    }


    .form-container,
    .quiz-container,
    .thankyou-container,
    .admin-dashboard,
    .admin-detail {
        padding: 20px; /* Menos padding en móvil */
    }

    .form-row {
        flex-direction: column; /* Apila nombre y apellido en móvil */
    }

    .date-group {
        flex-direction: column; /* Apila los selects de fecha */
    }

    .submit-btn {
        padding: 14px;
        font-size: 1rem;
    }
}

/* 11. Estilos Específicos para Dashboard Admin
-------------------------------------------------- */
.admin-page main.container {
    max-width: none;
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

/* Responsive para Dashboard */
@media (max-width: 1200px) {
    .admin-page .admin-stats-grid {
        padding: 0 20px !important;
    }

    .admin-page .admin-table-container {
        margin: 0 20px !important;
    }
}

@media (max-width: 768px) {
    .admin-page .admin-stats-grid {
        padding: 0 15px !important;
        grid-template-columns: 1fr !important;
    }

    .admin-page .admin-table-container {
        margin: 0 15px !important;
    }

    /* Ocultar columnas menos importantes en móvil */
    .admin-table-hide-mobile {
        display: none !important;
    }

    /* Ajustar header en móvil */
    .admin-header-mobile {
        flex-direction: column !important;
        gap: 15px !important;
        text-align: center !important;
    }

    .admin-page .admin-header {
        padding: 15px 20px !important;
    }
}

@media (max-width: 480px) {
    .admin-page .admin-stats-grid {
        padding: 0 10px !important;
    }

    .admin-page .admin-table-container {
        margin: 0 10px !important;
    }

    .admin-page .admin-header {
        padding: 15px !important;
    }
}

/* 12. Estilos Resultados (Premium Design)
-------------------------------------------------- */
.result-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.thank-you-header h1 {
    color: #E30613;
    font-size: 2.5rem;
    margin-bottom: 5px;
    font-weight: 800; /* Extra bold */
    text-transform: uppercase;
    letter-spacing: -1px;
}

.thank-you-header .subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
}

/* Tarjeta de Puntaje */
.score-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 35px;
    padding: 20px;
    background: #fdfdfd;
    border-radius: 20px;
    border: 1px solid #f0f0f0;
}

.score-circle {
    width: 130px;
    height: 130px;
    background: #E30613;
    color: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 15px rgba(227, 6, 19, 0.3);
}

.score-number {
    font-size: 3.5rem;
    line-height: 1;
    font-weight: 700;
}

.score-total {
    font-size: 1.2rem;
    opacity: 0.9;
}

.score-details {
    text-align: left;
}

.score-details p {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #222;
}

.time-badge {
    display: inline-block;
    padding: 8px 16px;
    background: #333;
    color: #fff;
    border-radius: 50px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

/* Ranking Section */
.ranking-section {
    text-align: left;
    margin-top: 40px;
}

.ranking-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #E30613;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.ranking-header h2 {
    color: #333;
    font-size: 1.5rem;
    margin: 0;
}

.ranking-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #777;
}

.table-responsive {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px; /* Espaciado entre filas */
    margin-top: 10px;
}

.ranking-table thead th {
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding: 10px 20px;
    border: none;
    background: transparent;
}

.ranking-table tbody tr {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: transform 0.2s ease;
}

.ranking-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.ranking-table td {
    padding: 15px 20px;
    font-size: 1rem;
    border: 1px solid #f5f5f5;
    border-width: 1px 0;
}

.ranking-table td:first-child {
    border-left-width: 1px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    font-weight: bold;
    color: #E30613;
}

.ranking-table td:last-child {
    border-right-width: 1px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    font-family: monospace;
    font-weight: 600;
}

/* Highlight user row */
.ranking-table tr.highlight {
    background: #fff5f5;
    border: 1px solid #E30613;
}
.ranking-table tr.highlight td {
    border-color: #ffdce0;
    color: #E30613;
}

/* Rank Numbers */
.rank-num {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    background: #eee;
    color: #555;
    font-size: 0.9rem;
}

.rank-1 { background: #FFD700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.rank-2 { background: #C0C0C0; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.rank-3 { background: #CD7F32; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* Mensajes / Botones */
.message {
    padding: 40px;
    background: #fafafa;
    border-radius: 12px;
    margin-top: 30px;
}
.warning-message {
    border-top: 4px solid #f0ad4e;
}
.attempts-note {
    font-size: 0.9rem;
    color: #999;
    margin-top: 10px;
}

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 20px;
    transition: all 0.2s;
}

.btn-primary {
    background: #E30613;
    color: white;
}
.btn-primary:hover { background: #b00510; }

.btn-secondary {
    background: #333;
    color: white;
}
.btn-secondary:hover { background: #000; }

.empty-ranking {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.footer-note {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 50px;
}

/* Responsive Result */
@media (max-width: 600px) {
    .score-card {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
        text-align: center;
    }
    .score-details {
        text-align: center;
    }
    .result-container {
        padding: 20px;
    }
    .ranking-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}
