/* =============================================
   BVetter — notification-settings.css
   Page: Notification preferences — channels table + quiet hours.
   Depends: variables.css (must load first in HTML)

   Path from public/html/[page].html:
     <link rel="stylesheet" href="../css/variables.css"/>
     <link rel="stylesheet" href="../css/notification-settings.css"/>

   All colors use CSS custom properties from variables.css.
   To change a color: edit variables.css only — not this file.
   ============================================= */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg-input);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ── PAGE ──────────────────────────────────── */
.page-body {
  max-width: 1060px;
  margin: 0 auto;
  padding: 36px 40px 60px;
}

.page-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ── COMMUNICATION CHANNELS CARD ───────────── */
.notif-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border-default);
  padding: 28px 28px 8px;
  margin-bottom: 20px;
}

.notif-card-head {
  margin-bottom: 22px;
}

.notif-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.notif-card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Table */
.channels-table {
  width: 100%;
}

.table-head-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0;
}

.th-notif-type {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.th-channel {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-green);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: center;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--bg-input);
}

.table-row:last-child {
  border-bottom: none;
}

.notif-type-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.notif-type-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-type-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.green-icon-bg {
  background: var(--color-green-pale);
}

.blue-icon-bg {
  background: #E8EEF8;
}

.teal-icon-bg {
  background: #E0F4F0;
}

.notif-type-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notif-type-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.check-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Custom checkbox */
.custom-check {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.custom-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-default);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.custom-check input:checked+.checkmark {
  background: var(--color-green);
  border-color: var(--color-green);
}

.custom-check input:checked+.checkmark::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

.custom-check:hover .checkmark {
  border-color: var(--color-green);
}

/* ── BOTTOM ROW ────────────────────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

/* History card */
.history-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border-default);
  padding: 22px 24px;
}

.history-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.history-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-clear-all {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.2s;
}

.btn-clear-all:hover {
  color: var(--color-red);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.history-item:last-child {
  border-bottom: none;
}

.hist-dot-wrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hist-dot-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.green-dot {
  background: var(--color-green-pale);
}

.blue-dot {
  background: #E8EEF8;
}

.red-dot {
  background: var(--color-red-pale);
}

.hist-content {
  flex: 1;
}

.hist-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.hist-warning {
  color: var(--color-red);
}

.hist-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 5px;
}

.hist-time {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}

/* Quiet Hours card */
.quiet-card {
  background: var(--color-navy);
  border-radius: 16px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.quiet-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.quiet-card-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Quiet Hours enable switch */
.quiet-toggle {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.quiet-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.quiet-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  position: relative;
  transition: background 0.15s;
}

.quiet-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.quiet-toggle input:checked + .quiet-toggle-track {
  background: var(--color-green);
}

.quiet-toggle input:checked + .quiet-toggle-track .quiet-toggle-thumb {
  transform: translateX(18px);
}

.quiet-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiet-icon {
  width: 17px;
  height: 17px;
  object-fit: contain;
  opacity: 0.9;
}

.quiet-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.quiet-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.65;
  margin-bottom: 20px;
}

