.guest-dropdown {
    position: relative;
    width: 100%;
}

.guest-toggle {
    padding: 0.75rem;
    font-family: Cambria, "Times New Roman", serif;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.guest-panel {
    /* Absolute positioning relative to the viewport (fixed is generally better for modals) */
    position: fixed; /* Changed to fixed for true viewport centering */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centering magic */

    /* Initial desktop size */
    width: 380px;
    max-width: 90vw; /* Prevent it from being too wide on narrow desktops/tablets */
    max-height: 90vh; /* Prevent it from being too tall on shorter screens */

    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    z-index: 1000;
    padding: 1.2rem 1.5rem; /* Default padding for larger screens */
    display: none;
    overflow-y: auto; /* Enable scrolling only if content overflows */
    box-sizing: border-box; /* Ensures padding is included in width/height */
}

.guest-panel .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.2rem 0;
    gap: 1rem;
}

.guest-panel .label {
    flex: 1;
    color: #000;
    font-weight: 500;
}

.guest-panel .sub-label {
    font-size: 0.8rem;
    color: #777;
}

.guest-panel .counter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.guest-panel .counter button {
    width: 36px;
    height: 36px;
    font-size: 20px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    border-radius: 4px;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.guest-panel .counter span {
    width: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.guest-panel .buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.guest-panel .clear,
.guest-panel .apply {
    padding: 0.6rem 1.3rem;
    border: none;
    cursor: pointer;
    font-family: Cambria, "Times New Roman", serif;
    font-size: 1rem;
    border-radius: 4px;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.guest-panel .clear {
    background-color: #fff;
    border: 1px solid #000;
}

.guest-panel .apply {
    background-color: #000;
    color: #fff;
}

/* 🔄 Responsive Adjustments - General Mobile (Tablets and larger phones) */
@media (max-width: 768px) {
    .guest-panel {
        /* Centering already handled by fixed positioning */
        width: 90vw; /* Take 90% of viewport width */
        max-width: 400px; /* Cap width for larger tablets/portrait phones to prevent stretching too wide */
        padding: 1rem; /* Slightly reduced padding */
        border-radius: 8px;
    }

    .guest-panel .row {
        flex-direction: column;
        align-items: flex-start;
        margin: 1rem 0;
        gap: 0.5rem;
    }

    .guest-panel .label {
        width: 100%;
        text-align: left;
    }

    .guest-panel .sub-label {
        width: 100%;
        text-align: left;
    }

    .guest-panel .counter {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
    }

    .guest-panel .counter button {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .guest-panel .counter span {
        width: 40px;
        font-size: 1.2rem;
    }

    .guest-panel .buttons {
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 1.2rem;
    }

    .guest-panel .clear,
    .guest-panel .apply {
        width: 100%;
        font-size: 1rem;
        padding: 0.7rem 1rem;
    }
}

/* 📱 Specific Adjustments for Smaller Phones (e.g., iPhone SE, older Androids, many Vivo/Oppo models) */
@media (max-width: 480px) {
    .guest-panel {
        width: 95vw; /* Take 95% of viewport width on very small screens */
        padding: 0.7rem; /* Further reduced padding */
        border-radius: 6px;
    }

    .guest-panel .row {
        margin: 0.7rem 0; /* Reduced row margin */
        gap: 0.2rem; /* Further reduced gap */
    }

    .guest-panel .label {
        font-size: 0.9rem; /* Slightly smaller label font */
    }

    .guest-panel .sub-label {
        font-size: 0.7rem; /* Slightly smaller sub-label font */
    }

    .guest-panel .counter button {
        width: 34px; /* Slightly smaller buttons */
        height: 34px;
        font-size: 18px;
    }

    .guest-panel .counter span {
        width: 32px; /* Adjust width */
        font-size: 1rem; /* Adjust font size */
    }

    .guest-panel .buttons {
        gap: 0.5rem; /* Even smaller gap for buttons */
        margin-top: 1rem;
    }

    .guest-panel .clear,
    .guest-panel .apply {
        font-size: 0.85rem; /* Slightly smaller button font */
        padding: 0.5rem 0.7rem; /* Reduced padding */
    }
}

/* Landscape orientation for smaller phones - making it even more compact if needed */
@media (max-height: 400px) and (max-width: 768px) and (orientation: landscape) {
    .guest-panel {
        padding: 0.5rem; /* Even less padding */
        font-size: 0.9em; /* Scale down text slightly */
        width: 80vw; /* Keep it relatively wide */
        max-width: 500px; /* But cap it */
    }
    .guest-panel .row {
        flex-direction: row; /* Try to keep rows in a row */
        flex-wrap: wrap; /* Allow wrapping */
        justify-content: space-around;
        margin: 0.5rem 0; /* Reduced margin */
        gap: 0.5rem;
    }
    .guest-panel .label {
        flex: none; /* Don't force to take full width */
        margin-right: 10px; /* Space between label and counter */
    }
    .guest-panel .counter {
        width: auto; /* Allow counter to shrink */
    }
    .guest-panel .buttons {
        flex-direction: row; /* Try to keep buttons side-by-side */
        justify-content: center; /* Center buttons horizontally */
        gap: 0.7rem;
    }
    .guest-panel .clear,
    .guest-panel .apply {
        padding: 0.4rem 0.6rem; /* Minimal padding */
        font-size: 0.8rem;
    }
}
