/* Reminders — inline card + kebab dropdown + edit modal + Schedules tab.
   Aesthetic: ChatGPT-style task chip. Tone-stepping for elevation, one
   semantic accent (red on destructive icon only). Theme-aware: surfaces,
   text, borders and shadows pull from design-tokens.css, so the card and
   modal adapt to light/dark via the [data-theme] attribute on <html>. */

/* ============================================================
   Inline card (the "task chip")
   ============================================================ */
.reminder-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 8px 0;
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-sizing: border-box;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font: 14px/1.3 -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease;
  min-width: 240px;
  max-width: 100%;
  position: relative;
}
.reminder-card:hover { background: var(--bg-elevated); }

.reminder-card__icon {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-primary);
}
.reminder-card__icon svg { width: 18px; height: 18px; stroke-width: 1.75; flex: 0 0 auto; }

.reminder-card__body {
  display: flex; flex-direction: column;
  min-width: 0; flex: 1 1 auto;
  gap: 2px;
}
.reminder-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.reminder-card__when {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Kebab (3-dot) button */
.reminder-card__kebab {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: 4px;
  transition: background 120ms ease, color 120ms ease;
}
.reminder-card__kebab:hover { background: var(--bg-hover); color: var(--text-primary); }
.reminder-card__kebab:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  background: var(--bg-hover);
  color: var(--text-primary);
}
.reminder-card__kebab svg { width: 18px; height: 18px; stroke-width: 1.75; flex: 0 0 auto; }

/* State variants — restrained tone shifts, no background red bleed.
   Delivered/failed get a state-coloured icon; text dims separately so the
   icon punches through at full strength. */
