/* Modern 3D Flight Search Form */
.afo-frontend-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0 auto 30px;
    padding: 16px;
    max-width: 680px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(99, 102, 241, 0.4),
        0 8px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.afo-frontend-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer-top 3s ease-in-out infinite;
}

.afo-frontend-form .afo-field {
    position: relative;
    display: flex;
    flex-direction: column;
}

.afo-frontend-form .afo-field-full {
    grid-column: span 1;
}

.afo-frontend-form .afo-field-group {
    grid-column: span 3;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.afo-frontend-form .afo-field label {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.afo-frontend-form input,
.afo-frontend-form select {
    padding: 8px 10px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    background: #ffffff;
    color: #1e293b;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 2px 4px rgba(0, 0, 0, 0.05),
        inset 0 -2px 0 rgba(0, 0, 0, 0.05);
    height: 38px;
}

.afo-frontend-form input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.afo-frontend-form input:focus,
.afo-frontend-form select:focus {
    outline: none;
    background: #ffffff;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.12),
        0 0 0 3px rgba(255, 255, 255, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px) scale(1.01);
}

.afo-search-btn {
    grid-column: 1 / -1;
    padding: 12px 32px;
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 20px rgba(236, 72, 153, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.afo-btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.afo-search-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 28px rgba(236, 72, 153, 0.6),
        0 6px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.afo-search-btn:hover .afo-btn-shimmer {
    animation: shimmer-slide 1.5s ease-in-out infinite;
}

.afo-search-btn:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 
        0 4px 12px rgba(236, 72, 153, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.afo-search-btn.afo-searching {
    pointer-events: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    animation: pulse-glow 2s ease-in-out infinite;
}

.afo-search-btn.afo-searching::before {
    content: "🛩️";
    position: absolute;
    font-size: 28px;
    animation: aircraft-fly 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.afo-search-btn.afo-searching .afo-btn-text {
    opacity: 0.7;
}

@keyframes shimmer-slide {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes shimmer-top {
    0%, 100% { opacity: 0; transform: translateX(-100%); }
    50% { opacity: 1; transform: translateX(100%); }
}

@keyframes aircraft-fly {
    0% { 
        left: -40px;
        top: 50%;
        transform: translateY(-50%) rotate(-15deg) scale(0.8);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    25% {
        transform: translateY(-60%) rotate(-5deg) scale(1);
    }
    50% { 
        left: 50%;
        top: 30%;
        transform: translateY(-50%) rotate(0deg) scale(1.1);
    }
    75% {
        transform: translateY(-40%) rotate(5deg) scale(1);
    }
    85% {
        opacity: 1;
    }
    100% { 
        left: calc(100% + 40px);
        top: 50%;
        transform: translateY(-50%) rotate(15deg) scale(0.8);
        opacity: 0;
    }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15); }
    50% { box-shadow: 0 12px 32px rgba(99, 102, 241, 0.7), 0 6px 12px rgba(0, 0, 0, 0.2); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .afo-frontend-form {
        grid-template-columns: 1fr;
        padding: 14px;
        gap: 8px;
        border-radius: 16px;
    }
    
    .afo-frontend-form .afo-field-full,
    .afo-frontend-form .afo-field-group {
        grid-column: span 1;
    }
    
    .afo-frontend-form .afo-field-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .afo-search-btn {
        font-size: 15px;
        padding: 11px 28px;
    }
}

@media (max-width: 480px) {
    .afo-frontend-form {
        padding: 12px;
        gap: 8px;
    }
    
    .afo-frontend-form input,
    .afo-frontend-form select {
        height: 36px;
        padding: 7px 10px;
        font-size: 14px;
    }
}

/* Results Area */
.afo-results {
    margin-top: 30px;
}

/* Status Messages */
.afo-loading {
    display: none;
}

@keyframes plane-fly {
    0% { 
        transform: translateX(-50px) translateY(0) rotate(-10deg);
        opacity: 0;
    }
    25% {
        opacity: 1;
    }
    50% { 
        transform: translateX(0) translateY(-10px) rotate(0deg);
    }
    75% {
        opacity: 1;
    }
    100% { 
        transform: translateX(50px) translateY(0) rotate(10deg);
        opacity: 0;
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.afo-loading-dots {
    display: inline-block;
    margin-left: 4px;
}

.afo-loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.afo-error {
    padding: 20px 24px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    border-left: 4px solid #dc2626;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
}

.afo-error::before {
    content: "⚠️ ";
    margin-right: 8px;
}

.afo-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    font-size: 16px;
}

/* City autocomplete suggestions */
.afo-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    z-index: 99999;
    max-height: 300px;
    overflow: auto;
    border-radius: 8px;
    margin-top: 6px;
}
.afo-suggestion-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #111827;
}
.afo-suggestion-item:hover { background: #f3f4f6; }

.afo-no-results::before {
    content: "🔍";
    display: block;
    font-size: 48px;
    margin-bottom: 12px;
}

.afo-search-summary {
    padding: 16px 20px;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    margin-bottom: 24px;
    color: #1e40af;
    font-weight: 500;
    font-size: 15px;
}

/* Offer Grid - 4 columns */
.afo-offers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 16px;
}

/* Individual Card */
.afo-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.afo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

/* Card Header */
.afo-card-header {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    padding: 14px 16px;
    border-bottom: 2px solid #e5e7eb;
}

.afo-card-header-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.afo-card-logo {
    height: 45px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    filter: contrast(1.15) brightness(1.08) saturate(1.1);
    flex-shrink: 0;
}

.afo-card-airline {
    font-size: 15px;
    font-weight: 700;
    color: #374151;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-left: auto;
}

/* Flight Route */
.afo-card-route {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.afo-card-city {
    text-align: center;
    flex: 1;
}

.afo-card-iata {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.afo-card-time {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1px;
}

.afo-card-date {
    font-size: 12px;
    color: #6b7280;
}

/* Arrow and Duration */
.afo-card-arrow {
    flex: 0 0 auto;
    text-align: center;
    position: relative;
    padding: 0 8px;
}

.afo-card-duration {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
    white-space: nowrap;
}

.afo-card-line {
    height: 2px;
    background: linear-gradient(90deg, #e5e7eb 0%, #667eea 50%, #e5e7eb 100%);
    margin: 4px 0;
}

.afo-card-stops {
    font-size: 11px;
    color: #6b7280;
    margin-top: 8px;
}

/* Details Section */
.afo-card-details {
    padding: 10px 16px;
    background: #f9fafb;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.afo-card-detail {
    font-size: 13px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.afo-icon {
    font-size: 16px;
}

/* Footer with Price */
.afo-card-footer {
    padding: 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.afo-card-price {
    text-align: center;
}

.afo-card-price-label {
    font-size: 12px;
    color: #92400e;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.afo-card-price-amount {
    font-size: 28px;
    font-weight: 800;
    color: #ea580c;
    line-height: 1;
}

.afo-card-currency {
    font-size: 16px;
    font-weight: 600;
    color: #92400e;
}

.afo-card-button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.afo-card-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.5);
}

.afo-card-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.afo-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Detailed Itinerary Styles */
.afo-trip-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.afo-card-itinerary-toggle {
    padding: 10px 20px;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.afo-card-itinerary-toggle:hover {
    background: #e0e7ff;
    color: #4f46e5;
}

.afo-card-itinerary-toggle.active {
    background: #e0e7ff;
    color: #4f46e5;
}

.afo-toggle-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.afo-card-itinerary {
    border-top: 1px solid #e5e7eb;
    background: #fafbfc;
}

.afo-itinerary-segments {
    padding: 12px 16px;
}

.afo-segment {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}

.afo-segment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.afo-segment-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.afo-segment-carrier {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0.5px;
}

.afo-segment-operated {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
    margin-left: auto;
}

.afo-segment-leg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.afo-segment-airport {
    flex: 1;
}

.afo-segment-iata {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.afo-segment-terminal {
    font-size: 11px;
    color: #667eea;
    font-weight: 600;
    background: #e0e7ff;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
}

.afo-segment-time {
    text-align: right;
    flex: 1;
}

.afo-segment-datetime {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.afo-segment-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    margin: 8px 0;
    border-top: 1px dashed #d1d5db;
    border-bottom: 1px dashed #d1d5db;
}

.afo-segment-duration {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
}

.afo-segment-aircraft {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 6px;
}

.afo-layover {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .afo-frontend-form {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    /* Mobile: 1 card per row */
    .afo-offers-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .afo-card {
        border-radius: 12px;
    }
    
    .afo-card-header {
        padding: 12px 14px;
    }
    
    .afo-card-header-content {
        gap: 10px;
    }
    
    .afo-card-logo {
        height: 36px;
        max-width: 90px;
    }
    
    .afo-card-airline {
        font-size: 13px;
        letter-spacing: 0.6px;
    }
    
    .afo-card-route {
        padding: 20px 16px;
        gap: 8px;
    }
    
    .afo-card-city {
        flex: 0 0 auto;
        min-width: 90px;
    }
    
    .afo-card-iata {
        font-size: 32px;
        margin-bottom: 6px;
    }
    
    .afo-card-time {
        font-size: 15px;
        font-weight: 700;
        color: #111827;
    }
    
    .afo-card-date {
        font-size: 11px;
        color: #9ca3af;
        font-weight: 500;
    }
    
    .afo-card-arrow {
        flex: 1;
        padding: 0 4px;
    }
    
    .afo-card-duration {
        font-size: 12px;
        margin-bottom: 6px;
        white-space: normal;
        line-height: 1.3;
    }
    
    .afo-card-line {
        height: 2px;
        margin: 6px 0;
    }
    
    .afo-card-stops {
        font-size: 10px;
        margin-top: 6px;
    }
    
    .afo-card-details {
        padding: 12px 16px;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .afo-card-detail {
        font-size: 12px;
        padding: 8px 0;
    }
    
    .afo-icon {
        font-size: 14px;
    }
    
    .afo-card-footer {
        padding: 16px;
        gap: 10px;
    }
    
    .afo-card-price {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .afo-card-price-label {
        font-size: 11px;
        margin-bottom: 0;
        text-align: left;
    }
    
    .afo-card-price-amount {
        font-size: 28px;
        display: flex;
        align-items: baseline;
        gap: 4px;
    }
    
    .afo-card-currency {
        font-size: 14px;
    }
    
    .afo-card-button {
        padding: 12px 20px;
        font-size: 14px;
        letter-spacing: 0.3px;
    }
    
    .afo-card-itinerary-toggle {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .afo-itinerary-segments {
        padding: 12px 16px;
    }
    
    .afo-segment {
        padding: 12px;
    }
    
    .afo-segment-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .afo-segment-operated {
        margin-left: 0;
        flex-basis: 100%;
    }
    
    .afo-segment-iata {
        font-size: 20px;
    }
    
    .afo-segment-datetime {
        font-size: 12px;
    }
    
    .afo-segment-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .afo-layover {
        font-size: 12px;
        padding: 10px 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .afo-frontend-form {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Tablet: 3 cards per row */
    .afo-offers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .afo-card-iata {
        font-size: 22px;
    }
    
    .afo-card-time {
        font-size: 13px;
    }
    
    .afo-card-price-amount {
        font-size: 24px;
    }
}

@media (min-width: 1025px) {
    .afo-frontend-form {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .afo-frontend-form button {
        grid-column: 1 / -1;
    }
    
    /* Desktop: 4 cards per row (default) */
    .afo-offers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
