/**
 * Guest Popover v2 - Scoped Styles
 *
 * All styles scoped under .pca-gp to avoid Bootstrap/theme conflicts.
 * Matches Package Selector v2 design tokens.
 *
 * @package TravelerChildTheme
 * @subpackage GuestPopover
 * @since 2.0.0
 */

/* ============================================
   DESIGN TOKENS
   ============================================ */
.pca-gp {
    --pca-gp-accent: #335CFF;
    --pca-gp-accent-hover: #2850E0;
    --pca-gp-accent-light: #EBF0FF;
    --pca-gp-text-primary: #0f172a;
    --pca-gp-text-secondary: #475569;
    --pca-gp-text-muted: #64748b;
    --pca-gp-border: #dee5ee;
    --pca-gp-bg: #ffffff;
    --pca-gp-bg-muted: #f1f5f9;
    --pca-gp-radius-lg: 16px;
    --pca-gp-radius-md: 12px;
    --pca-gp-radius-sm: 8px;
    --pca-gp-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --pca-gp-z-backdrop: 1059;
    --pca-gp-z-panel: 1060;
    --pca-gp-animation-duration: 300ms;
    --pca-gp-animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --pca-gp-warning-bg: #fef3c7;
    --pca-gp-warning-border: #f59e0b;
    --pca-gp-warning-text: #92400e;
}

/* ============================================
   BASE RESET
   ============================================ */
.pca-gp,
.pca-gp * {
    box-sizing: border-box;
}

.pca-gp {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--pca-gp-text-primary);
}

.pca-gp[hidden] {
    display: none !important;
}

/* Screen reader only */
.pca-gp .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hidden utility */
.pca-gp .pca-gp-hidden {
    display: none !important;
}

/* ============================================
   BACKDROP
   ============================================ */
.pca-gp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: var(--pca-gp-z-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--pca-gp-animation-duration) var(--pca-gp-animation-easing),
                visibility var(--pca-gp-animation-duration) var(--pca-gp-animation-easing);
}

.pca-gp.is-open .pca-gp-backdrop,
.pca-gp.is-opening .pca-gp-backdrop {
    opacity: 1;
    visibility: visible;
}

.pca-gp.is-closing .pca-gp-backdrop {
    opacity: 0;
}

/* ============================================
   PANEL
   ============================================ */
.pca-gp-panel {
    position: fixed;
    background: var(--pca-gp-bg);
    border: 1px solid var(--pca-gp-border);
    border-radius: var(--pca-gp-radius-lg);
    box-shadow: var(--pca-gp-shadow);
    z-index: var(--pca-gp-z-panel);
    min-width: 280px;
    max-width: 400px;
    overflow: hidden;

    /* Animation */
    opacity: 0;
    transform: translateY(-12px);
    visibility: hidden;
    transition: opacity var(--pca-gp-animation-duration) var(--pca-gp-animation-easing),
                transform var(--pca-gp-animation-duration) var(--pca-gp-animation-easing),
                visibility var(--pca-gp-animation-duration) var(--pca-gp-animation-easing);
}

.pca-gp.is-open .pca-gp-panel {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.pca-gp.is-opening .pca-gp-panel {
    opacity: 0;
    transform: translateY(-12px);
    visibility: visible;
}

.pca-gp.is-closing .pca-gp-panel {
    opacity: 0;
    transform: translateY(-12px);
}

/* ============================================
   DEV LABEL (remove for production)
   ============================================ */
.pca-gp-dev-label {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ============================================
   CAPACITY WARNING
   ============================================ */
.pca-gp-capacity-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 16px 0;
    padding: 10px 12px;
    background: var(--pca-gp-warning-bg);
    border: 1px solid var(--pca-gp-warning-border);
    border-radius: var(--pca-gp-radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--pca-gp-warning-text);
}

.pca-gp-capacity-warning svg {
    flex-shrink: 0;
    color: var(--pca-gp-warning-border);
}

.pca-gp-capacity-warning[hidden] {
    display: none;
}

/* ============================================
   COUNTERS CONTAINER
   ============================================ */
.pca-gp-counters {
    padding: 16px;
}

/* ============================================
   COUNTER ROW
   ============================================ */
.pca-gp-counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pca-gp-border);
}

