/**
 * Guest Selector Component Styles - Dropdown Popup Version
 * Clickable button that opens a popup with plus/minus controls
 */

/* Main Container */
.guest-selector {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Trigger Button */
.guest-selector__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff !important;
    cursor: pointer;
    font-size: 0.938rem;
    transition: all 0.2s ease;
    gap: 0.375rem;
    color: #2c3e50 !important;
    font-weight: 500;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.guest-selector__trigger:hover {
    border-color: #8B7355 !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.1);
}

.guest-selector__trigger:focus {
    outline: 2px solid #8B7355 !important;
    outline-offset: 2px;
    background: #fff !important;
}

.guest-selector__trigger:active {
    background: #fff !important;
}

/* Remove any blue from trigger states */
.guest-selector__trigger[aria-expanded="true"] {
    background: #fff !important;
    border-color: #8B7355 !important;
}

.guest-selector__trigger-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guest-selector__trigger-arrow {
    display: flex;
    align-items: center;
    color: #7f8c8d;
    transition: transform 0.2s ease;
}

.guest-selector__trigger[aria-expanded="true"] .guest-selector__trigger-arrow {
    transform: rotate(180deg);
}

/* Popup Container */
.guest-selector__popup {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 200;
    display: none;
    min-width: 280px;
}

.guest-selector__popup.open {
    display: block !important;
    animation: fadeInDown 0.2s ease;
}

/* Guest Rows */
.guest-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.guest-row:last-of-type {
    border-bottom: none;
}

.guest-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.guest-label strong {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.guest-sublabel {
    font-size: 0.875rem;
    color: #7f8c8d;
    font-weight: 400;
}

/* Guest Controls */
.guest-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.guest-count {
    min-width: 1.5rem;
    text-align: center;
    font-size: 0.938rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Plus/Minus Buttons - Circular with Brown/Tan Styling */
/* Minimum 44x44px for touch accessibility (WCAG 2.1 Level AAA) */
/* Using px instead of rem to ensure consistent 44px across all font sizes */
.guest-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px !important; /* Fixed 44px for accessibility */
    height: 44px !important; /* Fixed 44px for accessibility */
    border: 2px solid #8B7355 !important;
    border-radius: 50%;
    background-color: #fff !important;
    color: #8B7355 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1;
}

.guest-btn:hover:not(:disabled) {
    background-color: #8B7355 !important;
    color: #fff !important;
    transform: scale(1.05);
}

.guest-btn:active:not(:disabled) {
    transform: scale(0.95);
    background-color: #8B7355 !important;
}

.guest-btn:disabled,
.guest-btn.disabled {
    border-color: #bdc3c7 !important;
    color: #bdc3c7 !important;
    background-color: #f8f9fa !important;
    cursor: not-allowed;
    opacity: 0.5;
}

.guest-btn:focus {
    outline: 2px solid #8B7355 !important;
    outline-offset: 2px;
}

.guest-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Ensure + and - symbols are centered */
.guest-btn.minus::before,
.guest-btn.plus::before {
    display: none;
}

/* Animation */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .guest-selector__trigger {
        font-size: 0.938rem;
        padding: 0.65rem 0.875rem;
    }

    .guest-selector__popup {
        min-width: 260px;
    }

    .guest-row {
        padding: 1rem 0;
    }

    .guest-label strong {
        font-size: 0.938rem;
    }

    .guest-sublabel {
        font-size: 0.813rem;
    }

    /* Keep 44x44px minimum even on mobile for accessibility */
    /* Size already set to 44px in main rule with !important */
    .guest-btn {
        font-size: 1rem;
    }

    .guest-controls {
        gap: 0.75rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .guest-selector__popup {
        left: 0;
        right: 0;
        min-width: auto;
    }

    .guest-selector__trigger-text {
        font-size: 0.875rem;
    }
}

/* Integration with Search Forms */
.search-form__field .guest-selector {
    margin-top: 0;
}

.search-form__field label + .guest-selector {
    margin-top: 0.5rem;
}

/* Integration with Filter Forms */
.filter-form__field .guest-selector {
    margin-top: 0;
}

.filter-form__field label + .guest-selector {
    margin-top: 0.5rem;
}

/* Property Page Booking Section Integration */
.booking-section .guest-selector {
    width: 100%;
}

.booking-section .guest-selector__trigger {
    border: 1px solid #e5e5e5;
    background: #f8f9fa;
}

.booking-section .guest-selector__trigger:hover {
    background: #fff !important;
    border-color: #8B7355 !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .guest-btn {
        border-width: 3px !important;
    }

    .guest-btn:hover:not(:disabled) {
        border-color: #6d5a47 !important;
        background-color: #6d5a47 !important;
    }

    .guest-selector__trigger {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .guest-btn {
        transition: none;
    }

    .guest-selector__popup.open {
        animation: none;
    }

    .guest-selector__trigger-arrow {
        transition: none;
    }

    .guest-selector__trigger {
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .guest-selector__trigger {
        background: #2c3e50 !important;
        border-color: #34495e;
        color: #ecf0f1 !important;
    }

    .guest-selector__trigger:hover {
        border-color: #8B7355 !important;
        box-shadow: 0 2px 8px rgba(139, 115, 85, 0.2);
    }

    .guest-selector__popup {
        background: #2c3e50;
        border-color: #34495e;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .guest-row {
        border-bottom-color: #444;
    }

    .guest-label strong {
        color: #ecf0f1;
    }

    .guest-sublabel {
        color: #95a5a6;
    }

    .guest-count {
        color: #ecf0f1;
    }

    .guest-btn {
        background-color: #2c3e50 !important;
        border-color: #8B7355 !important;
        color: #8B7355 !important;
    }

    .guest-btn:hover:not(:disabled) {
        background-color: #8B7355 !important;
        color: #2c3e50 !important;
    }
}

/* RTL Support */
[dir="rtl"] .guest-selector__trigger-text {
    text-align: right;
}

[dir="rtl"] .guest-selector__popup {
    left: auto;
    right: 0;
}

/* Print Styles */
@media print {
    .guest-selector__popup {
        display: none !important;
    }

    .guest-selector__trigger-arrow {
        display: none;
    }
}