.quiet-schedule-row {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.quiet-schedule-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.quiet-schedule-value {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.quiet-disabled .quiet-schedule-value { color: rgba(255, 255, 255, 0.45); }

.btn-configure {
  width: 100%;
  padding: 13px;
  background: var(--color-green);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  font-family: 'Manrope', sans-serif;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-configure:hover {
  background: var(--color-green);
}

/* =============================================
   QUIET HOURS MODAL
   ============================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  animation: qhModalPop 0.2s ease-out;
}

.qh-modal-box {
  max-width: 480px;
}

@keyframes qhModalPop {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-box-head h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-family: 'Manrope', sans-serif;
  color: #111827;
}

.modal-box-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  transition: background 150ms ease, color 150ms ease;
}

.modal-box-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.modal-box-desc {
  font-size: 13px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ── Quiet-hours night panel ─────────────────── */
.qh-night-card {
  position: relative;
  background: var(--color-navy);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  margin-bottom: 24px;
}

.qh-night-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.qh-night-head-left {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'Manrope', sans-serif;
}

.qh-night-duration {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  font-family: 'Manrope', sans-serif;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* ── Time range row ───────────────────────────── */
.qh-range-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}

.qh-time-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qh-time-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.qh-time-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  transition: border-color 150ms ease, background 150ms ease;
}

.qh-time-inputs:focus-within {
  border-color: var(--color-green);
  background: rgba(255, 255, 255, 0.1);
}

/* Visually hidden but still focusable/readable — the real value
   source of truth; the visible control is the custom dropdown below. */
.visually-hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qh-num-select {
  position: relative;
}

.qh-num-trigger {
  border: none;
  background: transparent;
  font-size: 19px;
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  color: #fff;
  letter-spacing: -0.02em;
  padding: 4px 6px;
  cursor: pointer;
  outline: none;
  text-align: center;
  width: 40px;
  border-radius: 6px;
  transition: background 120ms ease;
}

.qh-num-trigger:hover,
.qh-num-select.open .qh-num-trigger {
  background: rgba(255, 255, 255, 0.1);
}

.qh-num-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 64px;
  max-height: 190px;
  overflow-y: auto;
  background: #001B3D;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  padding: 6px;
  display: none;
  gap: 2px;
}

.qh-num-select.open .qh-num-panel {
  display: grid;
}

.qh-num-option {
  display: block;
  width: 100%;
  text-align: center;
  padding: 8px 6px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 120ms ease;
}

.qh-num-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.qh-num-option.selected {
  background: var(--color-green);
  color: #fff;
  font-weight: 700;
}

.qh-colon {
  font-size: 19px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
}

.qh-ampm-toggle {
  display: flex;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.qh-ampm-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 600;
  font-family: 'Manrope', sans-serif;
  letter-spacing: 0.3px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.qh-ampm-btn.active {
  background: var(--color-green);
  color: #fff;
}

.qh-range-arrow {
  flex-shrink: 0;
  height: 44px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Coverage timeline ────────────────────────── */
.qh-track {
  position: relative;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.qh-track-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--color-green);
  border-radius: inherit;
}

.qh-track-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Manrope', sans-serif;
  color: rgba(255, 255, 255, 0.35);
}

.btn-save,
.qh-save-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  background: var(--color-green);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Manrope', sans-serif;
  color: #fff;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.btn-save:hover,
.qh-save-btn:hover {
  background: var(--color-green-dark);
}

.btn-save:active,
.qh-save-btn:active {
  transform: scale(0.98);
}

/* ── Toast ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--color-green-dark);
}

.toast.error {
  background: var(--color-red);
}

/* =============================================
   RESPONSIVE — see public/css/variables.css for
   the shared breakpoint scale used across all pages.
   ============================================= */

/* ── Tablet: 481px – 1024px ─────────────────── */
@media (max-width: 1024px) {
  .page-body { padding: 28px 20px 48px; }

  .notif-card { padding: 22px 20px 8px; }

  /* Channel columns only hold a 22px checkbox — shrinking them
     from 90px to 64px gives the notification type column enough
     room to keep breathing instead of forcing the fixed 380px
     Quiet Hours column into a squeeze first. */
  .table-head-row,
  .table-row { grid-template-columns: 1fr 64px 64px; }

  .bottom-row { grid-template-columns: 1fr; }
}

/* ── Mobile: up to 480px ─────────────────────── */
@media (max-width: 480px) {
  .toast { left: 16px; right: 16px; bottom: 16px; }

  .page-body { padding: 20px 16px 40px; }

  .page-title { font-size: 22px; }

  .notif-card { padding: 18px 16px 6px; }

  .table-head-row,
  .table-row { grid-template-columns: 1fr 42px 42px; }

  .th-channel { font-size: 8px; }

  .notif-type-cell { gap: 10px; }

  .notif-type-icon { width: 30px; height: 30px; }

  .checkmark { width: 20px; height: 20px; }

  .history-card,
  .quiet-card { padding: 18px 16px; }
}