/* ============================================================
   Matrícula de Comedor — Hijas de Cristo Rey / Fdación. José Gras
   ============================================================ */

:root {
    --bg:           #eef2f7;
    --surface:      #ffffff;
    --surface-alt:  #f5f8fb;
    --border:       #d0dce6;
    --border-focus: #3a85b5;
    --text:         #1a2a3a;
    --text-muted:   #5a7088;
    --accent:       #1e6091;
    --accent-dark:  #143d5c;
    --accent-light: #5ba0cc;
    --accent-bg:    #e0edf5;
    --success:      #3a7d44;
    --success-bg:   #e8f5ea;
    --error:        #c0392b;
    --error-bg:     #fdecea;
    --radius:       10px;
    --shadow:       0 1px 3px rgba(26,42,58,0.06), 0 4px 16px rgba(26,42,58,0.04);
    --shadow-lg:    0 4px 12px rgba(26,42,58,0.08), 0 16px 40px rgba(26,42,58,0.06);
    --font-body:    'DM Sans', sans-serif;
    --font-display: 'Playfair Display', serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────── */
.page-header {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    padding: 2.5rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 700;
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.3;
}

.page-header p.header-sub {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-top: 0.5rem;
    position: relative;
}

/* ── Logo en el header ────────────────────────────────── */
.header-logo-wrap {
    position: relative;
    margin-bottom: 1.25rem;
}

.header-logo {
    width: 140px;
    height: auto;
    border-radius: 14px;
    background: white;
    padding: 10px 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    display: block;
    margin: 0 auto;
}

/* ── Banner de curso escolar ──────────────────────────── */
.curso-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    margin-bottom: 0.9rem;
    position: relative;
    text-transform: uppercase;
}

/* ── Container ────────────────────────────────────────── */
.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ── Alertas globales ─────────────────────────────────── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    animation: slideDown 0.3s ease;
}

.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #f5c6cb; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #c3e6cb; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Secciones ────────────────────────────────────────── */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.section:hover { box-shadow: var(--shadow-lg); }

.section-title {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-bg);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.section-title .icon {
    width: 30px;
    height: 30px;
    background: var(--accent-bg);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ── Grids ────────────────────────────────────────────── */
.grid   { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Campos ───────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.81rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group label .req {
    color: var(--error);
    margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a7088' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.4rem;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(30,96,145,0.12);
}

input.field-error, select.field-error {
    border-color: var(--error);
    background: #fff8f8;
}

input::placeholder, textarea::placeholder { color: #8fa4b8; }

/* ── Mensajes de error por campo ──────────────────────── */
.field-msg {
    font-size: 0.78rem;
    color: var(--error);
    display: none;
    align-items: center;
    gap: 0.3rem;
}
.field-msg.show { display: flex; }

/* ── Días a la semana — tarjetas visuales ─────────────── */
.dias-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.dia-card {
    position: relative;
}

.dia-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dia-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.85rem 0.4rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
    user-select: none;
}

.dia-card label .dia-num {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1;
    transition: color 0.18s;
}

.dia-card label .dia-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: color 0.18s;
}

.dia-card input[type="radio"]:checked + label {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 3px rgba(30,96,145,0.12);
}

.dia-card input[type="radio"]:checked + label .dia-num {
    color: var(--accent);
}

.dia-card input[type="radio"]:checked + label .dia-label,
.dia-card input[type="radio"]:checked + label {
    color: var(--accent);
}

.dia-card label:hover {
    border-color: var(--accent-light);
    background: var(--accent-bg);
}

/* ── Info box ─────────────────────────────────────────── */
.info-box {
    background: var(--accent-bg);
    border: 1px solid rgba(30,96,145,0.2);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    font-size: 0.88rem;
    color: var(--accent-dark);
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin-top: 1rem;
}

.info-box .info-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }

/* ── Checkbox LOPD ────────────────────────────────────── */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    margin-top: 3px;
}

.checkbox-group label {
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.5;
}

.checkbox-group label a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Botón enviar ─────────────────────────────────────── */
.btn-submit {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(30,96,145,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(30,96,145,0.4);
}

.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Resumen/confirmación ─────────────────────────────── */
.success-card {
    background: var(--surface);
    border: 1px solid #c3e6cb;
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.4s ease;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.success-card h2 {
    font-family: var(--font-display);
    color: var(--success);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.success-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 480px;
    margin: 0 auto 1.5rem;
}

.success-detail {
    background: var(--success-bg);
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
    text-align: left;
    max-width: 420px;
    margin: 0 auto;
    font-size: 0.9rem;
}

.success-detail .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(58,125,68,0.12);
}
.success-detail .detail-row:last-child { border-bottom: none; }
.success-detail .detail-label { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.success-detail .detail-val   { color: var(--success); font-weight: 600; }

/* ── Footer ───────────────────────────────────────────── */
.page-footer {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.page-footer a { color: var(--accent); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .container { padding: 1rem 1rem 3rem; }
    .section { padding: 1.1rem; }
    .header-logo { width: 110px; }

    .dias-grid {
        grid-template-columns: repeat(3, 1fr);
    }

}

@media (max-width: 380px) {
    .dias-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Modal de revisión ────────────────────────────────── */
.review-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 40, 60, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.review-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.review-box {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(20,40,60,0.22);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.28s ease;
}

.review-overlay.show .review-box {
    transform: translateY(0) scale(1);
}

.review-header {
    padding: 1.75rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
    background: var(--surface-alt);
}

.review-header-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.review-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--accent-dark);
    margin-bottom: 0.3rem;
}

.review-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.review-body {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    flex: 1;
}

.review-body::-webkit-scrollbar { width: 5px; }
.review-body::-webkit-scrollbar-track { background: transparent; }
.review-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.review-section {
    margin-bottom: 1.35rem;
}

.review-section:last-child { margin-bottom: 0; }

.review-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--accent);
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1.5px solid var(--accent-bg);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.review-rows {
    display: grid;
    gap: 0.5rem;
}

.review-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.review-label {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    min-width: 110px;
}

.review-value {
    color: var(--text);
    font-weight: 500;
}

.review-value.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.review-dias-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-bg);
    color: var(--accent-dark);
    font-weight: 700;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.88rem;
}

.review-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

.review-btn {
    flex: 1;
    padding: 0.85rem 1rem;
    border-radius: 9px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    letter-spacing: 0.01em;
}

.review-btn-cancel {
    background: var(--surface);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}

.review-btn-cancel:hover {
    border-color: var(--border-focus);
    color: var(--text);
    background: var(--surface-alt);
}

.review-btn-send {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    box-shadow: 0 2px 10px rgba(30,96,145,0.3);
}

.review-btn-send:hover {
    box-shadow: 0 4px 18px rgba(30,96,145,0.45);
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .review-header { padding: 1.25rem 1.25rem 1rem; }
    .review-body { padding: 1.1rem 1.25rem; }
    .review-actions { flex-direction: column-reverse; padding: 1rem 1.25rem; }
    .review-label { min-width: 90px; }
}
