/* Shared custom-select component
   Used by: bulk-action bar, filters panel, task editor, restore modal */

/* ============================================================
   BULK ACTION BAR (bottom selection panel)
============================================================ */
body.theme-material .bulk-action-bar .custom-select-root {
  position: relative;
  min-width: 180px;
}

body.theme-material .bulk-action-bar select.custom-select-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

body.theme-material .bulk-action-bar,
body.theme-material .bulk-action-bar .bulk-action-buttons,
body.theme-material .bulk-action-bar .bulk-action-move-wrap {
  overflow: visible;
}

body.theme-material .bulk-action-bar .custom-select-trigger {
  min-height: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 0 44px 0 14px;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

body.theme-material .bulk-action-bar .custom-select-trigger:hover {
  background: var(--color-brand-primary-soft);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

body.theme-material .bulk-action-bar .custom-select-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  right: 14px;
  background-image: none;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z'/%3E%3C/svg%3E") no-repeat center / contain;
  transform: translateY(-50%) rotate(180deg);
  transition: transform 0.16s ease;
}

body.theme-material .bulk-action-bar .custom-select-trigger::-ms-expand {
  display: none;
}

body.theme-material .bulk-action-bar .custom-select-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1200;
  display: grid;
  gap: 4px;
  max-height: 230px;
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  border-radius: 12px;
  border: 1px solid var(--color-brand-accent-soft);
  background: var(--color-bg-surface);
  box-shadow: var(--shadow-2);
}

body.theme-material .bulk-action-bar .custom-select-root.is-open .custom-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

body.theme-material .bulk-action-bar .custom-select-root.is-open .custom-select-trigger::after {
  transform: translateY(-50%) rotate(0deg);
}

body.theme-material .bulk-action-bar .custom-select-root.is-open .custom-select-trigger {
  border: none;
}

body.theme-material .bulk-action-bar .custom-select-option {
  display: flex;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

body.theme-material .bulk-action-bar .custom-select-option:hover {
  background: var(--color-brand-accent-soft);
}

body.theme-material .bulk-action-bar .custom-select-option.is-selected {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary-hover);
}

