/* ══════════════════════════════════════════════════
   REGISTRO ÚNICO DE CIUDADANOS — AYUNTAMIENTO DE TEPIC
   Hoja de estilos principal
   ══════════════════════════════════════════════════ */

:root {
    --primary: #6B1A2F;
    --primary-dark: #4A1220;
    --primary-light: #8B2A45;
    --gold: #B8860B;
    --gold-light: #D4A843;
    --gold-pale: #F5E6C8;
    --bg: #F7F4F0;
    --card-bg: #FFFFFF;
    --text: #2D2D2D;
    --text-muted: #6B6B6B;
    --text-light: #999999;
    --border: #E0D8D0;
    --border-focus: #B8860B;
    --success: #2E7D4F;
    --success-bg: #E8F5E9;
    --error: #C62828;
    --error-bg: #FFEBEE;
    --error-light: #EF5350;
    --shadow-sm: 0 1px 3px rgba(107,26,47,0.08);
    --shadow-md: 0 4px 16px rgba(107,26,47,0.10);
    --shadow-lg: 0 8px 32px rgba(107,26,47,0.14);
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ══════════════ TOPBAR ══════════════ */
.topbar {
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-logo {
    height: 42px;
    margin-right: 16px;
    filter: brightness(0) invert(1);
}
.topbar-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.topbar-subtitle {
    font-size: 11px;
    font-weight: 300;
    opacity: 0.8;
    margin-top: 1px;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-badge {
    background: var(--gold);
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ══════════════ MAIN CONTAINER ══════════════ */
.main-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 32px 20px 60px;
}
.form-container {
    width: 100%;
    max-width: 820px;
}

/* ══════════════ HERO HEADER ══════════════ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 36px 40px 30px;
    color: white;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: var(--gold);
    opacity: 0.06;
    border-radius: 50%;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 30%;
    width: 240px;
    height: 240px;
    background: var(--gold);
    opacity: 0.04;
    border-radius: 50%;
}
.hero h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
}
.hero p {
    font-size: 13px;
    font-weight: 300;
    opacity: 0.85;
    position: relative;
}
.hero-divider {
    width: 48px;
    height: 3px;
    background: var(--gold);
    border-radius: 2px;
    margin: 14px 0 10px;
}

/* ══════════════ CARD ══════════════ */
.card {
    background: var(--card-bg);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
}

/* ══════════════ TIPO PERSONA SELECTOR ══════════════ */
.tipo-selector {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.tipo-btn {
    flex: 1;
    padding: 18px 16px;
    text-align: center;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: none;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tipo-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--gold);
    border-radius: 2px 2px 0 0;
    transition: width 0.3s ease;
}
.tipo-btn.active {
    color: var(--primary);
    background: var(--card-bg);
}
.tipo-btn.active::after {
    width: 60px;
}
.tipo-btn:hover:not(.active) {
    color: var(--primary-light);
    background: #F0ECE8;
}
.tipo-icon {
    font-size: 18px;
}

/* ══════════════ FORM SECTIONS ══════════════ */
.form-body {
    padding: 32px 40px 40px;
}
.section {
    margin-bottom: 32px;
}
.section:last-child {
    margin-bottom: 0;
}
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ══════════════ FORM GRID ══════════════ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}
.form-grid .full-width {
    grid-column: 1 / -1;
}

/* ══════════════ FORM GROUP ══════════════ */
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.form-group label .req {
    color: var(--error-light);
    font-size: 14px;
    line-height: 1;
}
.form-group label .opt {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-light);
    margin-left: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #FAFAF8;
    color: var(--text);
    transition: all 0.2s ease;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--border-focus);
    background: #FFFDF8;
    box-shadow: 0 0 0 3px rgba(184,134,11,0.10);
}
.form-group input.error,
.form-group select.error {
    border-color: var(--error-light);
    background: var(--error-bg);
}
.form-group .field-error {
    font-size: 11px;
    color: var(--error);
    margin-top: 4px;
    display: none;
    align-items: center;
    gap: 4px;
}
.form-group .field-error.visible {
    display: flex;
}
.form-group .field-hint {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 3px;
}
.form-group input::placeholder {
    color: var(--text-light);
    font-weight: 300;
}

/* ══════════════ PASSWORD FIELD ══════════════ */
.password-wrap {
    position: relative;
}
.password-wrap input {
    width: 100%;
    padding-right: 42px;
}
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 16px;
    padding: 4px;
    transition: color 0.2s;
}
.password-toggle:hover {
    color: var(--primary);
}

