/* =====================================================================
   Plataforma de Eventos - Estilos públicos
   ===================================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* =====================================================================
   Banner del evento (imagen promocional opcional)
   ===================================================================== */
.event-banner {
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #fff;
    text-align: center;
}
.event-banner img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

/* =====================================================================
   Header del evento
   ===================================================================== */
.event-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.event-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.event-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.event-desc {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* =====================================================================
   Alertas
   ===================================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid;
}
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-warning { background: #fefce8; border-color: #fde68a; color: #854d0e; }

/* =====================================================================
   Formulario de registro
   ===================================================================== */
.register-form {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow);
}
.register-form h2 {
    font-size: 1.05rem;
    margin: 1rem 0 0.7rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.register-form h3 {
    font-size: 0.95rem;
    margin: 1rem 0 0.6rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.register-form h2:first-child,
.register-form h3:first-child { margin-top: 0; }

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}
@media (max-width: 540px) {
    .row { grid-template-columns: 1fr; }
}
.row > .form-group { margin-bottom: 0; }

.form-group {
    margin-bottom: 0.55rem;
}

/* sr-only: oculto visualmente, accesible para lectores de pantalla */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.form-group label:not(.sr-only):not(.radio-option):not(.checkbox-label):not(.file-label) {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s;
}

.file-label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: var(--text);
    font-weight: 500;
}

.radio-group-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.hint {
    margin-top: 0.2rem;
    font-size: 0.78rem;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group input[type="file"] {
    padding: 0.4rem;
}
.req {
    color: var(--error);
    font-weight: 700;
    margin-left: 2px;
}
.opt {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 4px;
}
.hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}
.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.3rem;
    font-weight: 500;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
}

.photo-preview {
    margin-top: 1rem;
    width: 150px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
}
.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================================================
   Membresías (selector de tipo de inscripción)
   ===================================================================== */
.memberships {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.membership-card {
    cursor: pointer;
    position: relative;
    --m-color: #3b82f6;
}
.membership-card input { position: absolute; opacity: 0; }
.membership-card .m-body {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1rem;
    transition: all 0.15s;
    background: #fff;
    height: 100%;
}
.membership-card input:checked + .m-body {
    border-color: var(--m-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-color) 20%, transparent);
}
.m-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--m-color);
    margin-bottom: 0.3rem;
}
.m-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.m-price {
    font-weight: 600;
}
.m-price .free {
    color: var(--success);
    background: #d1fae5;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

/* =====================================================================
   Botones
   ===================================================================== */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.85rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-secondary:hover { background: #eff6ff; }
.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.05rem;
}

.legal {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1rem;
    text-align: center;
}

/* =====================================================================
   Página de confirmación
   ===================================================================== */
.success-card, .payment-card, .error-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.success-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    font-size: 3rem;
    line-height: 80px;
    margin: 0 auto 1rem;
    font-weight: bold;
}
.lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    text-align: left;
}
.info-box .hint { margin-top: 0.5rem; }
.event-summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    text-align: left;
}
.event-summary h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.event-summary p { margin-bottom: 0.4rem; }
.actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}
.footer-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2rem;
}

/* =====================================================================
   Página de pago pendiente
   ===================================================================== */
.payment-card { text-align: left; }
.payment-card h1 { text-align: center; }
.payment-card .lead { text-align: center; }
.payment-details {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}
.row-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.row-info:last-child { border-bottom: 0; }
.row-info .amount {
    font-size: 1.3rem;
    color: var(--primary);
}
.row-info code {
    background: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}
.instructions {
    background: #fefce8;
    border-left: 3px solid var(--warning);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-top: 1.5rem;
}
.instructions h3 { margin-bottom: 0.5rem; }
.instructions ol { padding-left: 1.5rem; }
.instructions li { margin-bottom: 0.4rem; }

/* =====================================================================
   Tarjeta de networking (q.php modo público)
   ===================================================================== */
.networking-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
}
.networking-card {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--card);
    border-radius: 20px;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.avatar {
    width: 120px; height: 120px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
}
.networking-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.networking-card .company {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.badge-tag {
    display: inline-block;
    color: #fff;
    padding: 0.25rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.contact-info {
    margin: 1.5rem 0;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}
.contact-link {
    display: block;
    padding: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.contact-link:hover { color: var(--primary); }
.networking-card .actions {
    flex-direction: column;
    gap: 0.75rem;
}
.networking-card .actions .btn-primary,
.networking-card .actions .btn-secondary {
    width: 100%;
}
.event-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}
.event-footer p { margin-bottom: 0.25rem; }

/* =====================================================================
   Resultado de check-in (q.php modo admin)
   ===================================================================== */
.checkin-mode { background: var(--bg); }
.checkin-result {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border-top: 6px solid var(--success);
}
.checkin-result.duplicate { border-top-color: var(--warning); }
.big-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}
.checkin-result.success .big-icon { color: var(--success); }
.checkin-result.duplicate .big-icon { color: var(--warning); }
.checkin-result h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.checkin-result h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}
.checkin-result .company { color: var(--text-muted); margin-bottom: 1rem; }
.checkin-result .time {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 1rem 0 1.5rem;
}

