/**
 * Advanced Travel Search Engine - Modern Frontend Styles
 * File: assets/css/frontend.css
 */

/* ==========================================
   ROOT & BASE STYLES
   ========================================== */

.atse-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    font-size: 15px;
    line-height: 1.6;
}

.atse-container * {
    box-sizing: border-box;
}

/* ==========================================
   TABS STYLING - Modern with Background
   ========================================== */

.atse-tabs-wrapper {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    overflow: visible;
    margin-bottom: 0;
}

.atse-tabs {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
    align-items: center;
    background: transparent;
    border-bottom: none;
}

.atse-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    margin: 0;
    background: #fff;
    color: #6b7280;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
    position: relative;
}

/* First tab gets top-left rounding */
.atse-tab:first-child {
    border-top-left-radius: 12px;
}

/* Last tab gets top-right rounding */
.atse-tab:last-child {
    border-top-right-radius: 12px;
}

.atse-tab:hover {
    background: #f3f4f6;
    color: #19273E;
}

.atse-tab.active {
    background: #19273E;
    color: #fff;
}

.atse-tab.active i {
    color: #fff;
}

.atse-tab i {
    font-size: 16px;
    font-style: normal;
    display: inline-block;
    width: auto;
    height: auto;
    text-align: center;
    transition: color 0.3s ease;
}

/* ==========================================
   FORM CONTAINER & STYLING
   ========================================== */

.atse-form-container {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
}

.atse-tab-content {
    display: none;
    animation: fadeIn 0.2s ease-in;
}

.atse-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   SEARCH FORM LAYOUT - 4 Inputs per Row
   ========================================== */

.atse-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

/* ==========================================
   FORM ROW & GROUP
   ========================================== */

.atse-form-row {
    width: 78%;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.atse-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
    flex: 0 0 calc(25% - 12px);
}

/* Flexible width classes from bottom CSS */
.atse-form-group.atse-width-1 { flex: 0 0 calc(20% - 20px); }
.atse-form-group.atse-width-2 { flex: 0 0 calc(40% - 12.5px); }
.atse-form-group.atse-width-3 { flex: 0 0 calc(60% - 8.33px); }
.atse-form-group.atse-width-4 { flex: 0 0 calc(80% - 6.25px); }
.atse-form-group.atse-width-5 { flex: 0 0 100%; }

.atse-form-group.atse-width-auto-1 { flex: 0 0 100%; }
.atse-form-group.atse-width-auto-2 { flex: 0 0 calc(50% - 12.5px); }
.atse-form-group.atse-width-auto-3 { flex: 0 0 calc(33.333% - 16.67px); }
.atse-form-group.atse-width-auto-4 { flex: 0 0 calc(25% - 18.75px); }
.atse-form-group.atse-width-auto-5 { flex: 0 0 calc(20% - 20px); }

/* Conditional display rules */
.atse-form-group[data-display-rule="true"] { display: none; }
.atse-form-group[data-display-rule="true"].atse-rule-show { display: flex; }

.atse-form-group.full-width {
    flex: 0 0 100%;
}

/* ==========================================
   FORM LABELS
   ========================================== */

.atse-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.atse-form-label .required {
    color: #ef4444;
    font-weight: bold;
    font-size: 14px;
}

.atse-form-label i {
    color: #19273E;
    font-size: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* ==========================================
   INPUTS, SELECTS, DATE PICKER
   ========================================== */

.atse-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.atse-input,
.atse-select,
.atse-date-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    color: #1f2937;
    font-weight: 500;
}

.atse-input:hover,
.atse-select:hover,
.atse-date-input:hover {
    border-color: #d1d5db;
}

