* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-image: linear-gradient(rgba(44, 62, 80, 0.8), rgba(52, 73, 94, 0.8)),
        url('https://www.regiomanager.de/wp-content/uploads/1995/08/schumacher-online-opener-2048x1280.jpg');
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.6;
}

.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    /* Use relative path so URL_PREFIX and static path resolve correctly */
    background-image: url('bilder/kontakt_hintergrund.jpg');
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mid-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.mid-nav img {
    height: 60px;
    width: auto;
}

/* Hamburger Menu - Verbessertes Touch-Target */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    padding: 12px;
    border-radius: 8px;
    min-width: 44px;
    /* Mindestgröße für Touch-Target */
    min-height: 44px;
    backdrop-filter: blur(5px);
    transition: background 0.3s ease;
}

.hamburger:hover {
    background: rgba(0, 0, 0, 0.5);
}

.hamburger:active {
    background: rgba(0, 0, 0, 0.6);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
    display: block;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Navigation */
.low-nav {
    padding: 15px 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

.low-nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    min-height: 44px;
    /* Touch-Target Größe */
    display: flex;
    align-items: center;
}

.low-nav a:hover {
    background: #34495e;
}

/* Mobile Menu - Verbessert */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(44, 62, 80, 0.98);
    backdrop-filter: blur(10px);
    z-index: 999;
    padding-top: 100px;
    transition: left 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling auf iOS */
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu a {
    display: block;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    padding: 18px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease;
    min-height: 56px;
    /* Größeres Touch-Target für Mobile */
    display: flex;
    align-items: center;
}

.mobile-menu a:hover,
.mobile-menu a:active {
    background: rgba(52, 73, 94, 0.7);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
}

.form-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.2em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 40px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 10px;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 3px;
    background: #e1e5e9;
    z-index: 0;
}

.progress-line {
    position: absolute;
    top: 20px;
    left: 0;
    height: 3px;
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    transition: width 0.3s ease;
    z-index: 1;
}

.step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
    /* Größeres Touch-Target */
}

.step:hover {
    transform: scale(1.05);
}

.step-number {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e1e5e9;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.step.active .step-number {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    color: white;
    transform: scale(1.1);
}

.step.completed .step-number {
    background: #4caf50;
    color: white;
}

.step-title {
    font-size: 0.85em;
    color: #999;
    font-weight: 500;
}

.step.active .step-title {
    color: #2c3e50;
    font-weight: 600;
}

/* Form Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-step h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8em;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.95em;
}

.required {
    color: #d32f2f;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    /* Größeres Padding für Touch */
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    /* Verhindert Zoom auf iOS */
    transition: all 0.3s ease;
    background: #fafafa;
    font-family: inherit;
    min-height: 44px;
    /* Touch-Target Größe */
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

select {
    appearance: none;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"%3E%3Cpath fill="%233498db" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    padding-right: 40px;
    /* Mehr Platz für das Icon */
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Radio Group - Verbessert für Touch */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 16px 16px;
    /* Größeres Padding */
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 52px;
    /* Touch-Target */
}

.radio-option:hover,
.radio-option:active {
    border-color: #3498db;
    background: white;
}

.radio-option.selected {
    border-color: #3498db;
    background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Checkbox - Verbessert für Touch */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    min-height: 52px;
}

.checkbox-group input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Subsection */
.subsection {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #3498db;
}

.subsection h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Buttons - Verbessert für Touch */
.button-group {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 16px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 52px;
    /* Touch-Target */
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #e1e5e9;
    color: #555;
}

.btn-secondary:hover {
    background: #d1d5d9;
}

.btn-secondary:active {
    background: #c1c5c9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Overview Section */
.overview-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.overview-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.overview-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e1e5e9;
}

.overview-row:last-child {
    border-bottom: none;
}

.overview-label {
    font-weight: 600;
    color: #555;
}

.overview-value {
    color: #2c3e50;
    word-break: break-word;
}

.edit-link {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    display: inline-block;
    margin-top: 10px;
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.edit-link:hover {
    text-decoration: underline;
}

.info-box {
    background: #e8f4fd;
    color: #1976d2;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #1976d2;
}

/* ------- Signature Pad --------- */

/* Signature Popup Styles */
.signature-popup {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.signature-popup-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.signature-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.3s;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-close:hover,
.signature-close:active {
    color: #000;
}

.signature-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #eee;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.signature-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
    min-height: 48px;
    white-space: nowrap;
    flex-shrink: 0;
}

.signature-tab.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
}

.signature-tab:hover,
.signature-tab:active {
    color: #0066cc;
}

.signature-tab-content {
    display: none;
}

.signature-tab-content.active {
    display: block;
}

.signature-canvas-container {
    border: 2px solid #ddd;
    border-radius: 5px;
    margin: 20px 0;
    background-color: white;
    touch-action: none;
    /* Wichtig für Touch-Zeichnen */
}

#signatureCanvas {
    display: block;
    width: 100%;
    touch-action: none;
}

.signature-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.signature-buttons button {
    min-height: 48px;
    padding: 12px 24px;
}

