/* ============================================================
   Reminders module
   ============================================================ */

/* --- Shared layout --- */
#reminders-view,
#reminder-form-view {
  overflow-y: auto;
  flex-direction: column;
}

.rem-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 12px;
  flex-shrink: 0;
}

.rem-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-color);
  padding: 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.rem-back-btn:hover { background-color: var(--accent-soft-color); }

.rem-header-title {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

.rem-new-fab {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.rem-new-fab:hover { opacity: 0.85; }

/* --- Screen body --- */
.rem-screen-body {
  flex: 1;
  padding: 0 16px 24px;
  overflow-y: auto;
}

/* --- Empty state --- */
.rem-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--secondary-color);
  text-align: center;
}
.rem-empty-text {
  font-size: 0.95rem;
  margin: 0;
}

/* --- Group --- */
.rem-group {
  margin-bottom: 20px;
}
.rem-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary-color);
  margin: 0 0 8px 4px;
}

/* --- Reminder item --- */
.rem-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: 16px;
  background-color: var(--surface-color);
  border: 1px solid var(--soft-border-color);
  margin-bottom: 8px;
  transition: opacity 0.2s;
}
.rem-item--disabled { opacity: 0.5; }
.rem-item--done     { opacity: 0.45; }

.rem-item-icon {
  flex-shrink: 0;
  color: var(--primary-color);
  display: flex;
}
.rem-item--done .rem-item-icon { color: var(--secondary-color); }

.rem-item-body {
  flex: 1;
  min-width: 0;
}
.rem-item-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rem-item-meta {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--secondary-color);
}

.rem-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.rem-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--secondary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.rem-icon-btn:hover { background-color: var(--accent-soft-color); color: var(--primary-color); }
.rem-icon-btn--danger:hover { background-color: rgba(239,68,68,0.1); color: #ef4444; }

/* --- Form body --- */
.rem-form-body {
  padding: 8px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rem-field-group {
  margin-bottom: 20px;
}
.rem-field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary-color);
  margin: 0 0 8px;
}

.rem-reliability-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--secondary-color);
  background-color: var(--input-bg-color);
  border: 1px solid var(--soft-border-color);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 20px;
}
.rem-reliability-notice i {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.7;
}

/* --- Pill toggle group --- */
.rem-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rem-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--soft-border-color);
  background: var(--surface-color);
  color: var(--text-color);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.rem-pill.active {
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  border-color: var(--primary-color);
}
.rem-pill:not(.active):hover { background-color: var(--accent-soft-color); }

/* --- Task dropdown (independent implementation, same visual style as manual task block) --- */
.rem-task-dd-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.875rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  background-color: var(--input-bg-color);
  color: var(--secondary-color);
  border: 1px solid var(--soft-border-color);
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.rem-task-dd-btn:focus-visible {
  border-color: var(--primary-color);
  background-color: var(--focus-bg-color);
}
.rem-task-dd-btn.has-value { color: var(--text-color); }
.rem-dd-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--secondary-color);
}
.rem-task-dd-btn.is-open .rem-dd-chevron { transform: rotate(180deg); }

.rem-task-dd-list {
  background-color: var(--surface-color);
  border: 1px solid var(--soft-border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px var(--shadow-color);
}
.rem-task-dd-opt {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  color: var(--text-color);
  background-color: var(--surface-color);
  border: none;
  outline: none;
  transition: background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.rem-task-dd-opt:hover,
.rem-task-dd-opt:focus-visible { background-color: var(--accent-soft-color); }
.rem-task-dd-opt.is-selected {
  color: var(--primary-color);
  font-weight: 600;
  background-color: var(--accent-soft-color);
}
.rem-task-dd-empty {
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--secondary-color);
}
.rem-task-dd-group {
  padding: 8px 16px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary-color);
  pointer-events: none;
  user-select: none;
}
.rem-task-dd-sep {
  height: 1px;
  background: var(--soft-border-color);
  margin: 4px 12px;
}

/* --- Input --- */
.rem-input {
  width: 100%;
  background: var(--surface-color);
  border: 1.5px solid var(--soft-border-color);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-color);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.rem-input:focus { border-color: var(--primary-color); }
input[type="date"].rem-input,
input[type="time"].rem-input {
  appearance: none;
  -webkit-appearance: none;
  accent-color: var(--primary-color);
}

