/* ============================================================
   GSW Anmeldesystem – Öffentliches Formular
   ============================================================ */

@import url('../fonts/fonts.css');

:root {
    --gsw-primary: #2c5f7c;
    --gsw-primary-dark: #1e4258;
    --gsw-primary-light: #e8f0f5;
    --gsw-accent: #e8913a;
    --gsw-success: #198754;
    --gsw-radius: 14px;
    --gsw-radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    margin: 0; color: #1a1a1a;
}

/* Header */
.form-header {
    background: var(--gsw-primary);
    color: white; padding: 24px 0; text-align: center;
}

.form-header h1 {
    font-size: 1.4rem; font-weight: 700; margin: 0;
}

.form-header .subtitle {
    font-size: 0.9rem; opacity: .75; margin-top: 4px;
}

.form-header .badge-typ {
    display: inline-block; background: rgba(255,255,255,.2);
    padding: 4px 14px; border-radius: 20px; font-size: 0.8rem;
    font-weight: 600; margin-top: 8px;
}

/* Stepper */
.stepper {
    display: flex; justify-content: center; gap: 0;
    padding: 20px 16px; background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    overflow-x: auto;
}

.step {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; font-size: 0.82rem;
    color: #adb5bd; font-weight: 500;
    white-space: nowrap; cursor: pointer;
    border-radius: var(--gsw-radius-sm);
    transition: all .2s;
    /* Stepper-Schritte sind echte Buttons (Tastaturbedienung) */
    background: transparent; border: 0; font-family: inherit;
}

