/* ============================================================
   GFA-Public – Styles
   Schlankes, modernes Branding – ohne Abhängigkeit zur Aufmass-App
   ============================================================ */

:root {
    --gfa-primary:       #c8102e;    /* GFA-Rot (Branding) */
    --gfa-primary-dark:  #9c0c24;
    --gfa-primary-light: #f3d0d5;
    --gfa-text:          #212529;
    --gfa-text-muted:    #6c757d;
    --gfa-border:        #dee2e6;
    --gfa-bg:            #f8f9fa;
    --gfa-bg-card:       #ffffff;
    --gfa-success:       #2d8a3c;
    --gfa-danger:        #c8102e;
    --gfa-warning:       #e69500;
    --gfa-radius:        8px;
    --gfa-shadow:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --gfa-shadow-lg:     0 4px 12px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--gfa-text);
    background: var(--gfa-bg);
}
a { color: var(--gfa-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------- Header + Step-Nav ------------- */
.gfa-header {
    background: var(--gfa-bg-card);
    box-shadow: var(--gfa-shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}
.gfa-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gfa-header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--gfa-text);
    font-weight: 700;
    font-size: 18px;
}
.gfa-header-logo:hover { text-decoration: none; }
.gfa-header-logo img { height: 36px; width: auto; }
.gfa-header-reset {
    color: var(--gfa-text-muted);
    font-size: 14px;
}

.gfa-steps {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 12px;
    display: flex;
    gap: 8px;
}
.gfa-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--gfa-radius);
    background: var(--gfa-bg);
    color: var(--gfa-text-muted);
    border: 1px solid transparent;
    transition: all 0.15s;
}
.gfa-step:hover:not(.is-disabled) {
    background: #eef0f3;
    text-decoration: none;
}
.gfa-step.is-current {
    background: var(--gfa-primary-light);
    color: var(--gfa-primary);
    border-color: var(--gfa-primary);
    font-weight: 600;
}
.gfa-step.is-done:not(.is-current) {
    color: var(--gfa-success);
}
.gfa-step.is-done:not(.is-current) .gfa-step-num {
    background: var(--gfa-success);
    color: #fff;
}
.gfa-step.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}
.gfa-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gfa-border);
    color: var(--gfa-text-muted);
    font-weight: 700;
    flex-shrink: 0;
}
.gfa-step.is-current .gfa-step-num {
    background: var(--gfa-primary);
    color: #fff;
}

/* ------------- Main + Footer ------------- */
.gfa-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}
.gfa-footer {
    border-top: 1px solid var(--gfa-border);
    background: var(--gfa-bg-card);
    padding: 16px 0;
}
.gfa-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    font-size: 13px;
    color: var(--gfa-text-muted);
}
.gfa-footer-sep { margin: 0 8px; color: var(--gfa-border); }

/* ------------- Panels ------------- */
.gfa-panel {
    background: var(--gfa-bg-card);
    border-radius: var(--gfa-radius);
    box-shadow: var(--gfa-shadow);
    padding: 28px;
    margin-bottom: 20px;
}
.gfa-panel h1 { margin-top: 0; font-size: 24px; }
.gfa-panel h2 { font-size: 18px; margin-top: 24px; }
.gfa-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.gfa-panel-head h1 { margin: 0; }
.gfa-lead {
    color: var(--gfa-text-muted);
    font-size: 15px;
    margin-bottom: 24px;
}