.pca-gp-counter-row:last-of-type {
    border-bottom: none;
}

/* ============================================
   COUNTER INFO
   ============================================ */
.pca-gp-counter-info {
    flex: 1;
    min-width: 0;
}

.pca-gp-counter-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--pca-gp-text-primary);
    line-height: 1.3;
}

.pca-gp-counter-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--pca-gp-accent);
    margin-top: 2px;
}

.pca-gp-counter-price--free {
    color: var(--pca-gp-text-muted);
}

.pca-gp-counter-sublabel {
    font-size: 12px;
    color: var(--pca-gp-text-muted);
    margin-top: 2px;
}

/* ============================================
   COUNTER CONTROLS
   ============================================ */
.pca-gp-counter-controls {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--pca-gp-bg-muted);
    border-radius: var(--pca-gp-radius-md);
    padding: 4px;
}

/* ============================================
   COUNTER BUTTONS - 44px MINIMUM TOUCH TARGET
   ============================================ */
.pca-gp-counter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: var(--pca-gp-bg);
    border: 1px solid var(--pca-gp-border);
    border-radius: var(--pca-gp-radius-sm);
    cursor: pointer;
    padding: 0;
    color: var(--pca-gp-text-secondary);
    transition: all 0.15s ease;
}

.pca-gp-counter-btn:hover:not(:disabled) {
    background: var(--pca-gp-bg-muted);
    border-color: #cbd5e1;
    color: var(--pca-gp-text-primary);
}

.pca-gp-counter-btn:active:not(:disabled) {
    transform: scale(0.95);
    background: var(--pca-gp-bg-muted);
}

.pca-gp-counter-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pca-gp-counter-btn:focus-visible {
    outline: 2px solid var(--pca-gp-accent);
    outline-offset: 2px;
}

.pca-gp-counter-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   COUNTER INPUT
   ============================================ */
.pca-gp-counter-input {
    width: 36px;
    height: 44px;
    min-width: 36px;
    text-align: center;
    font-size: 16px; /* Prevents iOS zoom */
    font-weight: 600;
    color: var(--pca-gp-text-primary);
    background: transparent;
    border: none;
    padding: 0;
    -moz-appearance: textfield;
}

.pca-gp-counter-input::-webkit-outer-spin-button,
.pca-gp-counter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pca-gp-counter-input:focus {
    outline: none;
}

/* ============================================
   PRICING NOTE
   ============================================ */
.pca-gp-pricing-note {
    margin: 12px 0 0;
    padding: 8px 12px;
    background: var(--pca-gp-accent-light);
    border-radius: var(--pca-gp-radius-sm);
    font-size: 12px !important;
    color: var(--pca-gp-text-secondary);
    text-align: center;
}

/* ============================================
   FOOTER
   ============================================ */
.pca-gp-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--pca-gp-border);
    background: var(--pca-gp-bg);
}

/* ============================================
   CLOSE BUTTON
   ============================================ */
.pca-gp-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    background: var(--pca-gp-accent);
    color: #ffffff;
    border: 2px solid var(--pca-gp-accent);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pca-gp-close-btn:hover {
    background: var(--pca-gp-accent-hover);
}

.pca-gp-close-btn:active {
    transform: scale(0.98);
}

.pca-gp-close-btn:focus-visible {
    outline: 2px solid var(--pca-gp-accent);
    outline-offset: 2px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .pca-gp-panel {
        position: fixed;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none;
        bottom: 0 !important;
        top: auto !important;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        transform: translateY(100%);
    }

    .pca-gp.is-open .pca-gp-panel {
        transform: translateY(0);
    }

    .pca-gp.is-opening .pca-gp-panel,
    .pca-gp.is-closing .pca-gp-panel {
        transform: translateY(100%);
    }

    /* iOS safe area support */
    .pca-gp-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .pca-gp-counters {
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* ============================================
   TABLET ADJUSTMENTS
   ============================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .pca-gp-panel {
        max-width: 360px;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .pca-gp,
    .pca-gp * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   FOCUS VISIBLE POLYFILL
   ============================================ */
.pca-gp button:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .pca-gp {
        display: none !important;
    }
}
