/* Modal Styling */
.modal-xl {
    max-width: 1200px;
}

.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-body {
    padding: 2rem;
}

/* Modal Intro */
.modal-title-block {
    max-width: 760px;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.modal-back-button {
    display: none;
    align-items: center;
    white-space: nowrap;
}

#anfragemodul.selector-visible .modal-title-block {
    display: block;
}

#anfragemodul:not(.selector-visible) .modal-title-block {
    display: none;
}

#anfragemodul:not(.selector-visible) .modal-back-button {
    display: inline-flex;
}

.modal-kicker {
    display: inline-block;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #b61f29;
}

.modal-title {
    margin-bottom: 0.35rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #212529;
}

.modal-subtitle {
    color: #6c757d;
    line-height: 1.6;
}

.request-selector {
    display: none;
}

.request-selector.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

.request-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.request-option {
    border: 1px solid #e9ecef;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    padding: 1.5rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.request-option:hover {
    transform: translateY(-4px);
    border-color: #cdd6f4;
    box-shadow: 0 18px 36px rgba(102, 126, 234, 0.14);
}

.request-option-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    background: linear-gradient(135deg, #b61f29 0%, #690c12 100%);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.24);
}

.request-option-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
}

.request-option-text {
    color: #6c757d;
    line-height: 1.55;
}

.request-content {
    position: relative;
}

.request-pane {
    display: none;
}

.request-pane.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

/* Close Button */
.btn-close {
    background-color: #f1f3f5;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    opacity: 0.8;
    flex-shrink: 0;
}

.btn-close:hover {
    opacity: 1;
    background-color: #e9ecef;
}

/* Multi-step Progress */
.multistep-progress {
    margin-bottom: 2rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
    scroll-behavior: smooth;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
    transform: translateY(-50%);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    background: #fff;
    padding: 0 1rem;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.step-title {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.step-title-short {
    display: none;
}

.step.active .step-number {
    color: #fff;
    transform: scale(1.1);
}

.step.active .step-title {
    color: #495057;
    font-weight: 600;
}

.step.completed .step-number {
    background: #28a745;
    color: #fff;
}

.step.completed .step-title {
    color: #28a745;
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #b61f29 0%, #460a0e 100%);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.form-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Controls */
.form-control, .form-select {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: #b61f29;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.1);
    background-color: #fff;
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.1);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-label.small {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #b61f29 0%, #460a0e 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #8b1c24 0%, #460a0e 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #fff;
}

.btn-cta {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-cta:hover {
    background: linear-gradient(135deg, #218838 0%, #1fa885 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    color: #fff;
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: #fff;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Form Check */
.form-check {
    padding-left: 2rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -2rem;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
}

.form-check-input:checked {
    background-color: #b61f29;
    border-color: #b61f29;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.1);
}

.form-check-label {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #495057;
}

/* Alert Messages */
.borghs-message {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

/* Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .progress-steps {
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 0.75rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0.25rem 0.35rem;
        margin: 0 -0.25rem 1rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .progress-steps::-webkit-scrollbar {
        display: none;
    }

    .progress-steps::before {
        display: none;
    }
    
    .step {
        flex: 0 0 108px;
        min-width: 108px;
        padding: 0;
        scroll-snap-align: center;
    }
    
    .step-title {
        font-size: 0.72rem;
        line-height: 1.2;
        max-width: 100%;
    }

    .step-title-full {
        display: none;
    }

    .step-title-short {
        display: inline;
    }

    .modal-header {
        padding: 1.25rem;
    }

    .modal-header-actions {
        width: auto;
        max-width: 100%;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .modal-back-button {
        padding: 0.55rem 0.9rem;
        font-size: 0.85rem;
    }

    .modal-title {
        font-size: 1.45rem;
    }

    .request-selector-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .modal-xl {
        max-width: 98%;
        margin: 0.25rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header-actions {
        width: 100%;
        justify-content: flex-end;
        align-items: center;
    }

    .modal-back-button {
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .modal-back-button .bi {
        margin-right: 0.35rem !important;
    }

    #anfragemodul.selector-visible .modal-header-actions {
        justify-content: flex-end;
    }

    .btn-close {
        align-self: auto;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
    .d-flex.justify-content-end .btn {
        width: 100%;
    }
}