.signature-upload-area {
    border: 2px dashed #ddd;
    border-radius: 5px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.signature-upload-area:hover,
.signature-upload-area:active {
    border-color: #0066cc;
}

.upload-label {
    cursor: pointer;
    display: block;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Tablet Responsive (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 30px 15px;
    }

    .form-container {
        padding: 30px 25px;
    }

    h1 {
        font-size: 2em;
    }

    .form-step h2 {
        font-size: 1.6em;
    }
}

/* Mobile Responsive (unter 768px) */
@media (max-width: 768px) {

    /* Hamburger Menu anzeigen */
    .hamburger {
        display: flex;
    }

    /* Desktop Navigation verstecken */
    .low-nav {
        display: none;
    }

    /* Mobile Menu aktivieren */
    .mobile-menu {
        display: block;
    }

    /* Header Logo kleiner */
    .mid-nav img {
        height: 45px;
    }

    .mid-nav {
        padding: 15px;
    }

    /* Container anpassen */
    .container {
        padding: 20px 15px;
    }

    .form-container {
        padding: 25px 15px;
        border-radius: 10px;
    }

    /* Überschriften */
    h1 {
        font-size: 1.6em;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 0.95em;
        margin-bottom: 25px;
    }

    .form-step h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
    }

    /* Progress Bar für Mobile optimiert */
    .progress-steps {
        gap: 5px;
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .step-title {
        font-size: 0.65em;
        line-height: 1.2;
    }

    /* Form Layout */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Input Felder */
    input[type="text"],
    input[type="email"],
    input[type="date"],
    input[type="number"],
    select,
    textarea {
        padding: 14px 12px;
        font-size: 16px;
        /* Verhindert iOS Zoom */
    }

    textarea {
        min-height: 100px;
    }

    /* Buttons */
    .button-group {
        flex-direction: column;
        gap: 12px;
    }

    .btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 16px;
    }

    /* Overview */
    .overview-row {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 10px 0;
    }

    .overview-label {
        font-size: 0.9em;
    }

    .overview-value {
        font-size: 1em;
        padding-left: 0;
    }

    /* Subsection */
    .subsection {
        padding: 15px;
        margin: 15px 0;
    }

    .subsection h3 {
        font-size: 1.1em;
    }

    /* Info Box */
    .info-box {
        padding: 12px;
        font-size: 0.9em;
    }

    /* Signature Popup */
    .signature-popup-content {
        padding: 20px 15px;
        width: 95%;
        max-height: 85vh;
    }

    .signature-close {
        right: 10px;
        top: 10px;
        font-size: 28px;
    }

    .signature-tabs {
        gap: 5px;
        margin: 15px 0;
    }

    .signature-tab {
        padding: 10px 15px;
        font-size: 14px;
        min-height: 44px;
    }

    .signature-canvas-container {
        margin: 15px 0;
    }

    #signatureCanvas {
        height: 200px;
    }

    .signature-buttons {
        justify-content: stretch;
    }

    .signature-buttons button {
        flex: 1;
        min-width: 100px;
    }

    .signature-upload-area {
        padding: 30px 20px;
        min-height: 120px;
    }

    .upload-icon {
        font-size: 36px;
    }
}

/* Extra kleine Geräte (unter 480px) */
@media (max-width: 480px) {
    .form-container {
        padding: 20px 12px;
    }

    h1 {
        font-size: 1.4em;
    }

    .form-step h2 {
        font-size: 1.2em;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .step-title {
        font-size: 0.6em;
    }

    /* Noch kompaktere Inputs */
    input[type="text"],
    input[type="email"],
    input[type="date"],
    input[type="number"],
    select,
    textarea {
        padding: 12px 10px;
    }

    .radio-option,
    .checkbox-group {
        padding: 14px 12px;
    }

    .btn {
        padding: 14px 16px;
    }

    /* Signature Popup noch kompakter */
    .signature-popup-content {
        padding: 15px 10px;
    }

    .signature-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    #signatureCanvas {
        height: 180px;
    }
}

/* Landscape Mode für Smartphones */
@media (max-height: 500px) and (orientation: landscape) {
    .form-container {
        padding: 15px;
    }

    .progress-container {
        margin-bottom: 20px;
    }

    .form-step h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .signature-popup-content {
        max-height: 95vh;
        padding: 15px;
    }

    #signatureCanvas {
        height: 150px;
    }
}

/* Touch-Feedback für alle interaktiven Elemente */
@media (hover: none) and (pointer: coarse) {

    .btn:active,
    .radio-option:active,
    .checkbox-group:active,
    .edit-link:active,
    .signature-tab:active {
        opacity: 0.7;
    }
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.modal-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.modal-icon.error {
    background: linear-gradient(135deg, #f44336, #e91e63);
    color: white;
}

.modal-icon.success {
    background: linear-gradient(135deg, #4caf50, #8bc34a);
    color: white;
}

.modal-icon.warning {
    background: linear-gradient(135deg, #ff9800, #ffc107);
    color: white;
}

.modal-icon.info {
    background: linear-gradient(135deg, #2196f3, #03a9f4);
    color: white;
}

.modal-title {
    font-size: 1.5em;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.modal-body {
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 1.05em;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.modal-btn-secondary {
    background: #e0e0e0;
    color: #555;
}

.modal-btn-secondary:hover {
    background: #d0d0d0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .modal-container {
        padding: 25px 20px;
    }

    .modal-title {
        font-size: 1.3em;
    }

    .modal-body {
        font-size: 1em;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}