/**
 * Professional Modify Search Form Styles - OTA Style
 * Designed to match professional travel booking sites
 */

/* === Compact Professional Modify Search (OTA Style) === */

.maf-modify-search-compact {
    background-color: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.maf-compact-form-grid {
    display: contents; /* Use subgrid-like behavior */
}

.maf-input-group-compact {
    position: relative;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.maf-input-group-compact label {
    font-size: 10px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.maf-input-control-compact {
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    width: 100%;
    min-width: 140px; /* Minimum width for inputs */
    transition: border-color 0.2s;
}

.maf-input-control-compact:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0,123,255,.25);
}

.maf-passengers-compact {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.maf-passenger-info {
    font-size: 14px;
}

.maf-btn-compact {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
}

.maf-search-btn-compact {
    background: linear-gradient(135deg, #003265 0%, #004080 100%);
    color: #fff;
}

.maf-search-btn-compact:hover {
    background: linear-gradient(135deg, #002244 0%, #003265 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 50, 101, 0.3);
}

.maf-cancel-btn-compact {
    background-color: #6c757d;
    color: #fff;
}

.maf-cancel-btn-compact:hover {
    background-color: #5a6268;
}

@media (max-width: 768px) {
    .maf-modify-search-compact {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Main Container - More Compact */
.maf-modify-search-professional {
    background: #fff;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
    padding: 12px 16px;
    position: relative;
}

.maf-modify-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Trip Type Tabs - More Compact */
.maf-modify-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
}

.maf-modify-tab {
    background: none;
    border: none;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.maf-modify-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.maf-modify-tab.active {
    background: var(--maf-primary-color);
    color: white;
}

/* Form Grid - More Compact */
.maf-modify-form-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
}

@media (max-width: 1024px) {
    .maf-modify-form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .maf-modify-swap {
        order: 1;
        grid-column: 1 / -1;
        justify-self: center;
        margin: 4px 0;
    }
    
    .from-field { order: 0; }
    .to-field { order: 2; }
    .dates-field { order: 3; }
    .travelers-field { order: 4; }
    .search-field { order: 5; grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    .maf-modify-form-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .search-field { grid-column: 1; }
}

/* Form Fields */
.maf-modify-field {
    position: relative;
}

.maf-modify-field label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.maf-modify-input-wrapper {
    position: relative;
}

.maf-modify-field input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: all 0.2s ease;
    outline: none;
}

.maf-modify-field input[type="text"]:focus {
    border-color: var(--maf-primary-color);
    box-shadow: 0 0 0 3px var(--maf-primary-lighter);
}

.maf-modify-field input[type="text"]::placeholder {
    color: #9ca3af;
}

/* Airport Suggestions */
.maf-modify-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.maf-suggestions-list {
    padding: 0;
}

.maf-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.maf-suggestion-item:hover {
    background: #f8fafc;
}

.maf-suggestion-item:last-child {
    border-bottom: none;
}

.maf-suggestion-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.maf-suggestion-city {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.maf-suggestion-code {
    background: #e5e7eb;
    color: #374151;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.maf-suggestion-name {
    font-size: 12px;
    color: #6b7280;
}

.maf-suggestion-loading,
.maf-suggestion-no-results,
.maf-suggestion-error {
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

/* Swap Button */
.maf-modify-swap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 6px;
}

.maf-modify-swap-btn {
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.maf-modify-swap-btn:hover {
    background: var(--maf-primary-lighter);
    border-color: var(--maf-accent-color);
    color: var(--maf-primary-darker);
    transform: rotate(180deg);
}

/* Travelers Dropdown */
.travelers-field {
    position: relative;
}

.maf-modify-travelers-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 16px;
}

.maf-travelers-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.maf-traveler-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.maf-traveler-info {
    display: flex;
    flex-direction: column;
}

.maf-traveler-type {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.maf-traveler-desc {
    font-size: 12px;
    color: #6b7280;
}

.maf-traveler-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.maf-counter-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
}

.maf-counter-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.maf-counter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.maf-counter-value {
    font-weight: 600;
    color: #111827;
    min-width: 20px;
    text-align: center;
}

.maf-cabin-class-selector {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.maf-cabin-class-selector label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.maf-cabin-class-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 14px;
}

/* Search Button */
.maf-modify-search-btn {
    background: linear-gradient(135deg, var(--maf-primary-color) 0%, var(--maf-primary-darker) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 24px;
    transition: all 0.2s ease;
    min-width: 120px;
    justify-content: center;
}

.maf-modify-search-btn:hover {
    background: linear-gradient(135deg, var(--maf-primary-darker) 0%, var(--maf-primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px var(--maf-primary-lighter);
}

.maf-modify-search-btn:active {
    transform: translateY(0);
}

.maf-modify-search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.maf-modify-search-btn svg {
    animation: none;
}

.maf-modify-search-btn:disabled svg {
    animation: spin 1s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .maf-modify-search-professional {
        margin: 0 -10px 20px -10px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 16px;
    }

    .maf-modify-tabs {
        justify-content: center;
        margin-bottom: 16px;
    }

    .maf-modify-field input[type="text"] {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px; /* Larger touch targets */
    }

    .maf-modify-search-btn {
        padding: 14px 20px;
        font-size: 16px;
        width: 100%;
    }

    .maf-modify-suggestions {
        font-size: 16px; /* Better readability on mobile */
        max-height: 250px;
    }

    .maf-suggestion-item {
        padding: 14px 16px; /* Larger touch targets */
    }

    .maf-modify-swap-btn {
        width: 44px; /* Larger touch target */
        height: 44px;
    }

    .maf-modify-travelers-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90vw;
        max-width: 400px;
        border-radius: 12px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        z-index: 9999;
    }

    .maf-counter-btn {
        width: 44px; /* Larger touch target */
        height: 44px;
        font-size: 18px;
    }

    .maf-counter-value {
        min-width: 44px;
        font-size: 16px;
    }

    /* Mobile-specific search form overlay */
    .maf-modify-search-professional.mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        background: white;
        margin: 0;
        border-radius: 0;
        padding: 20px;
        overflow-y: auto;
    }

    .maf-modify-search-professional.mobile-overlay .maf-modify-form-grid {
        gap: 20px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .maf-modify-search-professional {
        background: #1f2937;
        border-color: #374151;
    }
    
    .maf-modify-tabs {
        border-color: #374151;
    }
    
    .maf-modify-tab {
        color: #d1d5db;
    }
    
    .maf-modify-tab:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .maf-modify-field label {
        color: #d1d5db;
    }
    
    .maf-modify-field input[type="text"] {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .maf-modify-field input[type="text"]:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .maf-modify-suggestions {
        background: #374151;
        border-color: #4b5563;
    }
    
    .maf-suggestion-item {
        border-color: #4b5563;
    }
    
    .maf-suggestion-item:hover {
        background: #4b5563;
    }
    
    .maf-suggestion-city {
        color: #f9fafb;
    }
    
    .maf-suggestion-code {
        background: #4b5563;
        color: #d1d5db;
    }
    
    .maf-suggestion-name {
        color: #9ca3af;
    }
    
    .maf-modify-travelers-dropdown {
        background: #374151;
        border-color: #4b5563;
    }
    
    .maf-traveler-type {
        color: #f9fafb;
    }
    
    .maf-counter-btn {
        background: #4b5563;
        border-color: #6b7280;
        color: #d1d5db;
    }
    
    .maf-counter-btn:hover {
        background: #6b7280;
    }
    
    .maf-counter-value {
        color: #f9fafb;
    }
    
    .maf-cabin-class-selector {
        border-color: #4b5563;
    }
    
    .maf-cabin-class-selector select {
        background: #4b5563;
        border-color: #6b7280;
        color: #f9fafb;
    }
}

/* Focus States for Accessibility */
.maf-modify-tab:focus,
.maf-modify-swap-btn:focus,
.maf-counter-btn:focus,
.maf-modify-search-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading States */
.maf-modify-search-professional.loading {
    pointer-events: none;
}

.maf-modify-search-professional.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

/* Animation for smooth interactions */
.maf-modify-suggestions,
.maf-modify-travelers-dropdown {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} 

/* Mobile backdrop for dropdowns */
.maf-dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}

/* Prevent body scroll when modal is open */
body.maf-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Mobile modal styling for travelers dropdown */
.maf-modify-travelers-dropdown.mobile-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 400px !important;
    border-radius: 12px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    z-index: 9999 !important;
    animation: slideUp 0.3s ease forwards;
}

/* Enhanced date input styling for better mobile experience */
.maf-date-input {
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.maf-date-input::-webkit-outer-spin-button,
.maf-date-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Validation states for form inputs */
.maf-form-input.maf-valid {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.maf-form-input.maf-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
} 