/* =====================================================================
   Página de error
   ===================================================================== */
.error-card {
    border-top: 4px solid var(--error);
}
.error-card h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.error-card p { margin-bottom: 1.5rem; color: var(--text-muted); }

/* =====================================================================
   LAYOUT SPLIT (banner + form lado a lado)
   Activado cuando el evento tiene banner cargado
   ===================================================================== */
body.split-mode {
    background: var(--bg);
    margin: 0;
    min-height: 100vh;
}

.split {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

.split-banner {
    flex: 0 0 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: rgba(0, 0, 0, 0.04);
}
.split-banner img {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.split-form {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    overflow-y: auto;
}

.split-form .register-form {
    max-width: 540px;
    width: 100%;
    margin: 0;
}

/* Título centrado del form */
.form-title {
    text-align: center;
    font-size: 1.75rem;
    margin: 0 0 0.4rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.event-meta-compact {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: -0.4rem 0 1.5rem;
}

/* Checkbox de privacidad */
.privacy-group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 500;
    line-height: 1.45;
    font-size: 0.9rem;
}
.checkbox-label input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}
.checkbox-label a {
    color: var(--primary);
    text-decoration: underline;
}
.checkbox-label a:hover { text-decoration: none; }

/* Botón principal a lo ancho del form */
body.split-mode .register-form > .btn-primary {
    width: 100%;
    padding: 0.95rem;
    font-size: 1rem;
    margin-top: 1rem;
    background: #0f172a;
    border: 0;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
body.split-mode .register-form > .btn-primary:hover {
    background: var(--primary);
}

/* Responsive: en pantallas pequeñas, banner arriba y form abajo */
@media (max-width: 900px) {
    .split {
        flex-direction: column;
    }
    .split-banner {
        flex: none;
        max-height: 50vh;
        padding: 1.25rem 1rem;
        order: -1; /* aunque en HTML va después del form, en mobile sube al inicio */
    }
    .split-banner img {
        max-height: 45vh;
    }
    .split-form {
        padding: 1.5rem 1rem 2.5rem;
    }
}
@media (max-width: 540px) {
    .split-banner {
        max-height: 40vh;
        padding: 1rem;
    }
}

/* =====================================================================
   Custom country picker (cerrado: solo bandera; abierto: lista con búsqueda)
   ===================================================================== */
.phone-row {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
}
.country-picker {
    position: relative;
    flex: 0 0 70px;
}
.country-picker-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: 38px;
    padding: 0 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}
.country-picker-trigger:hover { border-color: var(--primary); }
.country-picker-trigger .flag-icon {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.country-picker-trigger .caret {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--text-muted);
}
.country-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 280px;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}
.country-search {
    width: 100% !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0.55rem 0.85rem !important;
    font-size: 0.9rem !important;
    border-radius: 0 !important;
    outline: none !important;
}
.country-list {
    max-height: 280px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}
.country-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-size: 0.88rem;
}
.country-item:hover { background: #f1f5f9; }
.country-item .flag-icon {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.country-item .country-name { flex: 1; }
.country-item .country-code {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.country-item.hidden-by-search { display: none; }
.phone-row > input[type="tel"] {
    flex: 1;
    min-width: 0;
}
@media (max-width: 540px) {
    .country-picker { flex: 0 0 64px; }
    .country-picker-dropdown { width: calc(100vw - 2.5rem); }
}

/* Ajuste compacto del título de form */
.form-title {
    text-align: center;
    font-size: 1.5rem;
    margin: 0 0 0.4rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.event-meta-compact {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: -0.3rem 0 1rem;
}

/* Memberships más compactas */
.memberships {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
}
.membership-card .m-body {
    padding: 0.85rem 0.85rem;
}
.membership-card .m-name { font-size: 0.95rem; }
.membership-card .m-desc { font-size: 0.78rem; }


/* Aviso de membresía única con precio (cuando hay solo 1 paga, sin selector) */
.single-membership-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.55rem;
    font-size: 0.95rem;
}
.single-membership-notice .m-name { font-weight: 600; color: var(--text); }
.single-membership-notice .m-price { font-weight: 700; color: var(--primary); }
