/* CEDF custom select, date & time components */

.cedf-native-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Shared trigger button ── */
.cedf-custom-select,
.cedf-custom-date,
.cedf-custom-time {
  position: relative;
  width: 100%;
}

.cedf-custom-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--field-control-h, 42px);
  min-height: var(--field-control-h, 42px);
  max-height: var(--field-control-h, 42px);
  padding: 0 12px;
  border: 1px solid var(--rule, #D8CFB8);
  border-radius: var(--field-radius, 8px);
  background: #fff;
  color: var(--charcoal, #2A2A28);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  margin: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cedf-custom-trigger:hover {
  border-color: #C4B9A4;
}

.cedf-custom-trigger:focus,
.cedf-custom-select.is-open .cedf-custom-trigger,
.cedf-custom-date.is-open .cedf-custom-trigger,
.cedf-custom-time.is-open .cedf-custom-trigger {
  outline: none;
  border-color: var(--navy, #1B2A4A);
  box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.1);
}

.cedf-custom-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cedf-custom-value.is-placeholder {
  color: #9A9284;
}

.public-body .cedf-custom-value.is-placeholder {
  color: rgba(255, 255, 255, 0.9) !important;
}

.cedf-custom-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy, #1B2A4A);
  opacity: 0.45;
  transition: transform 0.2s ease, opacity 0.15s ease;
  flex-shrink: 0;
  line-height: 0;
}

.cedf-custom-arrow svg,
.cedf-custom-arrow i[data-lucide] {
  width: 16px !important;
  height: 16px !important;
  display: block;
}

.cedf-custom-select.is-open .cedf-custom-arrow,
.cedf-custom-date.is-open .cedf-custom-arrow,
.cedf-custom-time.is-open .cedf-custom-arrow {
  transform: rotate(180deg);
  opacity: 0.9;
  color: var(--orange, #E8852A);
}

/* ── Dropdown menu (select) ── */
.cedf-custom-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 9999;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--rule, #D8CFB8);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(27, 42, 74, 0.14);
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.cedf-custom-select.is-open .cedf-custom-menu {
  display: block;
  animation: cedfDropIn 0.15s ease;
}

@keyframes cedfDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.cedf-custom-option {
  padding: 10px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  color: var(--charcoal, #2A2A28);
  transition: background 0.1s ease;
}

.cedf-custom-option:hover,
.cedf-custom-option.is-focused {
  background: var(--parchment-dim, #F1EBDC);
}

.cedf-custom-option.is-selected {
  background: rgba(27, 42, 74, 0.08);
  color: var(--navy, #1B2A4A);
  font-weight: 600;
}

.cedf-custom-option.is-disabled {
  display: none;
}

/* ── Calendar (date) ── */
.cedf-custom-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 9999;
  display: none;
  background: #fff;
  border: 1px solid var(--rule, #D8CFB8);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(27, 42, 74, 0.14);
  padding: 14px;
  min-width: 280px;
  animation: cedfDropIn 0.15s ease;
}

.cedf-custom-date.is-open .cedf-custom-panel,
.cedf-custom-time.is-open .cedf-custom-panel {
  display: block;
}

.cedf-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cedf-cal-title {
  font-family: 'Lora', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy, #1B2A4A);
}

.cedf-cal-nav {
  display: flex;
  gap: 4px;
}

.cedf-cal-nav button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule, #D8CFB8);
  border-radius: 8px;
  background: var(--parchment-dim, #F1EBDC);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy, #1B2A4A);
  transition: background 0.15s, border-color 0.15s;
}

.cedf-cal-nav button:hover {
  background: #fff;
  border-color: var(--navy, #1B2A4A);
}

.cedf-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 6px;
}

.cedf-cal-weekdays span {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8A8274;
  padding: 4px 0;
}

.cedf-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cedf-cal-day {
  aspect-ratio: 1;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--charcoal, #2A2A28);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.cedf-cal-day:hover:not(:disabled) {
  background: var(--parchment-dim, #F1EBDC);
}

.cedf-cal-day.is-selected {
  background: var(--navy, #1B2A4A);
  color: #fff;
  font-weight: 600;
}

.cedf-cal-day.is-today:not(.is-selected) {
  border: 1px solid var(--orange, #E8852A);
  color: var(--orange-dark, #C46E1A);
}

.cedf-cal-day:disabled {
  opacity: 0.25;
  cursor: default;
}

.cedf-cal-day.is-other {
  color: #B5AEA0;
}

/* ── Time picker ── */
.cedf-time-panel {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.cedf-time-col {
  flex: 1;
}

.cedf-time-col label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8A8274;
  margin-bottom: 5px;
}

.cedf-time-col select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--rule, #D8CFB8);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.cedf-time-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule, #D8CFB8);
}

.cedf-time-actions button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--rule, #D8CFB8);
  background: var(--parchment-dim, #F1EBDC);
  color: var(--navy, #1B2A4A);
}

.cedf-time-actions button.cedf-time-apply {
  background: var(--navy, #1B2A4A);
  color: #fff;
  border-color: var(--navy, #1B2A4A);
}

/* Invalid */
.field.invalid .cedf-custom-trigger,
.filters .field.invalid .cedf-custom-trigger {
  border-color: var(--error, #B34A3C) !important;
}

/* Lucide helpers */
.lucide-icon, i[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lucide-icon svg, i[data-lucide] svg { width: 100%; height: 100%; }

.format-icon {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 12px; background: var(--parchment-dim, #F1EBDC);
  display: flex; align-items: center; justify-content: center;
  color: var(--navy, #1B2A4A);
}

.format-icon i[data-lucide] { width: 26px !important; height: 26px !important; }
.stat-icon i[data-lucide] { width: 22px !important; height: 22px !important; }
.nav-icon i[data-lucide] { width: 18px !important; height: 18px !important; }

.logout-link, .topbar-link { display: inline-flex; align-items: center; gap: 8px; }

.confirm .mark { font-size: 0; }
.confirm .mark i[data-lucide] { width: 24px !important; height: 24px !important; color: #fff; }

.admin-body .cedf-custom-trigger {
  padding: 9px 12px;
  font-size: 14px;
  border-radius: 8px;
  background: var(--page-bg, #373657);
  border-color: var(--field-border, rgba(255, 255, 255, 0.55));
  color: var(--sheet-ink, #fff);
}

.cedf-field-icon { display: none; }
.cedf-field-control { display: contents; }
