@import 'variables.css';

/* =========================================
   Reset & Base
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    font-size: var(--font-size-base);
    padding-bottom: 80px; /* Space for floating service */
}

a {
    text-decoration: none;
    color: inherit;
}

ul, li {
    list-style: none;
}

button {
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
}

.container {
    padding: 0 var(--spacing-md);
    max-width: 600px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* =========================================
   Header & Banner
   ========================================= */
.site-header-banner {
    position: relative;
    height: 220px;
    width: 100%;
    overflow: hidden;
}

.banner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.banner-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-image .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 60%, rgba(245,247,250,1) 100%);
}

.header-nav {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-lg);
    color: var(--text-white);
}

.page-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* =========================================
   Search Card
   ========================================= */
.search-card-container {
    position: relative;
    z-index: 10;
    margin-top: -60px; /* Overlap banner */
}

.search-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-card);
}

/* Tabs */
.flight-tabs {
    display: flex;
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.tab-item {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    position: relative;
    font-weight: 500;
}

.tab-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Location Row */
.location-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.location-input {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.location-input label {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-bottom: 4px;
}

.location-input input {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    width: 100%;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .location-input input {
        font-size: 13px;
    }
}

.exchange-icon {
    width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#btn-swap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#btn-swap:active {
    background: #e0f0ff;
}

/* Date Row */
.date-row {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.date-input {
    display: flex;
    flex-direction: column;
}

.date-select {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-main);
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    appearance: none; /* Remove default arrow in some browsers */
    -webkit-appearance: none;
    cursor: pointer;
    padding: 5px 0;
}

/* Add custom arrow for select */
#date-depart {
    position: relative;
}

#date-depart::after {
    content: '▼';
    font-size: 10px;
    color: #999;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(0%);
    pointer-events: none;
}

.date-label {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

/* Options */
.options-row {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.option-tag {
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    cursor: pointer;
}

.option-tag.active {
    background: #e0f0ff;
    color: var(--primary-color);
    font-weight: 500;
}

/* Search Button */
.btn-search {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, var(--accent-color), #ff6b6b);
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 600;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
    transition: transform 0.1s;
}

.btn-search:active {
    transform: scale(0.98);
}

/* Quick Links */
.quick-links {
    display: flex;
    justify-content: space-between;
    margin-top: var(--spacing-lg);
}

.link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.link-item .icon {
    font-size: 20px;
    background: #f8f9fa;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   Featured Section
   ========================================= */
.featured-section {
    margin-top: var(--spacing-xl);
}

.section-header {
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
}

.section-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.rank-tabs {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    padding-bottom: 4px;
}

.rank-tab {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 6px 12px;
}

.rank-tab.active {
    color: var(--text-main);
    font-weight: 600;
    position: relative;
}

.rank-tab.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--text-main);
    border-radius: 50%;
}

/* Flight List */
.flight-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.flight-item {
    display: flex;
    background: var(--bg-white);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    align-items: center;
    gap: var(--spacing-md);
}

.flight-img {
    position: relative;
    width: 80px;
    height: 60px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.flight-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-top {
    position: absolute;
    top: 0;
    left: 0;
    background: #ff5252;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-bottom-right-radius: 6px;
}

.flight-info {
    flex: 1;
}

.flight-info .route {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: 4px;
}

.flight-info .date {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.flight-price {
    text-align: right;
    color: #ff5252;
    font-weight: 600;
    font-size: var(--font-size-lg);
}

.flight-price .currency {
    font-size: var(--font-size-sm);
    margin-right: 2px;
}

.flight-price .unit {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-weight: normal;
    margin-left: 2px;
}

/* =========================================
   Floating Service
   ========================================= */
.floating-service {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.service-btn {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-float);
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.service-btn:hover {
    transform: scale(1.1);
}

.service-popup {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 200px;
    background: white;
    padding: 16px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-float);
    text-align: center;
    transform-origin: bottom right;
    animation: popIn 0.2s ease-out;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.service-popup h4 {
    margin-bottom: 8px;
    font-size: var(--font-size-base);
}

/* =========================================
   Autocomplete Dropdown
   ========================================= */
.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper.error input {
    color: #d32f2f;
}

.input-wrapper.error::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid #d32f2f;
    border-radius: 4px;
    pointer-events: none;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-card);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 4px;
    border: 1px solid #eee;
}

.autocomplete-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.autocomplete-item:hover, .autocomplete-item.selected {
    background-color: #f0f7ff;
}

.autocomplete-item .city {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--text-main);
}

.autocomplete-item .code {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
}

.autocomplete-item .airport {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.autocomplete-message {
    padding: 12px 16px;
    color: #999;
    font-size: 13px;
    text-align: center;
}

/* =========================================
   Modal Styles
   ========================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-main);
}

.close-modal {
    font-size: 24px;
    color: var(--text-light);
    line-height: 1;
    padding: 0 8px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.route-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    font-weight: 600;
    color: var(--primary-color);
}

.modal-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}
