/* ============================================================
   FORM STYLES — Formulario Público de Citas Especializadas
   ============================================================ */

/* ── Progress Bar ── */
.progress-container {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--border-light);
    z-index: 1000;
}
.progress-bar {
    height: 100%;
    background: var(--gradient-brand);
    width: 0%;
    transition: width 0.5s var(--ease-out);
}

/* ── Form Wrapper ── */
.form-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.6s var(--ease-out);
}

/* ── Encabezado (banda navy + logo blanco) ── */
.form-header {
    background: var(--gradient-dark);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    position: relative;
    padding: 2rem 2.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.form-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--gradient-brand);
}
.form-header .brand-logo { max-width: 200px; flex-shrink: 0; }
.form-header-overlay {
    flex: 1;
    min-width: 220px;
    color: var(--white);
    padding-left: 2rem;
    border-left: 1px solid rgba(255,255,255,.18);
}
.form-header-overlay h1 {
    color: var(--white);
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4px;
}
.form-header-overlay .subtitle {
    color: #A9CBE6;
    font-weight: 500;
    font-size: 0.98rem;
}
.header-version {
    position: absolute;
    top: 12px; right: 16px;
    background: rgba(255,255,255,.1);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    color: rgba(255,255,255,.8);
    font-size: 0.72rem;
    font-weight: 600;
}

/* ── Form Body ── */
.form-body {
    background: var(--white);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    border-top: none;
}

/* ── Sections ── */
.form-section {
    display: none;
    animation: slideUp 0.4s var(--ease-out);
}
.form-section.active { display: block; }

.section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.section-number {
    width: 44px; height: 44px;
    background: var(--blue);
    color: var(--white);
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 0 0 5px var(--blue-bg);
}
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

/* ── Radio Cards ── */
.radio-card-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.radio-card {
    flex: 1;
    position: relative;
}
.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.radio-card label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 46px;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}
.radio-card label:hover {
    border-color: var(--blue);
    background: var(--blue-bg);
}
.radio-card input:checked + label {
    background: var(--blue-bg);
    color: var(--blue);
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(28,117,187,.15);
}
.radio-card input:focus-visible + label {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}
.radio-card-danger input:checked + label {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

/* ── Wheelchair Alert ── */
.wheelchair-alert {
    background: var(--warning-bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--warning);
    margin-bottom: 1.5rem;
}
.wheelchair-alert-label {
    font-weight: 700;
    color: #8A3D06;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    margin-bottom: 10px;
}

/* ── Fieldsets (preguntas dinámicas) ── */
.question-fieldset {
    border: 1px solid var(--border-light);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    background: var(--white);
    transition: box-shadow var(--transition-fast);
}
.question-fieldset:hover { box-shadow: var(--shadow-sm); }

.question-fieldset legend {
    background: var(--bg-subtle);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.question-detail {
    display: none;
    margin-top: 12px;
    animation: slideUp 0.3s var(--ease-out);
}
.question-detail.active { display: block; }

/* ── File Upload ── */
.file-drop-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    border: 1.5px dashed #B9C6D4;
    border-radius: var(--radius);
    background: var(--bg-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}
.file-drop-area:hover, .file-drop-area.dragover {
    border-color: var(--blue);
    background: var(--blue-bg);
}
.file-drop-area.has-file {
    border-color: var(--success);
    background: var(--success-bg);
}
.file-drop-icon { color: var(--blue); margin-bottom: 8px; display: flex; }
.file-drop-text { color: var(--text-muted); font-size: 0.9rem; }
.file-drop-btn {
    background: var(--blue);
    color: var(--white);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 10px;
    pointer-events: none;
    text-transform: uppercase;
}
.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.file-preview {
    margin-top: 8px;
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--white);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--success);
}
.file-preview.active { display: flex; }

/* ── HC Alert ── */
.alert-hc {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--danger-bg);
    border: 1px solid #F5C6C6;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-top: 12px;
    animation: pulseAlert 2s ease-in-out 3;
}
.alert-hc-icon { color: var(--danger); flex-shrink: 0; display: flex; }
.alert-hc-text { color: #991b1b; font-size: 0.9rem; font-weight: 500; line-height: 1.5; }
.alert-hc-text strong { color: var(--danger); font-weight: 700; }

@keyframes pulseAlert {
    0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,0); }
    50%      { box-shadow: 0 0 0 6px rgba(198,40,40,.12); }
}