/* ══════════════ PASSWORD STRENGTH ══════════════ */
.strength-bar {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.strength-bar .bar {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    transition: background 0.3s;
}
.strength-bar.s1 .bar:nth-child(1) { background: var(--error); }
.strength-bar.s2 .bar:nth-child(-n+2) { background: #F57C00; }
.strength-bar.s3 .bar:nth-child(-n+3) { background: #FBC02D; }
.strength-bar.s4 .bar { background: var(--success); }

/* ══════════════ REPRESENTANTE PANEL ══════════════ */
.rep-panel {
    background: linear-gradient(135deg, #FFF9F0, #FFF5E6);
    border: 1.5px solid var(--gold-pale);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-top: 4px;
}
.rep-panel .section-title {
    color: var(--gold);
    margin-bottom: 14px;
}

/* ══════════════ BUTTONS ══════════════ */
.form-actions {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.3px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(107,26,47,0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(107,26,47,0.35);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ══════════════ ALERT ══════════════ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}
.alert.visible { display: flex; }
.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid #FFCDD2;
}
.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #C8E6C9;
}
.alert-icon { font-size: 18px; }

/* ══════════════ FOOTER ══════════════ */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 11px;
    color: var(--text-light);
}
.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ══════════════ HIDDEN HELPER ══════════════ */
.hidden { display: none !important; }

/* ══════════════ LOADING SPINNER ══════════════ */
.btn-primary.loading {
    pointer-events: none;
    opacity: 0.8;
}
.btn-primary.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .hero { padding: 28px 24px 22px; }
    .form-body { padding: 24px 20px 32px; }
    .form-actions { flex-direction: column; }
    .btn { width: 100%; text-align: center; }
}

/* ══════════════ ANIMATIONS ══════════════ */
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.form-body { animation: fadeSlide 0.4s ease; }
.rep-panel { animation: fadeSlide 0.35s ease; }

/* ══════════════ LOGIN LINK ══════════════ */
.login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}
.login-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.login-link a:hover {
    text-decoration: underline;
}

/* ══════════════ CAPTCHA ══════════════ */
.captcha-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.captcha-display {
    flex: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, #2D2D2D, #1A1A1A);
    color: #B8860B;
    font-size: 20px;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
    border-radius: var(--radius-sm);
    text-align: center;
    user-select: none;
    position: relative;
    overflow: hidden;
}
.captcha-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(184,134,11,0.04) 3px,
        rgba(184,134,11,0.04) 4px
    );
    pointer-events: none;
}
.captcha-display::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(184,134,11,0.15);
    transform: rotate(-2deg);
    pointer-events: none;
}
.captcha-refresh {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.captcha-refresh:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ══════════════ MODAL OBSERVACIONES ══════════════ */
.obs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 16, 25, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.obs-overlay.obs-active {
    opacity: 1;
}
.obs-modal {
    background: white;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(107, 26, 47, 0.25);
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.25s ease;
}
.obs-overlay.obs-active .obs-modal {
    transform: translateY(0) scale(1);
}
.obs-header {
    padding: 28px 28px 0;
    text-align: center;
}
.obs-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FFF8E1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.obs-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.obs-sub {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}
.obs-body {
    padding: 20px 28px 24px;
}
.obs-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}
.obs-list li {
    position: relative;
    padding: 10px 14px 10px 36px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text);
    background: #FDF5F7;
    border-radius: 8px;
    border-left: 3px solid var(--gold);
    line-height: 1.4;
}
.obs-list li::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 14px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
}
.obs-nota {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    font-weight: 500;
}
.obs-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.obs-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 11px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.obs-btn-secondary {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--border);
}
.obs-btn-secondary:hover {
    border-color: var(--primary);
    background: #FDF5F7;
}
.obs-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 3px 10px rgba(107, 26, 47, 0.2);
}
.obs-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(107, 26, 47, 0.3);
}

/* ══════════════ AVISO DE PRIVACIDAD ══════════════ */
.privacidad-box {
    background: #FAFAF8;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.privacidad-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    position: relative;
}
.privacidad-check input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.privacidad-check .checkmark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--border);
    border-radius: 5px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 1px;
}
.privacidad-check input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}
.privacidad-check input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 700;
}
.privacidad-check:hover .checkmark {
    border-color: var(--gold);
}
.privacidad-texto {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}
.privacidad-texto a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}
.privacidad-texto a:hover {
    text-decoration: underline;
}
.privacidad-box .field-error {
    font-size: 11px;
    color: var(--error);
    margin-top: 8px;
    display: none;
    align-items: center;
    gap: 4px;
}
.privacidad-box .field-error.visible {
    display: flex;
}
.privacidad-box.error {
    border-color: var(--error-light);
    background: var(--error-bg);
}