/* ------------- Hinweise ------------- */
.gfa-hinweis {
    padding: 12px 16px;
    border-radius: var(--gfa-radius);
    margin-bottom: 18px;
    font-size: 14px;
}
.gfa-hinweis-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.gfa-hinweis-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.gfa-hinweis-warnung { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.gfa-fehler {
    color: var(--gfa-danger);
    font-size: 13px;
    margin-top: 4px;
}

/* ------------- Forms ------------- */
.gfa-form fieldset {
    border: none;
    padding: 0;
    margin: 0 0 20px 0;
}
.gfa-fieldset {
    border: 1px solid var(--gfa-border) !important;
    border-radius: var(--gfa-radius);
    padding: 16px 20px !important;
    margin-bottom: 20px !important;
}
.gfa-fieldset legend {
    font-weight: 700;
    color: var(--gfa-primary);
    padding: 0 6px;
}
.gfa-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.gfa-form-field {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
}
.gfa-form-field-full { flex-basis: 100%; }
.gfa-form-field-small { flex: 0 1 160px; }
.gfa-form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}
.gfa-required { color: var(--gfa-danger); }
.gfa-form input[type="text"],
.gfa-form input[type="email"],
.gfa-form input[type="tel"],
.gfa-form input[type="number"],
.gfa-form textarea,
.gfa-form select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    font-size: 15px;
    background: #fff;
    color: var(--gfa-text);
    font-family: inherit;
}
.gfa-form input:focus,
.gfa-form textarea:focus,
.gfa-form select:focus {
    outline: none;
    border-color: var(--gfa-primary);
    box-shadow: 0 0 0 3px var(--gfa-primary-light);
}
.gfa-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.gfa-actions-end { justify-content: flex-end; }
.gfa-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.gfa-datenschutz-hinweis {
    margin-top: 20px;
    font-size: 13px;
    color: var(--gfa-text-muted);
}
.gfa-checkbox-label {
    display: block;
    padding: 12px;
    background: var(--gfa-bg);
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    font-size: 14px;
    margin: 16px 0;
    cursor: pointer;
}
.gfa-checkbox-label input { margin-right: 8px; }