.step:hover { background: #f8f9fa; }

.step:focus-visible {
    outline: 3px solid var(--gsw-primary);
    outline-offset: 2px;
}

.step .step-num {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    background: #e9ecef; color: #6c757d;
    flex-shrink: 0;
}

.step.active { color: var(--gsw-primary); font-weight: 600; }
.step.active .step-num { background: var(--gsw-primary); color: white; }

.step.done { color: var(--gsw-success); }
.step.done .step-num { background: var(--gsw-success); color: white; }

.step-connector {
    width: 24px; height: 2px; background: #e9ecef;
    flex-shrink: 0; align-self: center;
}

.step-connector.done { background: var(--gsw-success); }

/* Form Container */
.form-container {
    max-width: 960px; margin: 24px auto; padding: 0 16px;
}

/* Form Card */
.form-card {
    background: white; border-radius: var(--gsw-radius);
    padding: 28px; margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border: 1px solid #e9ecef;
}

.form-card h4 {
    font-weight: 700; color: var(--gsw-primary);
    margin-bottom: 20px; font-size: 1.15rem;
}

.form-card h5 {
    font-weight: 600; color: #495057; font-size: 1rem;
    margin: 20px 0 12px; padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.form-card h5:first-of-type { border-top: none; padding-top: 0; }

/* Form Fields */
.form-label {
    font-weight: 600; font-size: 0.88rem; color: #495057;
    margin-bottom: 4px;
}

.form-label .required {
    color: #dc3545; font-weight: 400;
}

.form-control, .form-select {
    border-radius: var(--gsw-radius-sm);
    padding: 9px 14px; font-size: 0.95rem;
    border: 1.5px solid #dee2e6;
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--gsw-primary);
    box-shadow: 0 0 0 3px rgba(44, 95, 124, .12);
}

.form-text {
    font-size: 0.8rem; color: #6c757d; margin-top: 3px;
}

/* Checkboxes in form */
.consent-block {
    background: #f8f9fa; border-radius: var(--gsw-radius-sm);
    padding: 14px 16px; margin-bottom: 10px;
    border: 1px solid #e9ecef;
}

.consent-block .form-check-label {
    font-size: 1rem; font-weight: 600;
}

.consent-block .consent-detail {
    font-size: 0.92rem; color: #6c757d; margin-top: 6px; margin-left: 24px;
    line-height: 1.5;
}

/* Navigation Buttons */
.form-nav {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.btn-nav {
    padding: 10px 24px; border-radius: var(--gsw-radius-sm);
    font-weight: 600; font-size: 0.95rem;
    border: none; cursor: pointer;
    transition: all .15s;
}

.btn-prev {
    background: #f0f0f0; color: #495057;
}

.btn-prev:hover { background: #e0e0e0; }

.btn-next {
    background: var(--gsw-primary); color: white;
}

.btn-next:hover { background: var(--gsw-primary-dark); }

.btn-submit {
    background: var(--gsw-success); color: white;
}

.btn-submit:hover { background: #157347; }

/* Summary Table */
.summary-section {
    margin-bottom: 16px;
}

.summary-section h5 {
    font-size: 0.95rem; font-weight: 700; color: var(--gsw-primary);
    border-bottom: 2px solid var(--gsw-primary-light);
    padding-bottom: 6px;
}

.summary-row {
    display: flex; padding: 6px 0;
    border-bottom: 1px solid #f5f5f5; font-size: 0.9rem;
}

.summary-label {
    width: 40%; color: #6c757d; font-weight: 500;
}

.summary-value {
    width: 60%; font-weight: 500;
}

/* DSGVO Notice */
.dsgvo-notice {
    background: #fff3cd; border: 1px solid #ffc107;
    border-radius: var(--gsw-radius-sm);
    padding: 14px 16px; margin-bottom: 16px;
    font-size: 0.85rem; color: #664d03;
}

.dsgvo-notice i { margin-right: 4px; }

/* Success Page */
.success-page {
    text-align: center; padding: 60px 20px;
}

.success-icon {
    width: 80px; height: 80px; border-radius: 50%;
    background: #d1e7dd; display: flex;
    align-items: center; justify-content: center;
    margin: 0 auto 20px; font-size: 36px; color: var(--gsw-success);
}

/* Slot Grid (Terminbuchung) */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.slot-card {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 12px 8px;
    border-radius: var(--gsw-radius-sm);
    border: 2px solid #e9ecef;
    text-align: center;
    transition: all .15s;
}

.slot-card.frei {
    cursor: pointer;
    border-color: #c3e6cb;
    background: #f8fff9;
}

.slot-card.frei:hover {
    border-color: var(--gsw-primary);
    background: var(--gsw-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(44, 95, 124, .12);
}

.slot-card.frei.selected {
    border-color: var(--gsw-primary);
    background: var(--gsw-primary);
    color: white;
}

.slot-card.frei.selected .slot-info {
    color: rgba(255,255,255,.8);
}

.slot-card.ausgebucht {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

.slot-zeit {
    font-size: 1rem; font-weight: 700;
    line-height: 1.2;
}

.slot-info {
    font-size: 0.7rem; color: #6c757d;
    margin-top: 2px;
}

/* Language Selector */
.lang-selector {
    display: flex; gap: 6px; justify-content: center; margin-top: 8px;
}

.lang-btn {
    padding: 4px 14px; border-radius: 14px; font-size: 0.85rem; font-weight: 600;
    border: 1.5px solid rgba(255,255,255,.3); color: rgba(255,255,255,.7);
    background: transparent; cursor: pointer; transition: all .15s;
}

.lang-btn:hover, .lang-btn.active {
    background: rgba(255,255,255,.25); color: white; border-color: white;
}

/* i18n Subtitle */
.i18n-sub {
    display: block; font-size: 0.85rem; color: #2c5f7c;
    font-style: normal; font-weight: 400;
    margin-top: 4px; padding: 3px 8px;
    background: #e8f0f5;
    /* logische Eigenschaften: Markierung liegt in RTL automatisch rechts */
    border-inline-start: 3px solid #2c5f7c;
    border-radius: 4px; line-height: 1.4;
}

/* Rechts-nach-links (Arabisch): Ausrichtung spiegeln */
[dir="rtl"] body,
[dir="rtl"] .form-card,
[dir="rtl"] .consent-block,
[dir="rtl"] .summary-row { text-align: right; }
[dir="rtl"] .i18n-sub { text-align: right; }

/* PDF Viewer Blocks */
.pdf-viewer-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--gsw-radius);
    padding: 16px;
    margin: 12px 0;
}

.pdf-viewer-card h5 {
    font-size: 1rem; font-weight: 600; color: var(--gsw-primary);
    margin: 0 0 8px; padding: 0; border: none;
}

.pdf-viewer-frame {
    width: 100%;
    height: 500px;
    border: 1px solid #dee2e6;
    border-radius: var(--gsw-radius-sm);
}

/* Large PDF viewer for dedicated PDF pages */
.pdf-viewer-frame-lg {
    width: 100%;
    height: 65vh;
    min-height: 450px;
    border: 1px solid #dee2e6;
    border-radius: var(--gsw-radius-sm);
}

.pdf-confirm-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-top: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--gsw-radius-sm);
    font-size: 0.95rem;
    transition: border-color .2s;
}

.pdf-confirm-block.highlight {
    border-color: #dc3545;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .15);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.pdf-confirm-block label {
    margin: 0;
    font-weight: 600;
}

.pdf-hint-block {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    margin: 8px 0;
    background: var(--gsw-primary-light);
    border-left: 3px solid var(--gsw-primary);
    border-radius: 0 var(--gsw-radius-sm) var(--gsw-radius-sm) 0;
    font-size: 0.92rem;
}

.pdf-hint-block i {
    color: var(--gsw-primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.pdf-hint-block strong {
    display: block;
    margin-bottom: 2px;
}

/* Address Copy Toggle (Gleiche Adresse) */
.adress-copy-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #d4edda;
    border: 1.5px solid #28a745;
    border-radius: var(--gsw-radius-sm);
    cursor: pointer;
    transition: all .15s;
}

.adress-copy-toggle:hover {
    background: #c3e6cb;
}

.adress-copy-toggle .form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin: 0;
    border-color: #28a745;
}

.adress-copy-toggle .form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.adress-copy-toggle .form-check-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #155724;
    cursor: pointer;
    margin: 0;
}

.adress-copy-toggle .form-check-label i {
    color: #28a745;
    margin-right: 2px;
}

/* Härtefall Block */
.haertefall-block {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: var(--gsw-radius-sm);
    padding: 16px 20px;
    transition: border-color .3s, background .3s;
}

.haertefall-block.unanswered {
    border-color: var(--gsw-accent);
    background: #fff8f0;
}

/* Grouped Confirmation + Consent */
.confirm-consent-group {
    margin-top: 16px;
    border: 1px solid #e0e0e0;
    border-radius: var(--gsw-radius-sm);
    overflow: hidden;
}

.confirm-consent-group .pdf-confirm-block {
    margin-top: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #e0e0e0;
}

.confirm-consent-group .consent-block {
    margin-bottom: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #eee;
}

.confirm-consent-group .consent-block:last-child {
    border-bottom: none;
}

/* Sub-page system for multi-PDF steps */
.step-subpage { display: none; }
.step-subpage.active { display: block; }

.substep-nav {
    text-align: center;
    padding: 16px 0 4px;
}

.substep-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}

