/* Basic styles for the Aviasales Flight Search */
.afs-form-container {
    max-width: 900px; /* <-- UPDATED */
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#afs-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.afs-form-field {
    flex: 1 1 200px; /* Fields will wrap on small screens */
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s;
}

.afs-form-field label {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.afs-form-field input[type="text"],
.afs-form-field input[type="date"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.afs-form-field.afs-field-disabled {
    opacity: 0.5;
    pointer-events: none;
}
.afs-form-field.afs-field-disabled input {
    background-color: #f9f9f9;
}


/* --- Checkbox styles --- */
.afs-form-options {
    display: flex;
    flex-basis: 100%; /* Take full width */
    gap: 20px;
    margin-top: 5px;
}

.afs-checkbox-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.afs-checkbox-field label {
    margin-bottom: 0; /* Override default */
    font-weight: 500;
    cursor: pointer;
}

.afs-checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* --- Submit Button Wrapper --- */
.afs-submit-wrapper {
    flex: 1 1 100%; /* Full width */
    align-items: flex-end; /* Align button to the right */
    margin-top: 5px;
}

.afs-form-field button {
    padding: 12px 20px;
    background-color: #0073aa;
    color: white;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 150px; /* Give it some space */
}

.afs-form-field button:hover {
    background-color: #005a87;
}

.afs-form-field button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

/* Results */
#afs-results-container {
    margin-top: 20px;
}

.afs-loading {
    text-align: center;
    color: #555;
    font-style: italic;
}

.afs-error {
    text-align: center;
    color: #d93030;
    font-weight: 600;
}

/* --- NEW: Results Title --- */
.afs-results-title {
    font-size: 1.5em;
    font-weight: 600;
    color: #1a1a1a;
    text-align: right;
    direction: rtl;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}


/* --- "No Results" Box styling --- */
.afs-no-results-box {
    text-align: center;
    color: #555;
    font-style: normal;
    padding: 20px;
    border: 1px dashed #ddd;
    border-radius: 8px;
    direction: rtl; /* Set text direction */
}
.afs-no-results-box p {
    margin: 0 0 15px;
    font-size: 1.1em;
}
.afs-no-results-box p:first-child {
    font-size: 1.3em;
    font-weight: 600;
    color: #1a1a1a;
}
/* This styles the button link */
.afs-no-results-box .afs-external-search-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #0073aa;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.2s;
}
.afs-no-results-box .afs-external-search-link:hover {
    background-color: #005a87;
    color: #ffffff;
}

/* --- External Search Link (after results) --- */
.afs-external-search-wrapper {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    direction: rtl;
}
/* This styles the text link */
.afs-external-search-wrapper .afs-external-search-link {
    font-size: 1.1em;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
}
.afs-external-search-wrapper .afs-external-search-link:hover {
    text-decoration: underline;
}


/* --- 3-COLUMN LAYOUT STYLES --- */

/* The main clickable box */
.results_flights_box {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    direction: rtl; /* Set direction for Right-To-Left columns */
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.results_flights_box:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Generic Column */
.afs-col {
    display: flex;
    flex-direction: column;
    flex-basis: 33.3%;
    padding: 0 10px;
}

/* Right Column: Destination */
.afs-col-dest {
    align-items: flex-start; /* Aligns to the "start" which is Right in RTL */
    font-weight: 600;
}
.afs-dest-trip-icon {
    font-size: 1.2em;
    color: #0073aa;
}
.afs-dest-name {
    font-size: 2em; /* Large IATA code */
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.1;
}
.afs-dest-dates {
    font-size: 0.9em;
    color: #555;
}

/* Middle Column: Details */
.afs-col-details {
    align-items: center; /* Center-align text */
    text-align: center;
    border-left: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    gap: 5px;
}
.afs-details-top {
    font-size: 1.2em;
    font-weight: 600;
    color: #1a1a1a;
}
.afs-details-mid {
    font-size: 0.9em;
    color: #555;
}
.afs-details-bottom {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 5px;
}
.afs-result-weekend {
    font-size: 0.8em;
    font-weight: 600;
    color: #4CAF50;
    background-color: #f0fff0;
    padding: 2px 8px;
    border-radius: 12px;
}
.afs-result-stops {
    font-size: 0.8em;
    color: #333;
    background-color: #f4f4f4;
    padding: 2px 8px;
    border-radius: 12px;
}


/* Left Column: Price */
.afs-col-price {
    align-items: flex-end; /* Aligns to the "end" which is Left in RTL */
    text-align: right;
}
.afs-price-prefix {
    font-size: 0.9em;
    color: #555;
}
.afs-price-amount {
    font-size: 2.5em;
    font-weight: 700;
    color: #0073aa;
    line-height: 1.1;
}
.afs-price-suffix {
    font-size: 0.8em;
    color: #555;
}


/* Responsive styles */
@media (max-width: 700px) {
    .results_flights_box {
        flex-direction: column;
        align-items: center; /* Center all columns */
        text-align: center;
        gap: 20px;
        direction: ltr; /* Switch to LTR for stacked column layout */
    }

    .afs-col {
        align-items: center; /* Center content of each column */
        width: 100%;
        padding: 0;
    }

    .afs-col-details {
        border: none;
        border-top: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
        padding: 15px 0;
    }

    .afs-col-dest, .afs-col-price {
        align-items: center;
        text-align: center;
    }
}