/* ------------- Buttons ------------- */
.gfa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--gfa-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.05s;
    font-family: inherit;
}
.gfa-btn:hover { text-decoration: none; }
.gfa-btn:active { transform: translateY(1px); }
.gfa-btn-primary { background: var(--gfa-primary); color: #fff; }
.gfa-btn-primary:hover { background: var(--gfa-primary-dark); }
.gfa-btn-secondary {
    background: #fff;
    color: var(--gfa-text);
    border: 1px solid var(--gfa-border);
}
.gfa-btn-secondary:hover { background: var(--gfa-bg); }
.gfa-btn-danger { background: var(--gfa-danger); color: #fff; }
.gfa-btn-danger:hover { background: var(--gfa-primary-dark); }
.gfa-btn-small { padding: 6px 10px; font-size: 13px; }
.gfa-btn-large { padding: 14px 28px; font-size: 17px; }
.gfa-btn-file { position: relative; overflow: hidden; }
.gfa-btn-file input[type="file"] {
    position: absolute;
    top: 0; left: 0;
    opacity: 0;
    width: 100%; height: 100%;
    cursor: pointer;
}
.gfa-btn-markierung { background: var(--gfa-warning); color: #fff; }
.gfa-btn-markierung:hover { background: #c68200; }

/* ------------- Material/Holz-Ausführung Grid ------------- */
.gfa-material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.gfa-material-option { cursor: pointer; }
.gfa-material-option input { position: absolute; opacity: 0; }
.gfa-material-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    background: #fff;
    transition: all 0.15s;
}
.gfa-material-option:hover .gfa-material-inner { border-color: var(--gfa-primary-light); }
.gfa-material-option input:checked + .gfa-material-inner {
    border-color: var(--gfa-primary);
    background: var(--gfa-primary-light);
}
.gfa-material-inner img {
    max-width: 100%;
    max-height: 70px;
    height: auto;
    object-fit: contain;
}
.gfa-material-label {
    font-size: 14px;
    text-align: center;
    font-weight: 600;
}

/* ------------- Foto-Slot ------------- */
.gfa-foto-slot {
    padding: 12px;
    border: 2px dashed var(--gfa-border);
    border-radius: var(--gfa-radius);
    text-align: center;
    background: var(--gfa-bg);
}
.gfa-foto-preview {
    max-width: 100%;
    max-height: 280px;
    border-radius: var(--gfa-radius);
    box-shadow: var(--gfa-shadow);
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.gfa-foto-placeholder {
    padding: 30px;
    color: var(--gfa-text-muted);
    font-style: italic;
}
.gfa-foto-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.gfa-skizze-notiz {
    margin-top: 8px;
    font-size: 12px;
    color: var(--gfa-warning);
    font-weight: 600;
}

/* ------------- Tabellen ------------- */
.gfa-messungen-tabelle,
.gfa-zusammenfassung-tabelle {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 20px;
    font-size: 14px;
}
.gfa-messungen-tabelle th,
.gfa-messungen-tabelle td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--gfa-border);
}
.gfa-messungen-tabelle thead th {
    background: var(--gfa-bg);
    font-weight: 700;
    font-size: 13px;
    color: var(--gfa-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.gfa-messungen-tabelle tbody tr:hover { background: #fafbfc; }
.gfa-zusammenfassung-tabelle th {
    padding: 8px 12px 8px 0;
    font-weight: 600;
    color: var(--gfa-text-muted);
    text-align: left;
    width: 30%;
}
.gfa-zusammenfassung-tabelle td { padding: 8px 0; }
.gfa-col-actions { text-align: right; white-space: nowrap; }
.gfa-col-actions > * { margin-left: 4px; }
.gfa-inline-form { display: inline; }

.gfa-kontakt-box {
    background: var(--gfa-bg);
    padding: 14px 18px;
    border-radius: var(--gfa-radius);
    margin-bottom: 18px;
}
.gfa-kontakt-meta {
    color: var(--gfa-text-muted);
    font-size: 14px;
}
.gfa-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gfa-text-muted);
}
.gfa-empty p { margin-bottom: 18px; }

/* ------------- Dichtungstyp-Auswahl (Dropdown + Button + Vorschau) ------------- */
.gfa-dichtungstyp-auswahl {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}
.gfa-dichtungstyp-auswahl select {
    flex: 1;
    min-width: 220px;
}
.gfa-dichtungstyp-auswahl .gfa-btn {
    flex-shrink: 0;
}
.gfa-dichtungstyp-vorschau {
    margin-top: 10px;
    padding: 14px;
    background: var(--gfa-bg);
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    text-align: center;
    position: relative;
}
.gfa-dichtungstyp-vorschau img {
    max-width: 100%;
    max-height: 220px;
    display: inline-block;
    border-radius: var(--gfa-radius);
    background: #fff;
    padding: 4px;
}
.gfa-dichtungstyp-vorschau-badge {
    display: inline-block;
    margin-top: 8px;
    background: var(--gfa-warning);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}
.gfa-dichtungstyp-vorschau-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}
.gfa-dichtungstyp-vorschau-hinweis {
    font-size: 13px;
    color: var(--gfa-text-muted);
    margin: 10px 0 0 0;
    font-style: italic;
}

/* ------------- Grafische Dichtungstyp-Auswahl (Popup-Grid) ------------- */
.gfa-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--gfa-bg);
}
.gfa-dichtungstyp-popup-hinweis {
    color: var(--gfa-text-muted);
    margin: 0 0 16px 0;
    font-size: 14px;
}
.gfa-dichtungstyp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.gfa-dichtungstyp-grid-loading,
.gfa-dichtungstyp-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gfa-text-muted);
    padding: 30px;
    font-style: italic;
}
.gfa-dichtungstyp-kachel {
    background: #fff;
    border: 2px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    padding: 12px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    text-align: center;
}
.gfa-dichtungstyp-kachel:hover {
    border-color: var(--gfa-primary);
    box-shadow: var(--gfa-shadow);
    transform: translateY(-2px);
}
.gfa-dichtungstyp-kachel.is-selected {
    border-color: var(--gfa-primary);
    background: var(--gfa-primary-light);
}
.gfa-dichtungstyp-kachel img {
    max-width: 100%;
    max-height: 130px;
    object-fit: contain;
}
.gfa-dichtungstyp-kachel-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gfa-text);
    line-height: 1.3;
}

/* Scrollbares Modal-Inhaltsfenster */
.gfa-modal-content-scroll {
    display: flex;
    flex-direction: column;
}

