/**
 * Search Widget CSS
 *
 * @package WonderTravel\NDC
 * @since 1.0.0
 */

/* ==========================================================================
   Search Widget
   ========================================================================== */

.wtnd-flight-search-widget {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.wtnd-flight-search-widget h3 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.wtnd-search-form {
    max-width: 900px;
}

.wtnd-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.wtnd-form-field {
    flex: 1;
    min-width: 0;
}

.wtnd-form-field label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.wtnd-form-field input,
.wtnd-form-field select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    transition: all 0.3s;
}

.wtnd-form-field input:focus,
.wtnd-form-field select:focus {
    outline: none;
    border-color: #5191FA;
    box-shadow: 0 0 0 3px rgba(81, 145, 250, 0.1);
}

.wtnd-form-row label input[type="radio"] {
    margin-right: 8px;
}

.wtnd-form-row > label {
    margin-right: 20px;
    font-weight: 500;
}

.wtnd-search-button {
    width: 100%;
    padding: 15px 30px;
    background: #5191FA;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.wtnd-search-button:hover {
    background: #3d7de8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(81, 145, 250, 0.3);
}

.wtnd-search-button:active {
    transform: translateY(0);
}

.wtnd-search-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.wtnd-search-message {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 5px;
    font-size: 14px;
}

.wtnd-search-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wtnd-search-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .wtnd-form-row {
        flex-direction: column;
    }

    .wtnd-flight-search-widget {
        padding: 20px;
    }
}

/* ==========================================================================
   Search Results Page
   ========================================================================== */

.wtnd-search-results-page {
    padding: 30px 0;
    background: #f5f5f5;
    min-height: 100vh;
}

