/* ===========================================
   ACCESSIBILITY & RESPONSIVE ENHANCEMENTS
   =========================================== */

/* Focus Management für Accessibility */
:focus {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px;
}

/* Skip to content link für Screen Reader */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    border-radius: 4px;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 6px;
    color: white;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .wizard-container {
        border: 2px solid #000;
    }
    
    .form-section {
        border: 1px solid #000;
    }
    
    .btn-wizard {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mobile-First Responsive Design */
@media (max-width: 575.98px) {
    /* Extra small devices (phones) */
    .wizard-container {
        margin: 10px;
        border-radius: 8px;
    }
    
    .wizard-header {
        padding: 20px 15px;
    }
    
    .wizard-title {
        font-size: 1.5rem;
    }
    
    .wizard-subtitle {
        font-size: 0.9rem;
    }
    
    .progress-wrapper {
        padding: 15px;
    }
    
    .progress-steps {
        flex-direction: column;
        gap: 15px;
    }
    
    .progress-step::after {
        display: none;
    }
    
    .step-circle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .wizard-content {
        padding: 15px;
    }
    
    .form-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .form-section h4 {
        font-size: 1.2rem;
    }
    
    .wizard-navigation {
        padding: 15px;
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .btn-wizard {
        width: 100%;
        justify-content: center;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .file-upload-area {
        padding: 20px 15px;
    }
    
    .file-upload-icon {
        font-size: 2rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Small devices (landscape phones) */
    .checkbox-group {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Medium devices (tablets) */
    .checkbox-group {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Large devices (desktops) */
    .wizard-container {
        max-width: 900px;
        margin: 20px auto;
    }
}

@media (min-width: 1200px) {
    /* Extra large devices (large desktops) */
    .wizard-container {
        max-width: 1000px;
        margin: 30px auto;
    }
    
    .wizard-content {
        padding: 50px;
    }
    
    .form-section {
        padding: 40px;
    }
}

/* Touch Device Optimizations */
@media (pointer: coarse) {
    .btn-wizard {
        min-height: 44px;
        min-width: 44px;
    }
    
    .checkbox-item,
    .radio-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .form-check-input {
        width: 20px;
        height: 20px;
    }
    
    .remove-dynamic-item {
        min-width: 32px;
        min-height: 32px;
    }
    
    .add-dynamic-item {
        min-height: 44px;
    }
}

/* Print Styles */
@media print {
    .wizard-header,
    .progress-wrapper,
    .wizard-navigation,
    .auto-save-indicator,
    .btn,
    .alert {
        display: none !important;
    }
    
    .wizard-container {
        background: white !important;
        box-shadow: none;
        border: 1px solid #000 !important;
    }
    
    .form-section {
        page-break-inside: avoid;
        border: 1px solid #000 !important;
        margin: 10px 0 !important;
    }
    
    .form-section h4 {
        color: #000 !important;
    }
    
    .form-control {
        border: 1px solid #000 !important;
    }
    
    .checkbox-item:has(input:checked) {
        background: #f0f0f0 !important;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .wizard-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        color: #e0e0e0;
    }
    
    .wizard-content {
        background: #1a1a1a;
    }
    
    .form-section {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .form-control {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .form-control:focus {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .checkbox-item,
    .radio-item {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .dynamic-input-group {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .dynamic-item {
        background: #404040;
    }
    
    .file-upload-area {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .autocomplete-dropdown {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .autocomplete-item {
        border-color: #404040;
        color: #e0e0e0;
    }
}

/* Error States Enhancement */
.form-control.is-invalid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.25 5.25 1.5 1.5m0-1.5-1.5 1.5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 2.94 2.94-3.88-3.88z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Loading States */
.wizard-loading {
    position: relative;
    overflow: hidden;
}

.wizard-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Enhanced Auto-Save Indicator */
.auto-save-indicator {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Smooth Hover Effects */
.wizard-container .btn-wizard,
.wizard-container .checkbox-item,
.wizard-container .radio-item,
.wizard-container .form-control,
.wizard-container .dynamic-input-group {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Performance Optimizations */
.wizard-container * {
    will-change: auto;
}

.wizard-container .form-section:hover {
    will-change: transform;
}

/* Reduce GPU usage on mobile */
@media (max-width: 768px) {
    .wizard-container .form-section {
        transform: none !important;
    }
    
    .wizard-container .form-section:hover {
        transform: none !important;
    }
}

/* Status Indicators */
.field-status {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.field-status.valid {
    color: var(--success-color);
}

.field-status.invalid {
    color: var(--error-color);
}

.field-status.loading {
    animation: spin 1s linear infinite;
}

/* Enhanced Form Groups */
.form-group-enhanced {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group-enhanced .form-label {
    transition: all 0.3s ease;
}

.form-group-enhanced .form-control:focus ~ .form-label,
.form-group-enhanced .form-control:not(:placeholder-shown) ~ .form-label {
    transform: translateY(-0.5rem) scale(0.875);
    color: var(--primary-color);
}

/* Wizard Step Indicators Enhancement */
.progress-step.current {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Custom Scrollbar */
.wizard-content::-webkit-scrollbar {
    width: 8px;
}

.wizard-content::-webkit-scrollbar-track {
    background: var(--background-light);
    border-radius: 4px;
}

.wizard-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.wizard-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Ensure proper stacking context */
.wizard-container {
    position: relative;
    z-index: 1;
}

.auto-save-indicator {
    z-index: 1050;
}

.autocomplete-dropdown {
    z-index: 1040;
}

/* Enhanced button states */
.btn-wizard:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-wizard:disabled:hover {
    transform: none !important;
    box-shadow: none;
}