.substep-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    transition: background .2s, transform .2s;
    cursor: pointer;
}

.substep-dot.active {
    background: var(--gsw-primary);
    transform: scale(1.2);
}

.substep-dot.done {
    background: var(--gsw-success);
}

.substep-label {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Responsive – Tablet */
@media (min-width: 768px) and (max-width: 1199px) {
    .form-container { max-width: 90vw; }
    .form-card { padding: 32px; }
}

/* Responsive – Desktop */
@media (min-width: 1200px) {
    .form-container { max-width: 960px; }
    .form-card { padding: 36px 48px; }
}

/* Responsive – Mobil */
@media (max-width: 600px) {
    .form-container { max-width: 100%; padding: 0 10px; }
    .form-card { padding: 20px 16px; }
    .step .step-label { display: none; }
    .step-connector { width: 12px; }
    .form-nav { flex-direction: column; gap: 8px; }
    .form-nav .btn-nav { width: 100%; text-align: center; }
    .slot-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .lang-btn { padding: 3px 10px; font-size: 0.78rem; }
    .pdf-viewer-frame { height: 350px; }
    .pdf-viewer-frame-lg { height: 50vh; min-height: 300px; }
}

/* ============================================================
   UX-Verbesserungen 2026-07
   ============================================================ */

/* Info Notice (z. B. Hinweis auf Zwischenspeichern) */
.info-notice {
    background: var(--gsw-primary-light); border: 1px solid var(--gsw-primary);
    border-radius: var(--gsw-radius-sm);
    padding: 14px 16px; margin-bottom: 16px;
    font-size: 0.85rem; color: var(--gsw-primary-dark);
}

.info-notice i { margin-right: 4px; }

/* Schritt-Anzeige (wichtig auf Mobil, wo Stepper-Labels ausgeblendet sind) */
.step-indicator {
    font-size: 0.9rem; color: #6c757d; margin: 0 0 12px;
}

/* Speicher-Feedback nach jedem Zwischenspeichern */
.save-feedback {
    background: #d1e7dd; border: 1px solid #a3cfbb;
    border-radius: var(--gsw-radius-sm);
    padding: 10px 16px; margin-bottom: 16px;
    font-size: 0.88rem; color: #0f5132;
    transition: opacity .5s;
}

.save-feedback i { margin-right: 4px; }

/* Fehler-Karte bei der Abschlussvalidierung */
.error-card {
    border: 2px solid #dc3545 !important;
    background: #fff5f5 !important;
}

.error-card-title { color: #dc3545; }

.error-card-intro { font-size: 0.9rem; color: #6c757d; }

.error-link {
    display: block; width: 100%; text-align: left;
    background: transparent; border: 0; font-family: inherit;
    font-size: 0.9rem; padding: 6px 4px; color: #dc3545;
    cursor: pointer; border-radius: 6px;
    text-decoration: none;
}

.error-link:hover, .error-link:focus-visible { background: #ffe3e3; }

.error-link:focus-visible { outline: 2px solid #dc3545; outline-offset: 1px; }

.error-link .error-link-step {
    color: var(--gsw-primary); font-weight: 600; text-decoration: underline;
    margin-left: 4px;
}

/* IBAN Inline-Validierung */
.iban-feedback { font-size: 0.8rem; margin-top: 3px; }
.iban-feedback.valid { color: var(--gsw-success); }
.iban-feedback.invalid { color: #dc3545; }
