/* ==========================================================================
   RED LATINOAMERICANA DE POLIGRAFISTAS - FORMS & REGISTRATION CSS
   ========================================================================== */

html, body {
    width: 100%;
    min-height: 100%;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    position: static !important;
}

.page-wrapper {
    min-height: 100vh;
    background-color: #cbd5e1;
    padding: 2.5rem 1rem 4rem 1rem;
    position: relative;
    box-sizing: border-box;
}

.page-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/map-bg.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.40;
    filter: grayscale(100%);
    pointer-events: none;
    z-index: 0;
}

.form-container {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(203, 213, 225, 0.8);
    overflow: hidden;
}

.form-header {
    background: linear-gradient(135deg, var(--color-secondary), #1e293b);
    color: #ffffff;
    padding: 2rem 1.5rem;
    text-align: center;
}

.form-header-badge {
    display: inline-block;
    background: rgba(37, 99, 235, 0.3);
    color: #bfdbfe;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    margin-bottom: 0.75rem;
}

.form-header h1 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.form-header p {
    font-size: 0.875rem;
    color: #cbd5e1;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

.form-body {
    padding: 2rem 1.5rem;
}

.form-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-secondary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Cabecera Interactiva de Sección 1 */
.modality-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.section-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-title-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

.selected-modality-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    animation: badgePopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-modality-badge:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.selected-modality-badge i {
    font-size: 0.85rem;
    color: #2563eb;
}

.btn-change-modality {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.2;
}

.btn-change-modality:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}

.step-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 9999px;
    box-shadow: 0 1px 3px rgba(4, 120, 87, 0.08);
    animation: badgePopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1.2;
    white-space: nowrap;
}

.step-completed-badge svg {
    color: #059669;
    flex-shrink: 0;
}

@keyframes badgePopIn {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Selector de Tipo (Persona Natural / Empresa) con Animación de Encogimiento */
.type-toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 2rem;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                margin-bottom 0.35s ease,
                transform 0.25s ease;
    max-height: 300px;
    opacity: 1;
    overflow: hidden;
    transform: translateY(0);
}

.type-toggle-group.shrunk {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0.5rem;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
    transform: translateY(-8px);
}

/* Encabezados y Cuerpos de Secciones Progresivas (Paso a Paso Interactivo) */
.step-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #f1f5f9;
    user-select: none;
    transition: all 0.2s ease;
}

@media (min-width: 540px) {
    .step-section-header {
        flex-wrap: nowrap;
    }
}

.step-section-header.is-clickable {
    cursor: pointer;
}

.step-section-header.is-clickable:hover .section-title-left > span:first-child {
    color: var(--color-primary);
}

.step-section-body {
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                margin-bottom 0.45s ease,
                transform 0.25s ease;
    max-height: 3500px;
    opacity: 1;
    overflow: visible;
    transform: translateY(0);
}

.step-section-body.shrunk {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-bottom: 0.5rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    transform: translateY(-8px) !important;
}

.btn-step-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 11px 18px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-step-continue:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

.btn-step-continue:active {
    transform: translateY(0);
}

.btn-step-continue svg {
    transition: transform 0.2s ease;
}

.btn-step-continue:hover svg {
    transform: translateX(4px);
}

.type-toggle-card {
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.15rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.type-toggle-card:hover {
    border-color: #93c5fd;
    background: var(--color-primary-light);
}

.type-toggle-card.active {
    border-color: var(--color-primary);
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.type-toggle-card input[type="radio"] {
    display: none;
}

.type-card-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 0.5rem auto;
    color: var(--color-primary);
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.type-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-secondary);
}

.type-card-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Selector de Certificación de Poligrafistas en Empresa */
.cert-toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

@media (max-width: 640px) {
    .cert-toggle-grid {
        grid-template-columns: 1fr;
    }
}

.cert-radio-card {
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    display: block;
    user-select: none;
}

.cert-radio-card input[type="radio"] {
    display: none;
}

.cert-radio-card:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

.cert-radio-card.active {
    border-color: var(--color-primary);
    background: #eff6ff;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
}

.cert-card-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cert-logo-box {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.cert-radio-card:hover .cert-logo-box,
.cert-radio-card.active .cert-logo-box {
    border-color: #bfdbfe;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}

.cert-card-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.cert-logo-box-dual {
    width: 58px;
    gap: 4px;
    padding: 2px 4px;
}

.cert-card-img-dual {
    width: 23px;
    height: 36px;
    object-fit: contain;
    border-radius: 3px;
    display: block;
}

.cert-logo-box-none {
    background: #f8fafc;
    color: #94a3b8;
    font-size: 22px;
}

.cert-badge-preview {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    line-height: 1.2;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.cert-badge-preview.cert-apa {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.cert-badge-preview.cert-epa {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.cert-badge-preview.cert-both {
    background: #faf5ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

.cert-badge-preview.cert-none {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.cert-card-content {
    flex: 1;
    min-width: 0;
}

.cert-card-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-secondary);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cert-card-sub {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    line-height: 1.2;
}

/* Grupos y Campos del Formulario */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.form-label .required {
    color: var(--color-danger);
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text-main);
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

.form-control[readonly] {
    background-color: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Checkbox personalizado */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem 0;
}

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

.checkbox-group label {
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
}

/* Mapa para selección de oficina */
.office-map-container {
    height: 280px;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1.5px solid var(--color-border);
    margin-bottom: 0.75rem;
    position: relative;
}

#office-map {
    width: 100%;
    height: 100%;
}

.map-instruction-alert {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.btn-current-location {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1.5px solid #2563eb;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-current-location:hover {
    background: #eff6ff;
    border-color: #1d4ed8;
    color: #1e40af;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
}

.btn-current-location:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-current-location svg {
    flex-shrink: 0;
}

/* Honeypot anti-bot invisible */
.hp-field {
    display: none !important;
    visibility: hidden !important;
}

/* Mensajes de Alerta */
.alert-box {
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: none;
}

.alert-box.success {
    display: block;
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-box.error {
    display: block;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* Botón de Enviar Formulario */
.btn-submit-register {
    width: 100%;
    height: 50px;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--color-primary), #1d4ed8);
    color: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-submit-register:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn-submit-register:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Botón Agregar Sede */
.btn-add-branch {
    display: inline-flex;
    align-items: center;
    background-color: #f0fdf4;
    color: #15803d;
    border: 1.5px dashed #86efac;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-branch:hover {
    background-color: #dcfce7;
    border-color: #4ade80;
    color: #166534;
}

/* Contenedor y Tarjeta de Sede Adicional */
.branches-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.branch-card {
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.branch-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.branch-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #e2e8f0;
}

.branch-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.branch-card-title svg {
    color: var(--color-primary);
}

.btn-remove-branch {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.btn-remove-branch:hover {
    background-color: #fee2e2;
}

.branch-map-container {
    height: 200px;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--color-border);
    margin-bottom: 0.75rem;
    position: relative;
}

.branch-map {
    width: 100%;
    height: 100%;
}

