/**
 * Duffel Booking - Styles
 * Version 1.1.0
 */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8a;
    --secondary: #e67e22;
    --success: #2e7d32;
    --error: #c62828;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-600: #757575;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

.duffel-booking-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Progress Steps */
.booking-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0 20px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--gray-300);
    z-index: 0;
}

.progress-step.completed:not(:last-child)::after {
    background: var(--primary);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-300);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

.progress-step.active .step-number {
    background: var(--primary);
    color: white;
}

.progress-step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-label {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-600);
    text-align: center;
}

.progress-step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

/* Booking Steps */
.booking-step {
    display: none;
}

.booking-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Forms */
.search-form-card,
.passenger-card,
.payment-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row.two-cols {
    grid-template-columns: repeat(2, 1fr);
}

.form-row.three-cols {
    grid-template-columns: repeat(3, 1fr);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.form-group input,
.form-group select {
    padding: 14px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* Airport Autocomplete */
.airport-input-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: var(--gray-100);
}

.autocomplete-item .airport-code {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.autocomplete-item .airport-name {
    font-weight: 500;
}

.autocomplete-item .airport-city {
    font-size: 13px;
    color: var(--gray-600);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.swap-airports {
    background: var(--gray-100);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: all 0.2s;
}

.swap-airports:hover {
    background: var(--gray-200);
    transform: rotate(180deg);
}

/* Flight Results */
#loading-results {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-600);
}

.flight-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.2s;
}

.flight-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.flight-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--gray-100);
}

.airline-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.airline-logo-placeholder {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 20px;
}

.airline-name {
    font-weight: 600;
}

.flight-number {
    font-size: 13px;
    color: var(--gray-600);
}

.flight-card-body {
    padding: 24px 20px;
}

.flight-route {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flight-endpoint {
    text-align: center;
}

.flight-endpoint .time {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.flight-endpoint .airport-code {
    font-size: 16px;
    font-weight: 600;
    margin: 4px 0;
}

.flight-endpoint .date {
    font-size: 13px;
    color: var(--gray-600);
}

.flight-duration {
    text-align: center;
    flex: 1;
    padding: 0 20px;
}

.duration-line {
    border-top: 2px dashed var(--gray-300);
    position: relative;
    margin: 10px 0;
}

.duration-line::after {
    content: '✈';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 8px;
}

.duration-text {
    font-weight: 600;
    color: var(--primary);
}

.stops {
    font-size: 13px;
    color: var(--gray-600);
}

.flight-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}

.flight-price .price-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
}

.flight-price .price-label {
    display: block;
    font-size: 13px;
    color: var(--gray-600);
}

.btn-select-flight {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-select-flight:hover {
    background: #d35400;
}

/* Passenger Form */
.passenger-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 18px;
    font-weight: 600;
}

.passenger-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Selected Flight Summary */
#selected-flight-summary {
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-flight-header {
    font-weight: 600;
}

.selected-flight-price {
    font-size: 18px;
    font-weight: 700;
}

/* Payment */
#card-element {
    padding: 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    margin-bottom: 16px;
}

#card-errors {
    color: var(--error);
    font-size: 14px;
    margin-bottom: 16px;
}

.order-summary {
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.order-summary-item.total {
    border-top: 2px solid var(--gray-300);
    margin-top: 12px;
    padding-top: 12px;
    font-weight: 700;
    font-size: 18px;
}

.terms-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.terms-checkbox input {
    width: 20px;
    height: 20px;
}

#payment-processing {
    text-align: center;
    padding: 20px;
}

/* Confirmation */
#step-confirmation {
    text-align: center;
}

.confirmation-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 24px;
}

#booking-reference {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row.two-cols,
    .form-row.three-cols {
        grid-template-columns: 1fr;
    }
    
    .flight-route {
        flex-direction: column;
        gap: 20px;
    }
    
    .flight-card-footer {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .booking-progress {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .progress-step:not(:last-child)::after {
        display: none;
    }
}