/* Filters Sidebar */
.wtnd-filters-sidebar {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.wtnd-filters-sidebar .filter-title {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #5191FA;
    padding-bottom: 10px;
}

.search-summary {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.search-summary h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.search-summary .route {
    font-size: 18px;
    margin: 10px 0;
}

.search-summary .separator {
    color: #5191FA;
    margin: 0 10px;
}

.search-summary .dates,
.search-summary .passengers {
    font-size: 13px;
    color: #666;
    margin: 5px 0;
}

.filter-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h5 {
    margin: 0 0 15px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.checkbox-label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.price-filter {
    padding: 10px 0;
}

.price-filter input[type="range"] {
    width: 100%;
    margin: 5px 0;
}

.price-display {
    text-align: center;
    font-weight: 600;
    color: #5191FA;
    margin-top: 10px;
}

/* Results Header */
.wtnd-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #fff;
    border-radius: 5px;
}

.wtnd-results-header h3 {
    margin: 0;
    color: #333;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-options label {
    margin: 0;
    font-weight: 500;
}

.sort-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Results List */
.wtnd-results-list {
    position: relative;
}

.results-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5191FA;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 5px;
}

.no-results p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .wtnd-results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .sort-options {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-options select {
        width: 100%;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: #5191FA;
    color: white;
}

.btn-primary:hover {
    background: #3d7de8;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    color: white;
}

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

.btn-success:hover {
    background: #218838;
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==========================================================================
   Bundle Selector
   ========================================================================== */

.bundle-option {
    margin-bottom: 15px;
    transition: all 0.3s;
}

.bundle-label {
    display: block;
    cursor: pointer;
    position: relative;
}

.bundle-label input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.bundle-content {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
}

.bundle-label input[type="radio"]:checked + .bundle-content {
    border-color: #5191FA;
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(81, 145, 250, 0.2);
}

.bundle-option.selected .bundle-content {
    border-color: #5191FA;
    background: #f0f7ff;
}

.bundle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.bundle-name {
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.bundle-price {
    color: #5191FA;
    font-size: 18px;
    font-weight: bold;
}

.bundle-price.included {
    color: #28a745;
    font-size: 14px;
}

.bundle-description {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
    line-height: 1.5;
}

.bundle-services {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.bundle-services li {
    color: #555;
    font-size: 14px;
    margin: 8px 0;
    padding-left: 25px;
    position: relative;
}

.bundle-services li i {
    position: absolute;
    left: 0;
    top: 2px;
    color: #28a745;
}

/* ==========================================================================
   Flight Details Page
   ========================================================================== */

.flight-details-page {
    padding: 40px 0;
    background: #f5f5f5;
    min-height: 100vh;
}

.breadcrumb-wrapper {
    margin-bottom: 30px;
}

.breadcrumb-wrapper a {
    color: #5191FA;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.breadcrumb-wrapper a:hover {
    text-decoration: underline;
}

.flight-details-card {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flight-details-card h3 {
    margin: 0 0 25px 0;
    color: #333;
    font-size: 22px;
    font-weight: 600;
    border-bottom: 2px solid #5191FA;
    padding-bottom: 10px;
}

.journey-section {
    margin-bottom: 30px;
}

.journey-title {
    color: #5191FA;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.segment-card {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 15px;
}

.segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.segment-route {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
}

.route-point {
    text-align: center;
    flex: 1;
}

.airport-code {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.route-point .time {
    font-size: 20px;
    font-weight: 600;
    color: #555;
    margin: 5px 0;
}

.route-point .date {
    font-size: 13px;
    color: #666;
}

.route-point .terminal {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.route-timeline {
    flex: 2;
    text-align: center;
    padding: 0 30px;
}

.route-timeline .duration {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.timeline-line {
    height: 2px;
    background: #5191FA;
    position: relative;
}

.timeline-line::before,
.timeline-line::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #5191FA;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.timeline-line::before {
    left: 0;
}

.timeline-line::after {
    right: 0;
}

.segment-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    color: #666;
    font-size: 13px;
}

.layover-info {
    text-align: center;
    padding: 15px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    margin: 15px 0;
    border-radius: 4px;
    color: #856404;
    font-weight: 500;
}

.baggage-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.baggage-item {
    padding: 15px;
    background: #f9f9f9;
    border-left: 3px solid #5191FA;
    border-radius: 4px;
}

.price-summary-card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sticky-sidebar {
    position: sticky;
    top: 20px;
}

.price-summary-card h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.price-breakdown {
    margin-bottom: 20px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.price-label {
    color: #666;
    font-size: 14px;
}

.price-value {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.price-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 2px solid #5191FA;
    margin-top: 10px;
}

.total-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.total-value {
    font-size: 32px;
    font-weight: bold;
    color: #5191FA;
}

.total-value .currency {
    font-size: 16px;
    color: #666;
}

.action-buttons {
    margin-top: 25px;
}

.action-buttons .btn {
    margin-bottom: 10px;
}

.booking-notes {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.booking-notes .note {
    font-size: 12px;
    color: #666;
    margin: 10px 0;
}

.booking-notes .note i {
    color: #5191FA;
    margin-right: 5px;
}

/* ==========================================================================
   My Bookings
   ========================================================================== */

.wtnd-my-bookings {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    margin: 20px 0;
}

.booking-list {
    margin-top: 20px;
}

.booking-item-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.booking-item-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.booking-pnr {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.booking-status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.booking-status-badge.confirmed {
    background: #28a745;
    color: white;
}

.booking-status-badge.pending {
    background: #ffc107;
    color: #333;
}

.booking-status-badge.cancelled {
    background: #dc3545;
    color: white;
}

.booking-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 15px;
    color: #333;
    font-weight: 600;
}

.booking-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 992px) {
    .sticky-sidebar {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .segment-route {
        flex-direction: column;
    }

    .route-timeline {
        width: 100%;
        margin: 20px 0;
    }

    .flight-details-card {
        padding: 20px;
    }

    .price-summary-card {
        padding: 20px;
    }

    .booking-details {
        grid-template-columns: 1fr;
    }

    .booking-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .booking-actions {
        flex-direction: column;
    }

    .booking-actions .btn {
        width: 100%;
    }
}

/* ==========================================================================
   Airport Autocomplete Styles
   ========================================================================== */

/* Override jQuery UI autocomplete styles */
.ui-autocomplete {
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 99999 !important;
    padding: 0;
    margin: 0;
    list-style: none;
}

.ui-autocomplete .ui-menu-item {
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
}

.ui-autocomplete .ui-menu-item:last-child {
    border-bottom: none;
}

.ui-autocomplete .ui-menu-item-wrapper {
    display: block;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    font-size: 14px;
}

.ui-autocomplete .ui-menu-item-wrapper:hover,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f2ff 100%);
    color: #333;
    border-left: 3px solid #5191FA;
    padding-left: 12px;
}

.ui-autocomplete .ui-menu-item-wrapper.ui-state-active {
    background: linear-gradient(135deg, #5191FA 0%, #3d7de8 100%);
    color: #fff;
}

/* Custom airport autocomplete item styling */
.wtnd-airport-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wtnd-airport-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 32px;
    background: linear-gradient(135deg, #5191FA 0%, #3d7de8 100%);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.ui-state-active .wtnd-airport-code {
    background: #fff;
    color: #5191FA;
}

.wtnd-airport-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wtnd-airport-city {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.ui-state-active .wtnd-airport-city {
    color: #fff;
}

.wtnd-airport-name {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.ui-state-active .wtnd-airport-name {
    color: rgba(255, 255, 255, 0.8);
}

.wtnd-airport-country {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ui-state-active .wtnd-airport-country {
    color: rgba(255, 255, 255, 0.7);
}

/* Input field styling when autocomplete is active */
.wtnd-form-field input.ui-autocomplete-input {
    border-radius: 5px 5px 0 0;
}

.wtnd-form-field input.ui-autocomplete-input:focus {
    border-color: #5191FA;
    box-shadow: 0 0 0 3px rgba(81, 145, 250, 0.1);
}

/* Loading state */
.wtnd-airport-loading {
    padding: 15px;
    text-align: center;
    color: #666;
}

.wtnd-airport-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #5191FA;
    border-radius: 50%;
    animation: wtnd-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* No results message */
.wtnd-no-airports {
    padding: 20px 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.wtnd-no-airports::before {
    content: '✈️';
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ui-autocomplete {
        max-height: 250px;
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }

    .wtnd-airport-name {
        max-width: 180px;
    }

    .ui-autocomplete .ui-menu-item-wrapper {
        padding: 10px 12px;
    }
}

/* Scrollbar styling for autocomplete */
.ui-autocomplete::-webkit-scrollbar {
    width: 6px;
}

.ui-autocomplete::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 8px 0;
}

.ui-autocomplete::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ui-autocomplete::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