.reminder-card--paused .reminder-card__name,
.reminder-card--paused .reminder-card__when    { opacity: 0.55; }
.reminder-card--sending                        { opacity: 0.75; }
.reminder-card--delivered .reminder-card__name,
.reminder-card--delivered .reminder-card__when { opacity: 0.6; }
.reminder-card--delivered .reminder-card__icon { color: #10B981; }
.reminder-card--failed .reminder-card__icon    { color: #EF4444; }
.reminder-card--failed .reminder-card__when    { color: #EF4444; }
.reminder-card--cancelled .reminder-card__name { text-decoration: line-through; opacity: 0.5; }

/* ============================================================
   Kebab dropdown menu
   ============================================================ */
.reminder-dropdown {
  position: absolute;
  z-index: 100;
  min-width: 200px;
  box-sizing: border-box;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  font: 14px/1.3 -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.reminder-dropdown[hidden] { display: none; }

.reminder-dropdown__item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--text-primary);
  font: inherit; text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}
.reminder-dropdown__item:hover { background: var(--bg-hover); }
.reminder-dropdown__item:focus-visible {
  outline: none;
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 2px var(--border-focus);
}
.reminder-dropdown__item svg { width: 16px; height: 16px; stroke-width: 1.75; flex: 0 0 auto; }
.reminder-dropdown__item--danger svg { color: #EF4444; }
/* The "Delete" label itself stays default — only the icon carries the red. */

.reminder-dropdown__divider {
  height: 1px;
  margin: 4px 0;
  background: var(--border-secondary);
}

/* ============================================================
   Full edit modal (preserved from M0 — opens from "Edit details")
   ============================================================ */
.reminders-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
}
.reminders-modal[hidden] { display: none; }
.reminders-modal__backdrop {
  position: absolute; inset: 0;
  background: var(--bg-overlay);
}
.reminders-modal__panel {
  position: relative;
  box-sizing: border-box;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 20px 24px;
  width: min(560px, 95vw);
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.reminders-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.reminders-modal__header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.reminders-modal__close {
  background: transparent; border: 0; font-size: 16px; cursor: pointer;
  color: var(--text-secondary); padding: 4px;
}
.reminders-modal__close:hover { color: var(--text-primary); }
.reminders-modal__field { display: block; margin: 14px 0; }
.reminders-modal__label {
  display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px;
  color: var(--text-primary);
}
.reminders-modal__field input[type="text"],
.reminders-modal__field textarea,
.reminders-modal__field input[type="date"],
.reminders-modal__field input[type="time"] {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-primary); border-radius: 8px;
  font: inherit; box-sizing: border-box;
  background: var(--bg-input); color: var(--text-primary);
}
.reminders-modal__field input:focus,
.reminders-modal__field textarea:focus,
.reminders-modal__field select:focus {
  outline: none; border-color: var(--border-focus);
}

/* Repeat dropdown — the native <select> ships unstyled, so theme it to match
   the inputs above: same surface, custom chevron, no OS chrome. The chevron
   SVG can't read CSS vars, so it uses a neutral grey that reads on both
   themes. */
.reminders-modal__field select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--border-primary); border-radius: 8px;
  font: inherit; box-sizing: border-box;
  color: var(--text-primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239A9A9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  cursor: pointer;
  transition: border-color 120ms ease;
}
.reminders-modal__field select:hover { border-color: var(--text-tertiary); }
/* Option popup — respected on Chromium/Win; harmless elsewhere. */
.reminders-modal__field select option {
  background: var(--bg-elevated); color: var(--text-primary);
}
.reminders-modal__when {
  border: 0; padding: 0; margin: 14px 0;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.reminders-modal__when input { flex: 0 0 auto; width: auto; }
.reminders-modal__tz { color: var(--text-tertiary); font-size: 13px; }
/* Disabled state inherits the base select theming above — only dim the text. */
.reminders-modal__field--disabled select {
  color: var(--text-disabled); cursor: not-allowed;
}
.reminders-modal__footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; flex-wrap: wrap; gap: 8px;
}
.reminders-modal__left-actions,
.reminders-modal__right-actions { display: flex; gap: 8px; }
.reminders-modal .btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; font: inherit; font-size: 14px;
}
/* Primary — neutral inverted button: bright on dark theme, dark on light. */
.reminders-modal .btn--primary {
  background: var(--text-primary); color: var(--text-inverse); font-weight: 600;
}
.reminders-modal .btn--primary:hover { opacity: 0.88; }
.reminders-modal .btn--ghost {
  background: transparent; color: var(--text-primary);
  border-color: var(--border-primary);
}
.reminders-modal .btn--ghost:hover { background: var(--bg-hover); }
.reminders-modal .btn--danger {
  background: transparent; color: var(--color-error-500, #ef4444);
  border-color: var(--border-primary);
}
.reminders-modal .btn--danger:hover { background: rgba(239, 68, 68, 0.12); }

/* ============================================================
   Schedules tab — sits on the page's theme, not always-dark
   ============================================================ */
.schedules-pane__actions { margin-bottom: 16px; }
.schedules-pane__section-title {
  margin-top: 20px; margin-bottom: 8px;
  font-size: 14px; font-weight: 600;
  color: var(--color-text-muted, #9A9A9A);
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.schedules-pane__toggle {
  margin-left: auto; background: transparent; border: 0;
  color: var(--color-link, #0969da); cursor: pointer; font: inherit;
  font-size: 13px;
}
.schedules-pane__list {
  list-style: none; padding: 0; margin: 0;
}
.schedules-pane__list[hidden] { display: none; }
.schedules-pane__empty {
  padding: 12px 14px; color: var(--color-text-muted, #9A9A9A);
  font-style: italic;
}
.schedules-row {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}
.schedules-row:hover { background: var(--color-card-bg-hover, rgba(255,255,255,0.04)); }
.schedules-row__body { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.schedules-row__name { font-weight: 600; font-size: 14px; }
.schedules-row__when { color: var(--color-text-muted, #9A9A9A); font-size: 13px; }
.schedules-row__icon { flex: 0 0 auto; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: #ECECEC; }
.schedules-row__icon svg { width: 18px; height: 18px; stroke-width: 1.75; flex: 0 0 auto; }
.schedules-row--paused .schedules-row__name,
.schedules-row--paused .schedules-row__when    { opacity: 0.55; }
.schedules-row--delivered .schedules-row__name,
.schedules-row--delivered .schedules-row__when { opacity: 0.6; }
.schedules-row--delivered .schedules-row__icon { color: #10B981; }
.schedules-row--failed .schedules-row__icon    { color: #EF4444; }
.schedules-row--failed .schedules-row__when    { color: #EF4444; }
.schedules-row--cancelled .schedules-row__name { text-decoration: line-through; opacity: 0.5; }
.schedules-row__kebab {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  color: #9A9A9A;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.schedules-row__kebab:hover { background: #2A2A2A; color: #ECECEC; }
.schedules-row__kebab:focus-visible {
  outline: 2px solid rgba(236, 236, 236, 0.7);
  outline-offset: 2px;
  background: #2A2A2A;
  color: #ECECEC;
}
.schedules-row__kebab svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* ============================================================
   Toast fallback
   ============================================================ */
.reminders-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9001;
  padding: 12px 16px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