.atse-input:focus,
.atse-select:focus,
.atse-date-input:focus {
    outline: none;
    border-color: #19273E;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.atse-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.atse-input:disabled,
.atse-select:disabled,
.atse-date-input:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

/* ==========================================
   AIRPORT AUTOCOMPLETE
   ========================================== */

.atse-autocomplete-results {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.atse-autocomplete-results.show { display: block; }

.atse-autocomplete-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.atse-autocomplete-item:last-child { border-bottom: none; }

.atse-autocomplete-item:hover { background: #f9fafb; }

.atse-airport-icon {
    font-size: 18px;
    color: #19273E;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.atse-airport-info { flex: 1; }

.atse-airport-code { font-weight: 600; font-size: 14px; color: #1f2937; }
.atse-airport-name { font-size: 13px; color: #6b7280; margin-top: 2px; }
.atse-airport-country { font-size: 12px; color: #9ca3af; }

.atse-autocomplete-loading,
.atse-autocomplete-no-results {
    padding: 12px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* ==========================================
   GUEST SELECTOR
   ========================================== */

.atse-guest-selector {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #1f2937;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.atse-guest-selector:hover { border-color: #d1d5db; background: #f3f4f6; }
.atse-guest-selector:focus { outline: none; border-color: #19273E; box-shadow: 0 0 0 3px rgba(79, 70, 229,0.1); background: #fff; }
.atse-guest-selector i { color: #6b7280; font-size: 12px; transition: transform 0.2s ease; }
.atse-guest-selector.active i { transform: rotate(180deg); }
.atse-guest-display { color: #1f2937; font-weight: 500; }

.atse-guest-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 16px;
    z-index: 1001;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1),0 4px 6px -2px rgba(0,0,0,0.05);
    min-width: 280px;
}

.atse-guest-dropdown.show { display: block; }

.atse-guest-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.atse-guest-row:last-child { border-bottom: none; }

.atse-guest-label { flex: 1; font-weight: 500; color: #1f2937; font-size: 14px; }
.atse-guest-controls { display: flex; align-items: center; gap: 12px; }
.atse-guest-btn {
    width: 36px; height: 36px; padding: 0; border: 1px solid #d1d5db;
    background: #fff; color: #1f2937; border-radius: 6px;
    cursor: pointer; font-weight: 600; font-size: 18px;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s ease;
}
.atse-guest-btn:hover { background:#f9fafb; border-color:#19273E; color:#19273E; }
.atse-guest-btn:disabled { background:#f9fafb; color:#d1d5db; cursor:not-allowed; border-color:#e5e7eb; }
.atse-guest-count { min-width: 32px; text-align: center; font-weight: 500; color:#1f2937; font-size:15px; }

/* ==========================================
   RADIO & CHECKBOX
   ========================================== */
.atse-radio-group, .atse-checkbox-group {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.atse-radio-label, .atse-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.atse-radio-label:hover, .atse-checkbox-label:hover { background:#f9fafb; }
.atse-radio-label input[type="radio"], .atse-checkbox-label input[type="checkbox"] { width:18px;height:18px; accent-color:#19273E; }
.atse-radio-label span, .atse-checkbox-label span { flex:1; cursor:pointer; color:#1f2937; font-size:14px; }

/* ==========================================
   SUBMIT BUTTON
   ========================================== */

.atse-submit-btn {
    flex: 0 0 auto;
    margin-left:auto;
    align-self: center;
    padding:16px 32px;
    background:#19273E;
    color:#fff;
    border:none;
    border-radius:8px;
    font-size:15px;
    font-weight:600;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    height:fit-content;
    white-space:nowrap;
    position:relative;
    overflow:hidden;
    transition:all 0.2s ease;
}

.atse-submit-btn:hover { background:#4338ca; box-shadow:0 4px 12px rgba(79,70,229,0.4); transform:translateY(-2px);}
.atse-submit-btn:active { background:#3730a3; transform:translateY(0);}
.atse-submit-btn:disabled { opacity:0.5; cursor:not-allowed; transform:none; pointer-events:none;}
.atse-submit-btn i { font-size:16px; }

/* ==========================================
   LOADING STATES
   ========================================== */

.atse-loading { display:none; width:16px; height:16px; border:2px solid rgba(255,255,255,0.3); border-top-color:#fff; border-radius:50%; animation:spin 0.8s linear infinite;}
.atse-submit-btn.loading .atse-loading { display:block; }
.atse-submit-btn.loading .atse-submit-text { display:none; }

@keyframes spin { to{transform:rotate(360deg);} }

/* ==========================================
   ERROR & SUCCESS STATES
   ========================================== */

.atse-input.error, .atse-select.error, .atse-date-input.error { border-color:#ef4444; background:#fef2f2;}
.atse-input.error:focus, .atse-select.error:focus, .atse-date-input:focus { box-shadow:0 0 0 3px rgba(239,68,68,0.1);}
.atse-error-message { color:#ef4444; font-size:12px; margin-top:4px; display:flex; align-items:center; gap:4px; }
.atse-error-message::before { content:'⚠'; font-weight:bold; }
.atse-success-message { background:#d1fae5; border:1px solid #a7f3d0; color:#065f46; padding:12px 16px; border-radius:8px; margin-bottom:20px; display:flex; align-items:center; gap:8px; font-size:14px;}
.atse-success-message::before { content:'✓'; font-weight:bold; font-size:16px; }
.atse-loading-message { background:#dbeafe; border:1px solid #bfdbfe; color:#1e40af; padding:12px 16px; border-radius:8px; margin-bottom:20px; display:flex; align-items:center; gap:8px; font-size:14px; }

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media(max-width:1024px){
    .atse-form-group { flex:1 1 calc(50% - 8px); min-width:0; }
    .atse-submit-btn { flex:1 1 100%; align-self:stretch; }
    .atse-search-form { flex-direction:row; flex-wrap:wrap; }
    .atse-form-row { width: 100%; }
}

@media(max-width:768px){
    .atse-tabs-wrapper { padding:0; }
    .atse-tabs { gap:6px; padding:0; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; flex-wrap:nowrap;}
    .atse-tabs::-webkit-scrollbar { display:none; }
    .atse-tab { padding:12px 20px; font-size:14px; flex-shrink:0;}
    .atse-form-container { padding:24px 20px; border-radius:0 0 12px 12px; }
    .atse-form-row { width: 100%; }
    .atse-form-group { flex:1 1 100%; min-width:100%; }
    .atse-guest-dropdown { min-width:240px; }
}

@media(max-width:480px){
    .atse-tab { padding:10px 14px; font-size:13px; }
    .atse-guest-dropdown { min-width:200px; }
    .atse-input, .atse-select, .atse-date-input { padding:12px 14px; font-size:14px; }
    .atse-submit-btn { padding:14px 20px; font-size:14px; }
    .atse-form-row { width: 100%; }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

.atse-input:focus-visible,
.atse-select:focus-visible,
.atse-date-input:focus-visible,
.atse-submit-btn:focus-visible,
.atse-guest-selector:focus-visible {
    outline: 2px solid #19273E;
    outline-offset: 2px;
}

.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .atse-container { box-shadow:none; }
    .atse-submit-btn { display:none; }
}
