/* ============================================================
   FORMULARIO PARTICIPANTE - ESTILO UNIFICADO (ESTÁNDAR)
   ============================================================ */

:root {
    --es-primary: #722F37; --es-secondary: #D4AF37;
    --ve-primary: #00247D; --ve-secondary: #FFCC00;
    --mx-primary: #006847; --mx-secondary: #FFFFFF;
    --ec-primary: #0033A0; --ec-secondary: #FDD116;
    
    --pais-primary: #444;
    --pais-secondary: #D4AF37;
    
    --gris: #f5f5f5;
    --borde: #dcdcdc;
    --texto: #333;
    --radius: 6px;
    --font: "Poppins", sans-serif;
}

body {
    font-family: var(--font);
    background: #f0f2f5;
    margin: 0;
    padding: 0;
}

.container {
    width: 95%;
    max-width: 1100px;
    margin: 20px auto;
    padding-bottom: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* ============================================================
   HEADER (Estándar 3 Columnas)
   ============================================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    color: #fff;
    background: var(--pais-primary);
    flex-wrap: wrap;
    gap: 15px;
}

.header-left { flex: 0 0 auto; display: flex; align-items: center; }
.header-center { flex: 1 1 auto; text-align: center; min-width: 200px; }
.header-center h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; }
.header-center .small { font-size: 13px; opacity: 0.9; }
.header-right { flex: 0 0 auto; display: flex; justify-content: flex-end; }

/* ============================================================
   FORMULARIO GRID
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    padding: 30px;
}

.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

/* CAMPOS */
.field { display: flex; flex-direction: column; gap: 5px; }
label { font-weight: 600; font-size: 13px; color: var(--texto); }
.label.required::after { content: ' *'; color: #E53935; }

.input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--borde);
    border-radius: var(--radius); font-size: 14px; font-family: var(--font);
    background: #fafafa; transition: all 0.2s; box-sizing: border-box;
}
.input:focus { outline: none; border-color: var(--pais-primary); background: #fff; box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.input::placeholder { color: #999; }

select.input {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* NOTICE */
.notice-box {
    background: var(--pais-primary);
    color: white; padding: 14px 18px; border-radius: var(--radius);
    display: flex; align-items: center; gap: 10px; font-size: 14px;
}

/* PANEL REPRESENTANTE */
.panel-representante {
    background: #FFF8E1; border: 2px solid #FFD54F;
    border-radius: 8px; padding: 20px; display: none; margin-top: 10px;
}
.panel-representante.visible { display: block; animation: slideDown 0.3s ease; }
.panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; border-bottom: 1px solid #FFD54F; padding-bottom: 10px; }
.panel-header i { color: #F57C00; font-size: 18px; }
.panel-header h3 { font-size: 15px; color: #E65100; font-weight: 700; }
.panel-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 15px; }

/* PHOTOS */
.photos-section { margin-top: 10px; }
.photos-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.photo-box {
    background: #FAFAFA; border: 2px dashed var(--borde); border-radius: 8px;
    padding: 20px; text-align: center; transition: all 0.2s;
}
.photo-box:hover { border-color: var(--pais-primary); }
.photo-label { font-size: 13px; font-weight: 600; color: #555; margin-bottom: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.photo-preview { width: 100px; height: 130px; object-fit: cover; border-radius: 6px; border: 2px solid var(--borde); margin-bottom: 15px; display: none; }
.photo-preview.visible { display: block; margin: 0 auto 15px; border-color: var(--pais-secondary); }
.photo-input { display: none; }
.photo-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
    background: var(--pais-primary); color: white; border: none;
    border-radius: 6px; font-size: 13px; cursor: pointer; transition: opacity 0.2s;
}
.photo-btn:hover { opacity: 0.9; }

/* EDAD DISPLAY */
.edad-display {
    background: #f5f5f5; padding: 10px 12px; border-radius: 6px;
    font-size: 16px; font-weight: 700; color: var(--pais-primary);
    text-align: center; min-height: 42px; display: flex; align-items: center; justify-content: center;
}

/* ACTIONS */
.actions-bar { display: flex; justify-content: flex-end; gap: 15px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee; }

.btn-main {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px;
    background: var(--pais-primary); color: white; border: none;
    border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
}
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.btn-main:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px;
    background: #f5f5f5; color: #666; border: 2px solid var(--borde);
    border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: #eee; border-color: #ccc; }

/* MESSAGE */
.form-message { padding: 12px; border-radius: 6px; font-size: 14px; display: none; align-items: center; gap: 8px; }
.form-message.success { display: flex; background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.form-message.error { display: flex; background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }

/* ANIMATIONS */
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: white; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   ESTILOS DEL MODAL (CALIBRADO A 500px ESTÁNDAR)
   ============================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay[style*="display: flex"] {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    /* Estándar exacto a Staff */
    max-width: 500px; 
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay[style*="display: flex"] .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 15px 20px;
    background: var(--pais-primary); /* Usa el color del país */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; font-size: 18px; }
.btn-close-modal { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    background: #f9f9f9;
    text-align: right;
    border-top: 1px solid #eee;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .form-grid { grid-template-columns: repeat(6, 1fr); padding: 15px; gap: 15px; }
    .col-1, .col-2, .col-3 { grid-column: span 3; }
    .col-4, .col-5, .col-6 { grid-column: span 6; }
    .col-12 { grid-column: span 6; }
    .photos-grid { grid-template-columns: 1fr; }
    .actions-bar { flex-direction: column; }
    .btn-main, .btn-secondary { width: 100%; justify-content: center; }
    
    .header { flex-direction: column; text-align: center; padding: 15px; }
    .header-left, .header-right { width: 100%; justify-content: center; }
    .header-center { order: 3; margin-top: 10px; }
}
@media (max-width: 480px) {
    .form-grid { grid-template-columns: 1fr; }
    .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-12 { grid-column: span 1; }
    .panel-grid { grid-template-columns: 1fr; }
}