body.theme-material.dark-theme .bulk-action-bar .custom-select-trigger {
  border: none;
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

body.theme-material.dark-theme .bulk-action-bar .custom-select-trigger:hover {
  background: var(--color-brand-primary-soft);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

body.theme-material.dark-theme .bulk-action-bar .custom-select-menu {
  border-color: var(--color-border-strong);
  background: var(--color-bg-muted);
  box-shadow: var(--shadow-3);
}

body.theme-material.dark-theme .bulk-action-bar .custom-select-option {
  color: var(--color-text-primary);
}

body.theme-material.dark-theme .bulk-action-bar .custom-select-option:hover {
  background: var(--color-brand-accent-soft);
  color: var(--color-text-primary);
}

body.theme-material.dark-theme .bulk-action-bar .custom-select-option.is-selected {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-accent);
}

/* ============================================================
   FILTERS PANEL
============================================================ */
body.theme-material .filters-accordion-section .custom-select-root {
  position: relative;
  width: 100%;
}

body.theme-material .filters-accordion-section .custom-select-root.is-open {
  z-index: 110;
}

body.theme-material .filters-accordion-section .filter-select.custom-select-native {
  position: absolute !important;
  inset: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 100% !important;
  height: 100% !important;
  appearance: none !important;
  background-image: none !important;
}

body.theme-material .filters-accordion-section .custom-select-trigger {
  width: 100%;
  min-height: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 0 44px 0 14px;
  text-align: left;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

body.theme-material .filters-accordion-section .custom-select-trigger::after {
  content: "";
  width: 14px;
  height: 14px;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z'/%3E%3C/svg%3E") no-repeat center / contain;
  transform: translateY(-50%) rotate(180deg);
  transition: transform 0.16s ease;
}

body.theme-material .filters-accordion-section .custom-select-root.is-open .custom-select-trigger::after {
  transform: translateY(-50%) rotate(0deg);
}

body.theme-material .filters-accordion-section .custom-select-trigger:hover {
  background: var(--color-brand-primary-soft);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

body.theme-material .filters-accordion-section .custom-select-trigger:focus-visible {
  outline: none;
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

body.theme-material .filters-accordion-section .custom-select-menu {
  position: absolute;
  z-index: 1400;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  max-height: 230px;
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  border: 1px solid var(--color-brand-accent-soft);
  border-radius: 12px;
  background: var(--color-bg-surface);
  box-shadow: var(--shadow-2);
}

body.theme-material .filters-accordion-section .custom-select-root.is-open .custom-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

body.theme-material .filters-accordion-section .custom-select-option {
  display: flex;
  width: 100%;
  min-height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

body.theme-material .filters-accordion-section .custom-select-option:hover {
  background: var(--color-brand-accent-soft);
}

body.theme-material .filters-accordion-section .custom-select-option.is-selected {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary-hover);
}

body.theme-material .filters-accordion-section .custom-select-option-content,
body.theme-material .filters-accordion-section .custom-select-trigger-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.theme-material .filters-accordion-section .custom-select-priority-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

body.theme-material .filters-accordion-section .custom-select-priority-icon .custom-select-priority-flag-svg {
  width: 14px;
  height: 14px;
  display: block;
}

body.theme-material .filters-accordion-section .custom-select-priority-icon .custom-select-priority-urgent-svg {
  width: 14px;
  height: 14px;
  display: block;
}

body.theme-material .filters-accordion-section .custom-select-priority-icon.priority-normal {
  color: var(--color-text-secondary);
}

body.theme-material .filters-accordion-section .custom-select-priority-icon.priority-high {
  color: var(--color-danger);
}

body.theme-material .filters-accordion-section .custom-select-priority-icon.priority-medium {
  color: var(--chart-5);
}

body.theme-material .filters-accordion-section .custom-select-priority-icon.priority-low {
  color: var(--color-success);
}

body.theme-material .filters-accordion-section .custom-select-priority-icon.priority-urgent {
  color: var(--color-danger);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-trigger {
  border: none;
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-trigger:hover {
  background: var(--color-brand-primary-soft);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-trigger:focus-visible {
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-menu {
  border-color: var(--color-border-strong);
  background: var(--color-bg-surface);
  box-shadow: var(--shadow-3);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-option {
  color: var(--color-text-primary);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-option:hover {
  background: var(--color-brand-accent-soft);
  color: var(--color-text-primary);
}

body.theme-material.dark-theme .filters-accordion-section .custom-select-option.is-selected {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-accent);
}

/* ============================================================
   TASK EDITOR + RESTORE MODAL
============================================================ */
body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-root {
  position: relative;
  width: 100%;
}

body.theme-material .right-panel .custom-select-root.custom-select-inline {
  width: auto;
  min-width: 146px;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-native {
  position: absolute !important;
  inset: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 100% !important;
  height: 100% !important;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  padding: 8px 36px 8px 12px;
  text-align: left;
  cursor: pointer;
  position: relative;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger::after {
  content: "";
  width: 14px;
  height: 14px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.75;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M208,96l-80,80L48,96'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M208,96l-80,80L48,96'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: transform 0.16s ease;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-root.is-open .custom-select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger:hover {
  border-color: var(--color-focus-border);
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger:focus-visible {
  outline: none;
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 2px var(--color-focus-ring);
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  background: var(--color-bg-surface-alt);
  box-shadow: var(--shadow-2);
  padding: 6px;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-root.is-open .custom-select-menu {
  display: block;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-option {
  width: 100%;
  min-height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-option:hover {
  background: var(--color-brand-accent-soft);
}

body.theme-material :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-option.is-selected {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary-hover);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger {
  border-color: var(--color-border-strong);
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger:hover {
  border-color: var(--color-focus-border);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-trigger:focus-visible {
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 2px var(--color-focus-ring);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-menu {
  border-color: var(--color-border-strong);
  background: var(--color-bg-muted);
  box-shadow: var(--shadow-3);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-option {
  color: var(--color-text-primary);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-option:hover {
  background: var(--color-brand-accent-soft);
  color: var(--color-text-primary);
}

body.theme-material.dark-theme :is(.right-panel, #confirm-reopen-category-wrap, #confirm-done-modal .preclose-work-control) .custom-select-option.is-selected {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-accent);
}

/* Confirm-done modal specific sizing (keep geometry consistent with modal inputs) */
body.theme-material #confirm-done-modal .preclose-work-control .custom-select-trigger {
  min-height: var(--confirm-control-h, 42px);
  border-radius: var(--confirm-control-radius, 6px);
  border-color: var(--confirm-control-border, #dbe3ee);
  background: var(--confirm-control-bg, #f8fafc);
  font-size: 14px;
  font-weight: 400;
  padding: 10px 40px 10px 14px;
}

body.theme-material #confirm-done-modal .preclose-work-control .custom-select-menu {
  z-index: 1400;
}
