/* Dropdowns and Popovers */

/* Format Dropdown */
.format-dropdown {
    position: fixed;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1500;
    min-width: 180px;
    padding: var(--space-2);
}

.format-selector-wrap {
    position: relative;
}

.format-dropdown-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.format-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* Use CSS Grid for perfect radio button alignment */
.format-options .format-option {
    display: grid !important;
    grid-template-columns: 16px 1fr !important;
    align-items: center !important;
    gap: var(--space-2) !important;
    padding: var(--space-2) var(--space-3) !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    font-size: var(--font-size-sm) !important;
    font-weight: normal !important;
    color: var(--text) !important;
    transition: background 0.1s !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.format-options .format-option:hover {
    background: var(--bg-muted);
}

.format-options .format-option input[type="radio"] {
    position: relative !important;
    opacity: 1 !important;
    margin: 0 !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    justify-self: start !important;
    accent-color: var(--primary) !important;
    cursor: pointer !important;
    /* Reset any hidden/absolute positioning from other radio styles */
    visibility: visible !important;
    pointer-events: auto !important;
}

.format-options .format-option .format-preview {
    text-align: left;
    justify-self: start;
}

.format-preview {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: var(--font-size-sm);
    color: var(--text);
}

.format-custom {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-light);
}

.format-custom label {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.format-custom input {
    width: 100%;
    padding: var(--space-3) var(--space-2);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.format-custom input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-4);
}

.modal-content {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-6);
    position: relative;
}

.modal-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: var(--space-1);
}

.modal-close:hover {
    color: var(--text);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

.modal-content--info {
    max-width: 480px;
    text-align: center;
}

/* Address Autocomplete Dropdown */
.address-autocomplete-dropdown {
    position: absolute;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 2px;
}

.address-autocomplete-item {
    padding: var(--space-3) var(--space-3);
    cursor: pointer;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
    white-space: pre-line;
}

.address-autocomplete-item:last-child {
    border-bottom: none;
}

.address-autocomplete-item:hover,
.address-autocomplete-item.highlighted {
    background: var(--bg-muted);
}

/* Language Selector */
.language-selector {
    position: relative;
    display: inline-flex;
}

.language-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) !important;
}

.language-toggle .language-flag {
    font-size: 16px;
    line-height: 1;
}

.language-dropdown {
    position: fixed;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1500;
    min-width: 200px;
    padding: var(--space-2);
}

.language-dropdown-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.language-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    max-height: 300px;
    overflow-y: auto;
}

.language-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text);
    transition: background 0.1s;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.language-option:hover {
    background: var(--bg-muted);
}

.language-option.selected {
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 500;
}

.language-option .language-flag {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.language-name {
    flex: 1;
}

.language-check {
    color: var(--primary);
    font-weight: bold;
    margin-left: auto;
}

