/* UI Controls - custom selects, datepicker, disabled states */

/* Page header actions width */
.page-header .actions .ui-select-toggle{ min-width: 160px; }
.page-header .actions .ui-select{ min-width: 160px; }

/* === Custom UI controls === */
.ui-select{ position:relative; }
.ui-select.hidden-native select{ display:none !important; }
.ui-select-toggle{
  width:100%; background:var(--panel-2); color:var(--text);
  border:1px solid var(--line); border-radius:10px; padding:10px 12px; height:40px;
  display:flex; align-items:center; justify-content:space-between; cursor:pointer;
}
.ui-select-toggle .label{opacity:.9; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.ui-select-menu{
  position:absolute; left:0; right:0; top:calc(100% + 6px);
  background:var(--panel-2); border:1px solid var(--line); border-radius:10px;
  max-height:220px; overflow:auto; z-index:1000; box-shadow:0 10px 30px rgba(0,0,0,.4);
  padding:6px;
  display:none;
}
.ui-option{ padding:8px 10px; border-radius:8px; cursor:pointer; }
.ui-option[aria-selected="true"], .ui-option:hover{ background:rgba(255,255,255,.06); }
.ui-caret{ margin-left:8px; opacity:.6; }

/* Custom select: only show menu when open */
.ui-select.open .ui-select-menu{ display:block; }

/* Frequency row controls */
.freq-row .ui-select-toggle,
.freq-row .ui-select {
  min-width: 6.2rem;
}

/* Datepicker */
.ui-date{ position:relative; }
.ui-date input{ width:100%; background:var(--panel-2); color:var(--text);
  border:1px solid var(--line); border-radius:10px; padding:10px 12px; height:40px; }
.dp{ position:fixed; left:0; top:0; width:260px; background:var(--panel-2);
  border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.4); z-index:2000; }
.dp .dp-head{ display:flex; align-items:center; justify-content:space-between; padding:10px; border-bottom:1px solid var(--line); }
.dp .dp-head button{ background:transparent; border:none; color:var(--text); font-size:16px; cursor:pointer; }
.dp .grid{ display:grid; grid-template-columns: repeat(7, 1fr); gap:4px; padding:10px; }
.dp .dow, .dp .cell{ text-align:center; font-size:12px; opacity:.8; }
.dp .cell{ padding:8px 0; border-radius:8px; cursor:pointer; }
.dp .cell:hover{ background:rgba(255,255,255,.06); }
.dp .cell.muted{ opacity:.35; }
.dp .cell.selected{ background:rgba(46,230,184,.18); color:#2EE6B8; font-weight:600; }

/* Advanced modal select styling */
#advModal select{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 32px;
  border-radius: 10px;
}

/* Disabled controls */
:root { 
  --disabled-opacity: 0.5; 
  --relief-disabled-opacity: 0.45; 
}

.control.is-disabled {
  opacity: var(--disabled-opacity) !important;
}
.control.is-disabled input,
.control.is-disabled .ui-select-toggle {
  color: var(--muted) !important;
}
.ui-select.is-disabled,
.control.is-disabled .ui-select { 
  pointer-events: none !important; 
}
.control.is-disabled .ui-select-toggle {
  opacity: 1 !important;
  color: var(--muted) !important;
}

/* Modal disabled state normalization */
.modal .is-disabled,
.modal .is-disabled *,
.modal input:disabled,
.modal select:disabled,
.modal button:disabled,
.modal .ui-select.is-disabled,
.modal .freq-row.is-disabled,
.modal .freq-row.is-disabled * {
  opacity: var(--relief-disabled-opacity) !important;
  pointer-events: none !important;
}

.modal .freq-row.is-disabled .label,
.modal .date-cell.is-disabled .label {
  opacity: var(--relief-disabled-opacity) !important;
}

.modal .is-disabled input,
.modal .is-disabled .ui-select-toggle,
.modal input:disabled,
.modal select:disabled{
  opacity:.55; cursor:not-allowed;
}
.modal label.is-disabled { opacity:.55; }

.submodal .is-disabled input,
.submodal .is-disabled .ui-select-toggle,
.submodal input:disabled,
.submodal select:disabled{
  opacity:.55; cursor:not-allowed;
}
.submodal label.is-disabled { opacity: .55; }
.submodal input[disabled], .submodal select[disabled] { opacity: .55 !important; cursor: not-allowed; }

/* Normalize disabled dimming */
.freq-row.is-disabled .ui-select.is-disabled .ui-select-toggle{ opacity: 1 !important; }
.freq-row select[disabled], .freq-row input[disabled], #fEndDate[disabled]{ opacity: 1; }
.freq-row.is-disabled, .freq-row.is-disabled *{ opacity: .45 !important; pointer-events: none !important; }