/* Ultimate Wizard Enhancements - Universal Document Form Improvements */
/* Applies to ALL document generation forms across LeaseCraft */

/* ============================================
   1. ENHANCED MOBILE UX - LARGER TOUCH TARGETS
   ============================================ */

/* Mobile-first approach with larger touch targets */
@media (max-width: 991px) {
    .wizard-container {
        padding: 16px;
        margin: 0;
        border-radius: 0;
    }
    
    /* Larger, easier-to-tap form controls */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        min-height: 52px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
        border-radius: 10px !important;
    }
    
    /* Larger buttons for mobile */
    .btn,
    button[type="submit"],
    button[type="button"],
    .btn-primary,
    .btn-secondary,
    .btn-success {
        min-height: 52px !important;
        font-size: 16px !important;
        padding: 14px 24px !important;
        border-radius: 10px !important;
    }
    
    /* Better step indicators on mobile */
    .wizard-steps {
        padding: 8px 4px;
        gap: 4px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .wizard-step {
        min-width: 60px;
        padding: 8px 4px;
    }
    
    .wizard-step-circle {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
    
    .wizard-step-label {
        font-size: 11px !important;
        max-width: 70px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
    
    /* Stack form sections vertically */
    .horizontal-form-row,
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    /* Full width for all form groups on mobile */
    .form-group,
    .col-md-6,
    .col-md-4,
    .col-md-3,
    .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Better card spacing */
    .card {
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .card-header {
        padding: 14px 16px;
    }
    
    /* Improved navigation buttons */
    .wizard-navigation {
        flex-direction: column;
        gap: 12px;
        padding: 16px 0;
    }
    
    .wizard-navigation .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Sticky bottom navigation for mobile */
    .wizard-bottom-nav {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px;
        border-top: 1px solid #e3e6f0;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
        z-index: 100;
        margin: 0 -16px;
        width: calc(100% + 32px);
    }
}

/* ============================================
   2. TRUST INDICATORS & BADGES
   ============================================ */

/* Trust Badge Container */
.trust-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 20px 0;
    margin: 20px 0;
    border-top: 1px solid #e3e6f0;
    border-bottom: 1px solid #e3e6f0;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    border: 1px solid #dee2e6;
}

.trust-badge i {
    color: #28a745;
    font-size: 14px;
}

.trust-badge.security i {
    color: #0056b3;
}

.trust-badge.compliance i {
    color: #17a2b8;
}

.trust-badge.freshness i {
    color: #ffc107;
}

/* Security Notice */
.security-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #28a745;
}

.security-notice i {
    font-size: 24px;
    color: #28a745;
}

.security-notice-text {
    flex: 1;
}

.security-notice-title {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 2px;
}

.security-notice-desc {
    font-size: 13px;
    color: #388e3c;
}

/* Document Count Badge */
.document-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #0056b3;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Compliance Badge */
.compliance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #90caf9;
}

/* ============================================
   3. MODERNIZED VISUAL DESIGN
   ============================================ */

/* Enhanced Card Styling */
.wizard-card,
.step-content .card,
.form-section-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 4px 24px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.wizard-card:focus-within,
.step-content .card:focus-within {
    box-shadow: 0 4px 12px rgba(0,86,179,0.1), 0 8px 32px rgba(0,86,179,0.12);
}

/* Modern Card Headers */
.wizard-card .card-header,
.form-section-card .card-header {
    background: linear-gradient(135deg, #f8f9fc 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 20px 24px;
}

.wizard-card .card-header h5,
.form-section-card .card-header h5 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #2c3e50;
}

.wizard-card .card-header h5 i {
    color: #0056b3;
    font-size: 18px;
}

/* Modern Form Controls */
.form-control-modern,
.wizard-form .form-control,
.wizard-form .form-select {
    border: 2px solid #e3e6f0;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.form-control-modern:focus,
.wizard-form .form-control:focus,
.wizard-form .form-select:focus {
    border-color: #0056b3;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0,86,179,0.1);
    outline: none;
}

/* Floating Labels Effect */
.form-floating-modern {
    position: relative;
}

.form-floating-modern label {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
    padding: 0 4px;
    font-size: 15px;
}

.form-floating-modern input:focus ~ label,
.form-floating-modern input:not(:placeholder-shown) ~ label,
.form-floating-modern textarea:focus ~ label,
.form-floating-modern textarea:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 12px;
    color: #0056b3;
    background: white;
    font-weight: 500;
}

/* Modern Progress Bar */
.wizard-progress-modern {
    height: 6px;
    background: #e3e6f0;
    border-radius: 3px;
    overflow: hidden;
    margin: 20px 0;
}