/* ------------- Modal ------------- */
.gfa-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}
.gfa-modal.is-visible { display: block; }
.gfa-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.gfa-modal-content {
    position: absolute;
    top: 2vh; left: 2vw; right: 2vw; bottom: 2vh;
    background: #fff;
    border-radius: var(--gfa-radius);
    box-shadow: var(--gfa-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.gfa-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gfa-border);
    background: var(--gfa-bg);
}
.gfa-modal-header h3 { margin: 0; font-size: 16px; }
.gfa-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 10px;
}
.gfa-modal iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* ------------- Skizzen-Editor (innerhalb iframe) ------------- */
.gfa-skizze-body {
    background: #fff;
    padding: 16px;
    margin: 0;
}
.gfa-skizze-wrapper {
    max-width: 800px;
    margin: 0 auto;
}
.gfa-skizze-hinweis {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 10px 14px;
    border-radius: var(--gfa-radius);
    margin-bottom: 16px;
    font-size: 13px;
}
.gfa-skizze-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gfa-border);
}

/* Canvas-Editor-Styles (kompatibel zu script_canvas_editor_background.js) */
.bild-skizze-canvas-container {
    overflow: auto;
    max-height: 60vh;
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    background: #fff;
    padding: 8px;
    text-align: center;
}
.bild-skizze-canvas { background: #fff; touch-action: none; }
.bild-skizze-controls { margin: 14px 0; }
.bild-skizze-controls .control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.bild-skizze-label { font-weight: 600; font-size: 14px; }
.bild-skizze-tool-btn {
    padding: 6px 12px;
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}
.bild-skizze-tool-btn:hover { background: var(--gfa-bg); }
.bild-skizze-tool-btn-danger {
    color: var(--gfa-danger);
    border-color: var(--gfa-danger);
}
.bild-skizze-button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.bild-skizze-history {
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    padding: 10px;
    margin-bottom: 10px;
    max-height: 160px;
    overflow-y: auto;
    background: var(--gfa-bg);
}
.bild-skizze-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.bild-skizze-log-list {
    margin: 0;
    padding-left: 20px;
    font-size: 12px;
    color: var(--gfa-text-muted);
}
.bild-skizze-prompt {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px;
    border-radius: var(--gfa-radius);
    box-shadow: var(--gfa-shadow-lg);
    z-index: 1000;
    min-width: 300px;
}
.bild-skizze-prompt-message { margin-bottom: 10px; }
.bild-skizze-prompt-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--gfa-border);
    border-radius: var(--gfa-radius);
    margin-bottom: 10px;
}
.bild-skizze-prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ------------- Danke-Seite ------------- */
.gfa-panel-danke {
    text-align: center;
    padding: 50px 30px;
}
.gfa-danke-icon {
    font-size: 80px;
    color: var(--gfa-success);
    margin-bottom: 10px;
    line-height: 1;
}
.gfa-panel-danke h1 { color: var(--gfa-success); }
.gfa-panel-danke p { font-size: 16px; max-width: 600px; margin: 12px auto; }
.gfa-panel-danke .gfa-form-actions { justify-content: center; margin-top: 30px; }

/* ------------- Responsive ------------- */
@media (max-width: 640px) {
    .gfa-main { padding: 12px; }
    .gfa-panel { padding: 18px; }
    .gfa-steps { flex-direction: column; padding: 0 12px 12px; }
    .gfa-step { flex: none; }
    .gfa-form-row { flex-direction: column; }
    .gfa-form-field { min-width: 0; }
    .gfa-panel-head { flex-direction: column; align-items: stretch; }
    .gfa-messungen-tabelle thead { display: none; }
    .gfa-messungen-tabelle,
    .gfa-messungen-tabelle tbody,
    .gfa-messungen-tabelle tr,
    .gfa-messungen-tabelle td { display: block; width: 100%; }
    .gfa-messungen-tabelle tr {
        border: 1px solid var(--gfa-border);
        border-radius: var(--gfa-radius);
        margin-bottom: 10px;
        padding: 8px;
    }
    .gfa-messungen-tabelle td { border: none; padding: 4px 0; }
    .gfa-messungen-tabelle td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--gfa-text-muted);
        margin-right: 8px;
    }
    .gfa-col-actions { text-align: left; }
}
