/* ═══════════════════════════════════════════════════════════════
   Registro de Agentes Participantes — Estilos Frontend
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&family=Playfair+Display:wght@700&display=swap');

/* ─── Reset y base ──────────────────────────────────────────── */
.rap-root *, .rap-root *::before, .rap-root *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.rap-root {
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    color: var(--rap-text, #1e293b);
    background: var(--rap-bg, #f0f4f8);
    padding: 24px 16px 48px;
    max-width: 820px;
    margin: 0 auto;
}

/* ─── Encabezado ────────────────────────────────────────────── */
.rap-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--rap-primary, #065f46);
    background: linear-gradient(135deg, var(--rap-primary, #065f46) 0%, var(--rap-primary-dk, #044033) 100%);
    color: #fff;
    padding: 28px 32px;
    border-radius: var(--rap-radius, 12px) var(--rap-radius, 12px) 0 0;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.rap-header::after {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}

.rap-header-icon {
    flex-shrink: 0;
    width: 64px; height: 64px;
    background: rgba(255,255,255,.15);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}

.rap-header-sup {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: .75;
    margin-bottom: 4px;
}

.rap-header-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(18px, 4vw, 26px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
}

.rap-header-muni {
    font-size: 13px;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Pasos ─────────────────────────────────────────────────── */
.rap-steps {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 16px 24px;
    margin-bottom: 24px;
    border-left: 1px solid var(--rap-border, #e2e8f0);
    border-right: 1px solid var(--rap-border, #e2e8f0);
    border-bottom: 1px solid var(--rap-border, #e2e8f0);
    border-radius: 0 0 var(--rap-radius, 12px) var(--rap-radius, 12px);
    box-shadow: var(--rap-shadow, 0 4px 24px rgba(0,0,0,.08));
    overflow-x: auto;
    gap: 0;
}

.rap-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    cursor: default;
}

.rap-step-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--rap-border, #e2e8f0);
    color: var(--rap-muted, #64748b);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    transition: all .3s ease;
    flex-shrink: 0;
}

.rap-step span {
    font-size: 12px;
    font-weight: 600;
    color: var(--rap-muted, #64748b);
    white-space: nowrap;
    transition: color .3s;
}

.rap-step.active .rap-step-num {
    background: var(--rap-primary, #065f46);
    color: #fff;
    box-shadow: 0 0 0 4px var(--rap-primary-lt, #dcfce7);
}

.rap-step.active span { color: var(--rap-primary, #065f46); }

.rap-step.completed .rap-step-num {
    background: var(--rap-success, #16a34a);
    color: #fff;
}

.rap-step.completed .rap-step-num::after {
    content: '✓';
}

.rap-step-line {
    flex: 1;
    height: 2px;
    background: var(--rap-border, #e2e8f0);
    margin: 0 8px;
    min-width: 24px;
    transition: background .3s;
}

.rap-step.completed ~ .rap-step-line {
    background: var(--rap-success, #16a34a);
}

/* ─── Secciones ─────────────────────────────────────────────── */
.rap-section {
    display: none;
    animation: rapFadeIn .35s ease;
}

.rap-section.active { display: block; }

@keyframes rapFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Cards ─────────────────────────────────────────────────── */
.rap-card {
    background: var(--rap-card, #fff);
    border-radius: var(--rap-radius, 12px);
    box-shadow: var(--rap-shadow, 0 4px 24px rgba(0,0,0,.08));
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid rgba(0,0,0,.04);
}

.rap-card-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rap-border, #e2e8f0);
}

.rap-card-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    background: var(--rap-primary-lt, #dcfce7);
    color: var(--rap-primary, #065f46);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.rap-card-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--rap-text, #1e293b);
    margin-bottom: 2px;
}

.rap-card-desc {
    font-size: 13px;
    color: var(--rap-muted, #64748b);
}

/* ─── Grid layouts ──────────────────────────────────────────── */
.rap-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rap-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.rap-field-full { grid-column: 1 / -1; }

/* ─── Campos ────────────────────────────────────────────────── */
.rap-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.rap-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--rap-text, #1e293b);
    text-transform: uppercase;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rap-label i { color: var(--rap-primary, #065f46); font-size: 11px; }

.rap-required {
    color: var(--rap-error, #dc2626);
    font-size: 13px;
}

.rap-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--rap-border, #e2e8f0);
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: var(--rap-text, #1e293b);
    background: #fff;
    transition: all .25s ease;
    outline: none;
    -webkit-appearance: none;
}

.rap-input:focus {
    border-color: var(--rap-primary, #065f46);
    box-shadow: 0 0 0 3px var(--rap-primary-lt, #dcfce7);
}

.rap-input.is-invalid {
    border-color: var(--rap-error, #dc2626);
    box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

.rap-input.is-valid {
    border-color: var(--rap-success, #16a34a);
}

.rap-input::placeholder { color: #a8b3c0; }

/* Select */
.rap-select-wrap { position: relative; }

.rap-select {
    padding-right: 36px;
    cursor: pointer;
}

.rap-select-arrow {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--rap-muted, #64748b);
    pointer-events: none;
}

/* Input con estado (DNI) */
.rap-input-icon-wrap { position: relative; }

.rap-input-icon-wrap .rap-input { padding-right: 40px; }

.rap-input-status {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: all .3s;
}

.rap-input-status.loading { color: var(--rap-muted, #64748b); }
.rap-input-status.ok      { color: var(--rap-success, #16a34a); }
.rap-input-status.error   { color: var(--rap-error, #dc2626); }

/* Errores */
.rap-error {
    font-size: 12px;
    color: var(--rap-error, #dc2626);
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 4px;
}

.rap-error.visible { display: flex; }

/* ─── Banner opcional ────────────────────────────────────────── */
.rap-optional-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── File upload ────────────────────────────────────────────── */
.rap-file-drop {
    border: 2px dashed var(--rap-border, #e2e8f0);
    border-radius: 10px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .25s ease;
    position: relative;
    overflow: hidden;
    background: #fafafa;
}

.rap-file-drop:hover,
.rap-file-drop.drag-over {
    border-color: var(--rap-primary, #065f46);
    background: var(--rap-primary-lt, #dcfce7);
}

.rap-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.rap-file-content i {
    font-size: 32px;
    color: var(--rap-muted, #64748b);
    margin-bottom: 8px;
    display: block;
    transition: color .25s;
}

.rap-file-drop:hover .rap-file-content i {
    color: var(--rap-primary, #065f46);
}

.rap-file-content p {
    font-size: 13px;
    color: var(--rap-muted, #64748b);
    font-weight: 600;
}

.rap-file-content p span {
    color: var(--rap-primary, #065f46);
    text-decoration: underline;
}

.rap-file-content small {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.rap-file-preview {
    padding: 8px 0 0;
}

.rap-file-preview img {
    max-height: 80px;
    border-radius: 6px;
    display: block;
    margin: 0 auto 6px;
}

.rap-file-preview .rap-file-name {
    font-size: 12px;
    color: var(--rap-primary, #065f46);
    font-weight: 700;
    word-break: break-all;
}

.rap-file-preview .rap-file-remove {
    background: none;
    border: none;
    color: var(--rap-error, #dc2626);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 0;
    margin-top: 4px;
}

/* ─── Resumen ────────────────────────────────────────────────── */
.rap-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
}

.rap-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.rap-summary-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--rap-muted, #64748b);
}

.rap-summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--rap-text, #1e293b);
}

.rap-summary-item.empty .rap-summary-value { color: #94a3b8; }

/* ─── Checkbox ───────────────────────────────────────────────── */
.rap-confirm-card { background: var(--rap-primary-lt, #dcfce7); }

.rap-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.rap-checkbox { display: none; }

.rap-checkbox-custom {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border: 2px solid var(--rap-primary, #065f46);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s ease;
    background: #fff;
    margin-top: 1px;
}

.rap-checkbox:checked + .rap-checkbox-custom {
    background: var(--rap-primary, #065f46);
}

.rap-checkbox:checked + .rap-checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.rap-checkbox-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--rap-text, #1e293b);
}

/* ─── Navegación ────────────────────────────────────────────── */
.rap-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 12px;
}

.rap-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all .25s ease;
}

.rap-btn-next, .rap-btn-submit {
    background: var(--rap-primary, #065f46);
    color: #fff;
    box-shadow: 0 4px 14px rgba(6,95,70,.3);
}

.rap-btn-next:hover, .rap-btn-submit:hover {
    background: var(--rap-primary-dk, #044033);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6,95,70,.4);
}

.rap-btn-back {
    background: transparent;
    color: var(--rap-muted, #64748b);
    border: 2px solid var(--rap-border, #e2e8f0);
}

.rap-btn-back:hover {
    border-color: var(--rap-primary, #065f46);
    color: var(--rap-primary, #065f46);
}

.rap-btn-submit {
    padding: 14px 32px;
    font-size: 15px;
    background: linear-gradient(135deg, var(--rap-primary, #065f46), var(--rap-primary-dk, #044033));
}

.rap-btn-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.rap-btn-nuevo {
    background: #fff;
    color: var(--rap-primary, #065f46);
    border: 2px solid var(--rap-primary, #065f46);
    margin-top: 16px;
}

.rap-btn-nuevo:hover {
    background: var(--rap-primary, #065f46);
    color: #fff;
}

/* ─── Panel de éxito ────────────────────────────────────────── */
.rap-success-panel {
    text-align: center;
    padding: 60px 32px;
    background: #fff;
    border-radius: var(--rap-radius, 12px);
    box-shadow: var(--rap-shadow, 0 4px 24px rgba(0,0,0,.08));
    animation: rapFadeIn .5s ease;
}

.rap-success-icon {
    font-size: 72px;
    color: var(--rap-success, #16a34a);
    margin-bottom: 20px;
    animation: rapBounce .6s ease;
}

@keyframes rapBounce {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.rap-success-panel h2 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: var(--rap-text, #1e293b);
    margin-bottom: 12px;
}

.rap-success-panel p {
    font-size: 15px;
    color: var(--rap-muted, #64748b);
    max-width: 480px;
    margin: 0 auto 20px;
    line-height: 1.7;
}

.rap-success-detail {
    display: inline-block;
    background: var(--rap-primary-lt, #dcfce7);
    border: 1px solid rgba(6,95,70,.15);
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 14px;
    color: var(--rap-primary, #065f46);
    font-weight: 600;
    margin-bottom: 12px;
}

/* ─── Alertas ────────────────────────────────────────────────── */
.rap-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 16px;
    animation: rapFadeIn .3s ease;
}

.rap-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--rap-error, #dc2626);
}

/* ─── Lista pública ─────────────────────────────────────────── */
.rap-lista-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rap-lista-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--rap-border, #e2e8f0);
    transition: background .2s;
}

.rap-lista-item:hover { background: var(--rap-primary-lt, #dcfce7); }

.rap-lista-avatar {
    flex-shrink: 0;
    width: 42px; height: 42px;
    background: var(--rap-primary, #065f46);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    font-weight: 800;
}

.rap-lista-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rap-lista-info strong { font-size: 14px; font-weight: 700; }
.rap-lista-info span   { font-size: 12px; color: var(--rap-muted, #64748b); }
.rap-lista-info em     { font-size: 11px; color: var(--rap-primary, #065f46); font-style: normal; font-weight: 600; }

.rap-lista-muni {
    font-size: 12px;
    color: var(--rap-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.rap-lista-muni i { color: var(--rap-primary, #065f46); }

/* ─── Info shortcode ────────────────────────────────────────── */
.rap-info {
    font-size: 14px;
    color: var(--rap-muted, #64748b);
    padding: 8px 0;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .rap-root { padding: 16px 12px 40px; }

    .rap-header { padding: 20px 18px; gap: 14px; }

    .rap-header-icon { width: 48px; height: 48px; font-size: 22px; }

    .rap-card { padding: 20px 16px; }

    .rap-grid-2,
    .rap-grid-3 { grid-template-columns: 1fr; }

    .rap-steps { padding: 12px 14px; }
    .rap-step span { display: none; }

    .rap-summary { grid-template-columns: 1fr; }

    .rap-nav { flex-direction: column-reverse; gap: 10px; }
    .rap-btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
    .rap-header { flex-direction: column; text-align: center; }
}