.wizard-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0056b3 0%, #17a2b8 50%, #28a745 100%);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modern Step Indicators */
.wizard-step-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.wizard-step-circle-modern {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.wizard-step-modern.active .wizard-step-circle-modern {
    background: linear-gradient(135deg, #0056b3 0%, #0077cc 100%);
    border-color: #0056b3;
    color: white;
    box-shadow: 0 4px 12px rgba(0,86,179,0.3);
}

.wizard-step-modern.completed .wizard-step-circle-modern {
    background: linear-gradient(135deg, #28a745 0%, #34c759 100%);
    border-color: #28a745;
    color: white;
}

.wizard-step-modern.completed .wizard-step-circle-modern::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

/* ============================================
   4. ENHANCED FORM VALIDATION
   ============================================ */

/* Real-time validation feedback */
.validation-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-top: 6px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.validation-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.validation-feedback.valid {
    color: #28a745;
}

.validation-feedback.invalid {
    color: #dc3545;
}

.validation-feedback.warning {
    color: #ffc107;
}

/* Field Status Icons */
.form-group-with-status {
    position: relative;
}

.field-status-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.form-group-with-status.valid .field-status-icon {
    opacity: 1;
    color: #28a745;
}

.form-group-with-status.invalid .field-status-icon {
    opacity: 1;
    color: #dc3545;
}

/* Enhanced Error Messages */
.error-message-enhanced {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: #fff5f5;
    border-radius: 8px;
    border-left: 3px solid #dc3545;
    margin-top: 8px;
    font-size: 13px;
    color: #c53030;
}

.error-message-enhanced i {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Success State */
.form-control.field-valid {
    border-color: #28a745;
    background: #f8fff9;
}

/* Warning State */
.form-control.field-warning {
    border-color: #ffc107;
    background: #fffdf5;
}

/* Character Counter */
.character-counter {
    display: flex;
    justify-content: flex-end;
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.character-counter.near-limit {
    color: #ffc107;
}

.character-counter.at-limit {
    color: #dc3545;
}

/* ============================================
   5. REAL-TIME PREVIEW PANEL
   ============================================ */

/* Preview Container */
.document-preview-panel {
    position: sticky;
    top: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    overflow: hidden;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.preview-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-toggle-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.preview-toggle-btn:hover {
    background: rgba(255,255,255,0.3);
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-family: 'Times New Roman', serif;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
}

.preview-placeholder {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
}

.preview-placeholder i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

/* Preview Field Highlights */
.preview-field {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.preview-field.filled {
    background: #d4edda;
}

.preview-field.empty {
    background: #f8d7da;
    color: #721c24;
    font-style: italic;
}

/* Mobile Preview Button */
@media (max-width: 991px) {
    .document-preview-panel {
        display: none;
    }
    
    .preview-mobile-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 14px;
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
        color: white;
        border: none;
        border-radius: 10px;
        font-size: 15px;
        font-weight: 500;
        margin-bottom: 16px;
    }
    
    .preview-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 1050;
        display: flex;
        flex-direction: column;
    }
    
    .preview-modal-header {
        padding: 16px;
        background: #2c3e50;
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .preview-modal-close {
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        padding: 0;
        line-height: 1;
    }
    
    .preview-modal-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }
}

@media (min-width: 992px) {
    .preview-mobile-btn {
        display: none;
    }
}

/* ============================================
   6. ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* High Contrast Focus States */
*:focus-visible {
    outline: 3px solid #0056b3;
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #0056b3;
    color: white;
    padding: 12px 20px;
    z-index: 9999;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
}

/* Better Label Visibility */
label {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 6px;
    display: block;
}

label .required-marker {
    color: #dc3545;
    margin-left: 2px;
}

/* Form Help Text */
.form-text,
.help-text {
    color: #6c757d;
    font-size: 13px;
    margin-top: 4px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.form-text i,
.help-text i {
    color: #17a2b8;
    margin-top: 2px;
}

/* Keyboard Navigation Indicators */
.keyboard-nav-active *:focus {
    outline: 3px solid #0056b3 !important;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-control,
    .form-select {
        border-width: 2px;
    }
    
    .btn-primary {
        background: #0056b3;
        border: 2px solid #003d82;
    }
    
    .trust-badge {
        border-width: 2px;
    }
}

/* ============================================
   7. LOADING & PROGRESS STATES
   ============================================ */

/* Form Loading Overlay */
.form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e3e6f0;
    border-top-color: #0056b3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    color: #6c757d;
    font-weight: 500;
}

/* Submit Button States */
.btn-submit {
    position: relative;
    overflow: hidden;
}

.btn-submit.loading {
    color: transparent;
    pointer-events: none;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-submit.success {
    background: #28a745;
    border-color: #28a745;
}

/* ============================================
   8. RESPONSIVE POLISH
   ============================================ */

/* Small screens */
@media (max-width: 575px) {
    .wizard-container {
        padding: 12px;
    }
    
    .wizard-title {
        font-size: 1.5rem;
    }
    
    .wizard-subtitle {
        font-size: 14px;
    }
    
    .trust-badges-container {
        gap: 8px;
    }
    
    .trust-badge {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .security-notice {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .document-overview {
        padding: 16px;
    }
    
    .document-overview h1 {
        font-size: 1.3rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

/* Tablet screens */
@media (min-width: 576px) and (max-width: 991px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .wizard-container {
        max-width: 1400px;
    }
    
    .wizard-with-preview {
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: 32px;
    }
}
