/* Base Styles (Desktop-first or general styles) */

/* Modal Content and Structure */
.modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
    transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
}

.modal-content {
    position: relative;
    top: 50%;
    left: 50%;
    max-width: 90%;
    transform: translate(-50%, -50%);
    background-color: white;
    width: 90%;
    height: 70%;
    max-width: 800px;
    border-radius: 0.5rem;
    max-height: 70%;
    overflow: visible;
    overflow-y: scroll; 
}

.show-modal {
    opacity: 1;
    visibility: visible;
    transform: scale(1.0);
    transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}

.close-button {
    float: right;
    width: 50px;
    text-align: center;
    cursor: pointer;
    font-size: 30px;
    line-height: 40px;
    color: #000;
}

/* Flex Container for Radio/Dropdown Groups */
.custom-dropdowns {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 10px;
}

/* Individual Selects and Multi-Selects */
.custom-select,
.custom-multi-select {
    position: relative;
    width: 300px;
    margin-bottom: 10px;
    font-family: sans-serif;
}

/* Select Button/Display */
.select-button {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgb(255, 170, 85);
    background-color: #fff;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dropdown Content */
.dropdown-content {
    position: absolute;
    width: 100%;
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

.dropdown-content.active {
    display: block;
}

.dropdown-content div {
    padding: 10px;
    cursor: pointer;
}

.dropdown-content div:hover {
    background-color: #ffe8d4;
}

/* Multi-Select Specific Styles */
.custom-multi-select .select-display {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 5px;
    border-radius: 10px;
    border: 1px solid rgb(255, 170, 85);
    background-color: #fff;
    cursor: text;
    min-height: 40px;
}

.custom-multi-select .selected-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.custom-multi-select .tile {
    display: flex;
    align-items: center;
    background-color: rgb(255, 170, 85);
    color: white;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.9em;
}

.custom-multi-select .tile .remove {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
}

.custom-multi-select .search-input {
    border: none;
    outline: none;
    flex-grow: 1;
    padding: 5px 0;
    min-width: 50px;
}

/* NEXT BUTTON AND ERROR MESSAGE FLOW (DESKTOP) */
.next-btn {
    background: #f57c00;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    float: right;
    margin-top: 20px;
    clear: both;
}

#reservation-error {
    color: red;
    margin-top: 5px;
    text-align: right;
    width: 100%;
    clear: both;
}

/* CRITICAL MOBILE RESPONSIVENESS FIXES (max-width: 768px) */
@media only screen and (max-width: 768px) {

    /* 1. Modal Content: Ensure it scales and scrolls if needed */
    .modal-content {
        width: 90%;
        max-width: none;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* 2. Selection Step Container: Ensure correct padding */
    #selectionStep {
        width: 100% !important;
        padding: 20px !important;
    }

    /* 3. Dropdown Layout: Stack and left-align */
    .number-selection-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .custom-dropdowns {
        width: 100%;
        align-items: flex-start;
        margin-left: 0;
        margin-top: 15px;
    }

    .custom-select,
    .custom-multi-select {
        width: 100%;
        max-width: none;
    }

    /* 4. Button Flow: Make it a full-width block element */
    .next-btn {
        float: none;
        display: block;
        width: 100%;
        margin-top: 20px;
        text-align: center;
    }

    /* 5. Error Message Flow: Align to the left/start */
    #reservation-error {
        text-align: left;
        margin-top: 5px;
    }
}

/* Numbers Table Styles */
#numbers-table-section {
    display: none;
    margin-top: 20px;
    max-height: 400px;
    /* Adjust as needed */
    overflow-y: auto;
    /* Scroll inside modal if table is large */
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}

/* Table */
.number-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: sans-serif;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.number-table th,
.number-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.number-table th {
    background-color: #f57c00;
    color: white;
    font-weight: 600;
}

.number-table tr {
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.number-table tr:hover {
    background-color: #ffe8d4;
    transform: scale(1.01);
}

.number-table tr:nth-child(even) {
    background-color: #fff8f0;
}

/* Pagination Container */
#numbers-pagination {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    gap: 6px;
}

/* Pagination Buttons */
.pagination-btn {
    padding: 6px 12px;
    background-color: #f57c00;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.pagination-btn:hover:not(.active):not(.disabled) {
    background-color: #ff9100;
    transform: scale(1.05);
}

.pagination-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: #ffa64d;
    font-weight: bold;
}

.hidden {
    display:none;
}