/* ── Red Nacional Notice ── */
.red-nacional-notice {
    background: var(--blue-50);
    border: 1px solid #C9DFF2;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    display: none;
}
.red-nacional-notice.active { display: block; }
.red-nacional-notice h3 { color: var(--blue-darker); margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.red-nacional-notice p { color: var(--text-muted); font-size: 0.95rem; }

/* ── Schedule Picker ── */
.schedule-picker { display: none; }
.schedule-picker.active { display: block; }

.calendar-widget {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.calendar-header h4 { font-size: 1rem; font-weight: 600; }
.calendar-nav {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
}
.calendar-nav:hover { background: var(--blue-bg); border-color: var(--blue); }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-day-name {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 6px 0;
    text-transform: uppercase;
}
.calendar-day {
    text-align: center;
    padding: 10px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: default;
    transition: all var(--transition-fast);
    color: var(--text-light);
}
.calendar-day.available {
    cursor: pointer;
    color: var(--text-main);
    background: var(--blue-bg);
    border: 1px solid transparent;
}
.calendar-day.available:hover {
    background: var(--blue);
    color: var(--white);
}
.calendar-day.selected {
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(28,117,187,.3);
}
.calendar-day.today {
    box-shadow: inset 0 0 0 2px var(--blue-light);
    font-weight: 700;
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 1rem;
}
.time-slot {
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 44px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    color: var(--text-main);
}
.time-slot:hover {
    border-color: var(--blue);
    background: var(--blue-bg);
}
.time-slot.selected {
    border-color: var(--blue);
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(28,117,187,.25);
}

/* ── Nav Buttons ── */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* ── Upload Instructions ── */
.upload-instructions {
    background: var(--info-bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px dashed #A9CBE6;
    text-align: center;
}
.upload-instructions .icon { color: var(--blue); margin-bottom: 6px; display: flex; justify-content: center; }
.upload-instructions strong { color: var(--blue-darker); }
.upload-instructions span { color: var(--text-muted); font-size: 0.9rem; }

/* ── Draft Badge ── */
.draft-badge {
    position: fixed;
    bottom: 20px; left: 20px;
    background: var(--white);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 6px;
    z-index: 900;
    border: 1px solid var(--border);
    animation: fadeBadge 3s forwards;
}
@keyframes fadeBadge {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Success Page ── */
.success-container {
    max-width: 600px;
    margin: 4rem auto;
    text-align: center;
    animation: slideUp 0.6s var(--ease-out);
}
.success-icon {
    width: 100px; height: 100px;
    background: var(--success-bg);
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin: 0 auto 1.5rem;
    box-shadow: 0 0 0 8px rgba(18,128,92,.08);
}
.success-code {
    display: inline-block;
    background: var(--blue-bg);
    color: var(--blue-darker);
    border: 1px dashed #A9CBE6;
    font-variant-numeric: tabular-nums;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 1rem 0;
}

/* ── Spinner Modal ── */
.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.94);
    z-index: 5000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.spinner-overlay.active { display: flex; }
.spinner-overlay .spinner { width: 60px; height: 60px; border-width: 5px; }
.spinner-text { margin-top: 1.5rem; font-weight: 600; font-size: 1.1rem; color: var(--blue); }
.spinner-subtext { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

/* ── Lookup Page ── */
.lookup-container {
    max-width: 650px;
    margin: 3rem auto;
    padding: 0 20px;
}
.lookup-card { animation: slideUp 0.5s var(--ease-out); }
.lookup-input-group {
    display: flex;
    gap: 10px;
}
.lookup-input-group .form-control {
    flex: 1;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    text-align: center;
}

/* ── Detail Row (public pages: success + lookup) ── */
.detail-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
    align-items: baseline;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.detail-value {
    color: var(--text-main);
    font-weight: 500;
    word-break: break-word;
}

/* ── Copy Button ── */
.code-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 0.5rem;
}
.copy-btn {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 44px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}
.copy-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-bg);
}
.copy-btn.copied {
    border-color: var(--success);
    color: var(--success);
    background: var(--success-bg);
}

/* ── Reschedule Calendar ── */
.reschedule-picker {
    margin-top: 1rem;
}
.reschedule-picker .calendar-widget {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.reschedule-selected-info {
    margin-top: 1rem;
    padding: 12px;
    background: var(--blue-bg);
    border: 1px solid rgba(28,117,187,.2);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--blue);
    text-align: center;
    display: none;
}
.reschedule-selected-info.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .form-wrapper { padding: 10px; }
    .form-body { padding: 1.5rem; }
    .form-header { padding: 1.5rem; gap: 1rem; }
    .form-header .brand-logo { max-width: 160px; }
    .form-header-overlay { padding-left: 0; border-left: none; }
    .form-header-overlay h1 { font-size: 1.3rem; }
    .section-title { font-size: 1.15rem; }
    .radio-card-group { flex-direction: column; }
    .nav-buttons { flex-direction: column; gap: 10px; }
    .nav-buttons .btn { width: 100%; }
    .lookup-input-group { flex-direction: column; }
    .detail-row { grid-template-columns: 1fr; gap: 2px; }
    .code-wrapper { flex-direction: column; }
}

