/**
 * Unified form controls (source of truth: invoice.html)
 * Applies invoice geometry/visuals to:
 * - invoice page form
 * - tool pages custom selects/date wrappers (.qr-panel)
 */

/* Keep top nav/apps dropdown above any form control icons/popups */
#mainNav {
    z-index: 300000 !important;
}

#appsMenu {
    position: relative;
    z-index: 300001 !important;
}

#appsMenuPanel {
    z-index: 300002 !important;
}

/* --- tool pages: hide native select after enhancement --- */
.qr-panel [data-enhanced-select="1"] select.qr-select {
    display: none !important;
}

/* --- shared control geometry --- */
body.invoice-page #invoiceForm .invoice-form-group > input,
body.invoice-page #invoiceForm .invoice-date-wrapper input,
body.invoice-page #invoiceForm .invoice-item-row input,
body.invoice-page #invoiceForm .invoice-currency-select,
.qr-panel .invoice-date-wrapper input,
.qr-panel [data-enhanced-select="1"] .invoice-currency-select {
    height: 41px !important;
    min-height: 41px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: none !important;
    color: var(--color-input-text) !important;
    box-sizing: border-box !important;
    backdrop-filter: blur(6px);
}

body.invoice-page #invoiceForm .invoice-form-group > input,
body.invoice-page #invoiceForm .invoice-date-wrapper input,
body.invoice-page #invoiceForm .invoice-item-row input,
.qr-panel .invoice-date-wrapper input {
    padding: 0 14px !important;
    line-height: 41px !important;
}

body.invoice-page #invoiceForm .invoice-currency-wrapper,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper {
    height: 41px !important;
}

body.invoice-page #invoiceForm .invoice-currency-select,
.qr-panel [data-enhanced-select="1"] .invoice-currency-select {
    padding: 0 14px !important;
    line-height: 41px !important;
    border-radius: 12px !important;
}

body.invoice-page #invoiceForm .invoice-currency-wrapper.select-open:not(.dropdown-open-up) .invoice-currency-select,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open:not(.dropdown-open-up) .invoice-currency-select {
    border-radius: 12px 12px 0 0 !important;
}

body.invoice-page #invoiceForm .invoice-currency-wrapper.dropdown-open-up.select-open .invoice-currency-select,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.dropdown-open-up.select-open .invoice-currency-select {
    border-radius: 0 0 12px 12px !important;
}

body.invoice-page #invoiceForm .invoice-form-group > input:hover,
body.invoice-page #invoiceForm .invoice-date-wrapper input:hover,
body.invoice-page #invoiceForm .invoice-item-row input:hover,
body.invoice-page #invoiceForm .invoice-currency-select:hover,
.qr-panel .invoice-date-wrapper input:hover,
.qr-panel [data-enhanced-select="1"] .invoice-currency-select:hover {
    background: rgba(255, 255, 255, 0.10) !important;
    border: none !important;
}

body.invoice-page #invoiceForm .invoice-form-group > input:focus,
body.invoice-page #invoiceForm .invoice-date-wrapper input:focus,
body.invoice-page #invoiceForm .invoice-item-row input:focus,
body.invoice-page #invoiceForm .invoice-currency-wrapper.select-open .invoice-currency-select,
.qr-panel .invoice-date-wrapper input:focus,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open .invoice-currency-select {
    background: rgba(255, 255, 255, 0.11) !important;
    border: none !important;
    outline: none !important;
    z-index: 1 !important;
}

/* --- dropdown panel --- */
body.invoice-page #invoiceForm .invoice-currency-dropdown,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open .invoice-currency-dropdown {
    z-index: 100005 !important;
    max-height: 240px !important;
    background: rgba(18, 18, 18, 0.98) !important;
    border: none !important;
    border-top: none !important;
    border-radius: 0 0 12px 12px !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.invoice-page #invoiceForm .invoice-currency-wrapper.dropdown-open-up.select-open .invoice-currency-dropdown,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.dropdown-open-up.select-open .invoice-currency-dropdown {
    border-radius: 12px 12px 0 0 !important;
}

body.invoice-page #invoiceForm .invoice-currency-dropdown-inner,
.qr-panel [data-enhanced-select="1"] .invoice-currency-dropdown-inner {
    align-items: stretch !important;
    padding: 4px 2px !important;
    box-sizing: border-box !important;
}

body.invoice-page #invoiceForm .currency-option,
.qr-panel [data-enhanced-select="1"] .currency-option {
    color: var(--color-input-text) !important;
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 10px;
    padding: 10px 14px !important;
    direction: ltr !important;
    text-align: left !important;
}

body.invoice-page #invoiceForm .currency-option:hover,
body.invoice-page #invoiceForm .currency-option.selected,
.qr-panel [data-enhanced-select="1"] .currency-option:hover,
.qr-panel [data-enhanced-select="1"] .currency-option.selected {
    background: rgba(255, 255, 255, 0.10) !important;
}

body.invoice-page #invoiceForm .currency-option.selected,
.qr-panel [data-enhanced-select="1"] .currency-option.selected {
    padding-right: 36px !important;
}

body.invoice-page #invoiceForm .currency-option.selected::after,
.qr-panel [data-enhanced-select="1"] .currency-option.selected::after {
    right: 14px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* Invoice truth: selected option is hidden when dropdown is open */
body.invoice-page #invoiceForm .invoice-currency-wrapper.select-open .currency-option.selected,
.qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open .currency-option.selected {
    display: none !important;
}

/* --- tool pages light overrides for trigger/date only --- */
body.light-theme .qr-panel .invoice-date-wrapper input,
html.light .qr-panel .invoice-date-wrapper input,
html.light-theme .qr-panel .invoice-date-wrapper input,
body.light-theme .qr-panel [data-enhanced-select="1"] .invoice-currency-select,
html.light .qr-panel [data-enhanced-select="1"] .invoice-currency-select,
html.light-theme .qr-panel [data-enhanced-select="1"] .invoice-currency-select {
    background: rgb(240, 240, 240) !important;
    color: #000000 !important;
    border: 1px solid transparent !important;
}

body.light-theme .qr-panel .invoice-date-wrapper input:hover,
body.light-theme .qr-panel .invoice-date-wrapper input:focus,
html.light .qr-panel .invoice-date-wrapper input:hover,
html.light .qr-panel .invoice-date-wrapper input:focus,
html.light-theme .qr-panel .invoice-date-wrapper input:hover,
html.light-theme .qr-panel .invoice-date-wrapper input:focus,
body.light-theme .qr-panel [data-enhanced-select="1"] .invoice-currency-select:hover,
body.light-theme .qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open .invoice-currency-select,
html.light .qr-panel [data-enhanced-select="1"] .invoice-currency-select:hover,
html.light .qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open .invoice-currency-select,
html.light-theme .qr-panel [data-enhanced-select="1"] .invoice-currency-select:hover,
html.light-theme .qr-panel [data-enhanced-select="1"].invoice-currency-wrapper.select-open .invoice-currency-select {
    background: rgb(232, 232, 232) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}
