/* ------------------------------------------------------------------- */
/* --- 1. Global Reset & Integration Setup --- */
/* ------------------------------------------------------------------- */
/* FIX: Global Safety Rule to stop all elements from causing horizontal overflow */
* {
    max-width: 100%;
    /* Ensure padding/border don't violate max-width */
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: auto !important; /* Allow height to be dynamic */
    overflow: scroll;
}

body {
    margin: 0;
    padding: 0;
    /* Remove any overflow: hidden; here */
}

/* ------------------------------------------------------------------- */
/* --- 2. Form Container (Desktop/Large Screen) --- */
/* ------------------------------------------------------------------- */
#submissionForm {
    max-width: 1150px;
    width: 90%;
    height: auto;
    overflow: scroll;
    min-height: 770px;   /* 970px minimum, not fixed */
    padding: 40px;
    margin: 40px auto;

    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);

    display: flex;
    flex-direction: column;
    gap: 15px;
}

#airport-fields, #city-fields, .input-group-car {
    transition: opacity 0.4s ease-in-out;
}

/* Ensure input groups behave as block-level flex children */
.airport-fields > .input-group-trip-type,
.airport-fields > .input-group-dropup,
.airport-fields > .input-group-pickup,
.airport-fields > .input-group-pickup-time,
.airport-fields > .input-group-ticket,
.airport-fields > .input-group-car,
.airport-fields > #airport-map,
.city-fields > .input-group-pickup,
.city-fields > #city-map {
    margin-top: 10px;
}

/* ------------------------------------------------------------------- */
/* --- 3. Grouping Inputs (Default: SIDE-BY-SIDE) --- */
/* ------------------------------------------------------------------- */

.input-group-name,
.input-group-mail-phone,
.input-group-pickup-time {
    display: flex;
    gap: 15px; /* Space between fields */
    width: 100%;
}

/* Make sure the inputs within these groups share space equally */
.input-group-name input,
.input-group-mail-phone input,
.input-group-pickup-time input,
.input-group-pickup-time .field-container,
.input-group-mail-phone .iti {
    flex: 1; 
    margin: 0;
}

/* --- NEW STYLE: Trip Type Radio Group --- */
.input-group-city-airport ,.input-group-trip-type {
    display: flex;
    flex-direction: column; /* Stacks label and options row */
    gap: 10px;
}

.input-group-city-airport .city-airport-label,.input-group-trip-type .trip-type-label {
    font-weight: bold;
    color: #555555;
}

.city-airport-options-row ,.trip-options-row {
    display: flex;
    gap: 20px; /* Space between the two radio buttons */
    flex-wrap: wrap; /* Allows wrapping on smaller desktop/mobile */
}

.city-airport-options-row label,.trip-options-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

/* --- Inner Container for Date/Time Labels --- */
.input-group-pickup-time .field-container {
    display: flex;
    flex-direction: column;
}

.input-group-pickup-time .field-container label {
    font-weight: bold;
    color: #555555;
    margin-bottom: 5px;
    width: 100%;
}

/* --- Radio Buttons (Car Selection) --- */
.input-group-car {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group-car .car-group-label {
    font-weight: bold;
    color: #555555;
    margin-bottom: 5px;
}

.car-options-row {
    display: flex;
    justify-content: space-between; 
    flex-wrap: wrap; 
    gap: 15px; 
}

.car-options-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

/* ------------------------------------------------------------------- */
/* --- 4. Input Fields (General Styling) --- */
/* ------------------------------------------------------------------- */
#submissionForm input[type="text"],
#submissionForm input[type="email"],
#submissionForm input[type="tel"],
#submissionForm input[type="date"],
#submissionForm input[type="time"],
#submissionForm select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    font-size: 16px;
    color: #333333;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    height: 48px;
}

#submissionForm input:focus,
#submissionForm select:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
    outline: none;
}

.input-group-mail-phone .iti {
    flex: 1;
}

/* --- Map Section --- */
#submissionForm #airport-map {
    width: 100%;
    height: 250px;
    border-radius: 8px;
    border: 1px solid #cccccc;
}

#submissionForm #city-map {
    width: 100%;
    height: 250px;
    border-radius: 8px;
    border: 1px solid #cccccc;
}


/* --- File Upload Styling --- */
.input-group-ticket {
    margin: 0;
    padding: 15px;
    border: 2px dashed #cccccc;
    border-radius: 8px;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
    cursor: pointer;
    position: relative;
}

.input-group-ticket label {
    font-weight: 500;
    color: #555555;
    margin-bottom: 0;
    display: block;
    cursor: pointer;
    pointer-events: none;
}

.input-group-ticket input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.input-group-ticket.drag-over {
    border-color: #ffc107;
    background-color: #fff8e1;
}

.input-group-ticket.file-selected {
    border-color: #4CAF50;
}

/* --- Submit Button Style --- */
#submissionForm #submitButton {
    background-color: #ffc107;
    color: #333333;
    font-size: 18px;
    font-weight: bold;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    margin-top: 20px;
}

#submissionForm #submitButton:hover {
    background-color: #ffcd38;
}
#submissionForm #submitButton:active {
    transform: translateY(1px);
}
 #submissionForm #submitButton:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.success-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.success-modal-content {
    background: white;
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.success-icon-container {
    font-size: 50px;
    margin-bottom: 10px;
}

.success-modal-close-btn {
    margin-top: 15px;
    padding: 8px 18px;
    border: none;
    background: #333;
    color: white;
    cursor: pointer;
    border-radius: 5px;
}

.error-message {
    color: #e74c3c;        /* Red */
    font-size: 13px;
    margin-bottom: 5px;
    display: none;         /* Hidden until error appears */
}

.input-error {
    border: 1px solid #e74c3c !important;
}

/* ------------------------------------------------------------------- */
/* --- 5. MOBILE RESPONSIVENESS (Screens <= 768px) --- */
/* ------------------------------------------------------------------- */
@media (max-width: 768px) {
    
    /* A. Form Container adjustment */
    #submissionForm {
        width: 100%;
        max-width: 100%;
        margin: 1px;
        padding: 12px;

        min-height: 100vh;   /*  fills screen */
        height: auto;        /*  grows naturally */
        overflow: scroll;   /* let page scroll */
    }
    /* Ensure input groups behave as block-level flex children */
    .airport-fields > .input-group-trip-type,
    .airport-fields > .input-group-dropup,
    .airport-fields > .input-group-pickup,
    .airport-fields > .input-group-pickup-time,
    .airport-fields > .input-group-ticket,
    .airport-fields > .input-group-car,
    .airport-fields > #airport-map,
    .city-fields > .input-group-pickup,
    .city-fields > #city-map {
        margin-top: 10px;
    }

    /* B. Force all side-by-side groups to stack vertically */
    .input-group-name,
    .input-group-mail-phone,
    .input-group-pickup-time {
        flex-direction: column; 
        gap: 10px; /* Reduced vertical space */
    }
    
    /* C. NEW: Trip type options stack vertically on mobile */
    .trip-options-row {
        flex-direction: column;
        gap: 10px;
    }

    /* D. Ensure all elements inside stacked groups take full width */
    .input-group-name input,
    .input-group-mail-phone input,
    .input-group-pickup-time .field-container,
    .input-group-mail-phone .iti {
        flex: 0 0 100%; 
    }
    
    /* E. Car Options: Stack vertically for better touch targets */
    .car-options-row {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Ensure the phone input maintains correct sizing within the stacked structure */
    .input-group-mail-phone .iti {
        width: 100%;
    }
    
    .car-options-row label {
        flex: 0 0 100%; /* Each option takes its own line */
    }

}