/* ========================================
   Apple-Style Popup Menu Component
   ======================================== */

/* Main popup container */
.apple-popup-menu {
    position: fixed;
    background: var(--bg-gradient-elevated, var(--bg-elevated));
    border: 1px solid var(--border-default);
    border-radius: 10px;
    box-shadow: var(--shadow-medium);
    min-width: 140px;
    z-index: var(--z-popup-deep, 10200);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

/* Show state with animation */
.apple-popup-menu.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

/* Title text - small gray text at top */
.apple-popup-title {
    padding: 8px 12px 6px 12px;
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-align: center;
}

/* Container for option buttons */
.apple-popup-options {
    padding: 4px 0;
}

/* Individual option button */
.apple-popup-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding-block: 10px;
    padding-inline: 10px 16px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: normal;
    text-align: start;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    outline: none;
}

/* Icon in option */
.apple-popup-option-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Label in option */
.apple-popup-option-label {
    flex: 1;
}

/* Submenu arrow */
.apple-popup-arrow {
    margin-inline-start: auto;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
}

/* Has submenu - ensure arrow is at end */
.apple-popup-option.has-submenu {
    justify-content: flex-start;
}

.apple-popup-option.has-submenu .apple-popup-option-label {
    flex: 1;
}


/* Round corners for first/last options to match container */
.apple-popup-option:first-child {
    border-radius: 10px 10px 0 0;
}

.apple-popup-option:last-child {
    border-radius: 0 0 10px 10px;
}

/* If single option, round all corners */
.apple-popup-option:first-child:last-child {
    border-radius: 10px;
}

/* Hover state */
.apple-popup-option:hover {
    background-color: var(--interactive-hover);
}

/* Keyboard selection state - same gray as hover, not blue */
.apple-popup-option.selected {
    background-color: var(--interactive-hover);
    outline: none;
}

/* Active/click state */
.apple-popup-option:active {
    background-color: var(--interactive-active);
}

/* Multi-select checked state - RTL (checkmark after text) */
.apple-popup-option.checked::after {
    content: ' ✓';
    color: var(--blue-primary);
    font-weight: 600;
}

/* Section headers for grouped options */
.apple-popup-section-header {
    padding: 8px 12px 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border-default);
    margin-top: 4px;
}

.apple-popup-section-header:first-child {
    border-top: none;
    margin-top: 0;
}

/* Divider line */
.apple-popup-divider {
    height: 1px;
    background: var(--border-default);
    margin: 4px 8px;
}

/* Disabled option state */
.apple-popup-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