/* --- Row layout (date + time) --- */
.rem-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.rem-half {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

/* --- Form actions --- */
.rem-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.rem-btn-primary {
  flex: 1;
  padding: 14px;
  border-radius: 16px;
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  border: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s;
}
.rem-btn-primary:hover { opacity: 0.88; }
.rem-btn-ghost {
  flex: 0 0 auto;
  padding: 14px 20px;
  border-radius: 16px;
  background: transparent;
  color: var(--secondary-color);
  border: 1.5px solid var(--soft-border-color);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.rem-btn-ghost:hover { background-color: var(--accent-soft-color); }

/* --- Utility --- */
.rem-hidden { display: none !important; }
.rem-muted  { color: var(--secondary-color); font-size: 0.85rem; margin: 0; }

/* ============================================================
   Home widget
   ============================================================ */

.rem-w-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.rem-w-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background-color: var(--bg-color);
  border: 1px solid var(--soft-border-color);
}

.rem-w-item--nav {
  cursor: pointer;
  transition: background-color 0.15s;
}
.rem-w-item--nav:hover { background-color: var(--accent-soft-color); }

.rem-w-item--past {
  opacity: 0.55;
}

.rem-w-item-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rem-w-item-meta {
  font-size: 0.72rem;
  color: var(--secondary-color);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   Reminder alert overlay (in-app modal, non-dismissable)
   ============================================================ */

.rem-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background 0.2s;
  pointer-events: none;
}
.rem-alert-overlay.rem-alert-visible {
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.rem-alert-card {
  background: var(--surface-color);
  border-radius: 24px;
  padding: 28px 24px 20px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  transform: scale(0.88);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}
.rem-alert-overlay.rem-alert-visible .rem-alert-card {
  transform: scale(1);
  opacity: 1;
}
.rem-alert-icon {
  color: var(--primary-color);
  margin-bottom: 4px;
}
.rem-alert-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  text-align: center;
}
.rem-alert-body {
  margin: 4px 0 12px;
  font-size: 0.95rem;
  color: var(--secondary-color);
  text-align: center;
  word-break: break-word;
}
.rem-alert-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.rem-alert-actions .rem-btn-ghost,
.rem-alert-actions .rem-btn-primary {
  flex: 1;
  padding: 12px;
}

@keyframes rem-shake {
  0%,  100% { transform: scale(1) translateX(0);  }
  20%        { transform: scale(1) translateX(-7px); }
  40%        { transform: scale(1) translateX(7px);  }
  60%        { transform: scale(1) translateX(-4px); }
  80%        { transform: scale(1) translateX(4px);  }
}
.rem-alert-shake {
  animation: rem-shake 0.35s ease;
}

/* ============================================================
   Notification settings in form
   ============================================================ */

.rem-notif-section {
  border-top: 1px solid var(--soft-border-color);
  padding-top: 20px;
  margin-top: 4px;
}
.rem-notif-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--secondary-color);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 0 12px;
  width: 100%;
  text-align: left;
  transition: color 0.15s;
}
.rem-notif-toggle:hover { color: var(--primary-color); }
.rem-notif-toggle-icon {
  transition: transform 0.2s;
}
.rem-notif-toggle.open .rem-notif-toggle-icon {
  transform: rotate(180deg);
}
.rem-notif-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.rem-sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rem-sound-row .rem-pills {
  flex: 1;
}
.rem-test-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid var(--soft-border-color);
  background: var(--surface-color);
  color: var(--text-color);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
  white-space: nowrap;
}
.rem-test-btn:hover { background-color: var(--accent-soft-color); }
.rem-test-btn.playing { color: var(--primary-color); border-color: var(--primary-color); }

/* ============================================================
   Custom date calendar
   ============================================================ */

.cal-wrap {
  padding: 16px 12px 12px;
  background: var(--surface-color);
  border: 1px solid var(--soft-border-color);
  border-radius: 20px;
}

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

.cal-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-color);
  text-transform: capitalize;
}

.cal-nav {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--soft-border-color);
  background: var(--bg-color);
  color: var(--secondary-color);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.cal-nav:hover { background: var(--accent-soft-color); color: var(--primary-color); }

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

.cal-h {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary-color);
  padding: 4px 0 8px;
}

.cal-d {
  aspect-ratio: 1;
  min-height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s;
  padding: 0;
  width: 100%;
}
.cal-d:not(.cal-d--past):not(.cal-d--sel):hover {
  background-color: var(--accent-soft-color);
}
.cal-d--today {
  color: var(--primary-color);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--primary-color);
}
.cal-d--sel {
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  font-weight: 700;
}
.cal-d--sel:hover { opacity: 0.88; }
.cal-d--past {
  color: var(--secondary-color);
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}
