/* EVBro — Notification centre and native controls.
   Standalone sheet: the load ORDER (templates/index.html) follows the original cascade; do not change it. */

/* ==========================================================
   NOTIFICATION CENTRE AND NATIVE CONTROLS
   ========================================================== */
.notif-badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red, #ff3d00);
  box-shadow: 0 0 8px rgba(255, 61, 0, 0.8);
  display: none;
}
.notif-badge-dot.is-on { display: block; }        /* notices the account has not seen (features/notifications.js) */

/* Notice centre (the bell): the dialog of the rest of the app and the rows of the timeline, one per notice, grouped by day */
.notice-card { max-width: 560px; overflow: hidden; }
.notice-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-shrink: 0; }
.notice-head h3 { margin: 0; }
.notice-head p { margin: 2px 0 0; font-size: 0.85rem; color: var(--text-secondary); }
.notice-head-ico {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.14); color: var(--accent);
}
.notice-push {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0;
  margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--accent-rgb), 0.35); background: rgba(var(--accent-rgb), 0.08);
}
.notice-push[hidden] { display: none; }
.notice-push p { margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.notice-push .btn-sm { flex: none; }
.notice-list { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.notice-list .hist-month { margin-top: 10px; }
.notice-list .hist-month:first-child { margin-top: 0; }
.notice-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; column-gap: 10px;
  padding: 10px; background: var(--surface-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm);
}
.notice-row.is-unread { border-color: rgba(var(--accent-rgb), 0.5); }
/* Swiped sideways to dismiss it (the vertical scroll of the list stays with the browser) */
.notice-row { touch-action: pan-y; user-select: none; transition: transform 0.2s ease, opacity 0.2s ease; }
.notice-row.is-dragging { transition: none; }
.notice-row.is-gone {
  height: 0 !important; min-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -6px; border-width: 0; overflow: hidden;
  transition: height 0.2s ease, padding 0.2s ease, margin 0.2s ease;
}
.notice-dismiss {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; margin-right: -4px;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer;
}
.notice-dismiss:hover, .notice-dismiss:focus-visible { color: var(--text-primary); background: var(--surface-tertiary, rgba(127, 127, 127, 0.15)); }
/* On a touch screen the gesture does it: no cross */
@media (hover: none) { .notice-dismiss { display: none; } }
.notice-ico {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.12); color: var(--accent);
}
.notice-charge .notice-ico { color: var(--accent-green); background: rgba(48, 209, 88, 0.14); }
.notice-warn .notice-ico { color: var(--accent-amber); background: rgba(255, 159, 10, 0.14); }
.notice-alarm .notice-ico { color: var(--accent-red); background: rgba(255, 69, 58, 0.12); }
.notice-maint .notice-ico { color: var(--accent-purple); background: rgba(139, 92, 246, 0.14); }
.notice-admin .notice-ico { color: #64d2ff; background: rgba(100, 210, 255, 0.14); }
[data-theme="light"] .notice-admin .notice-ico { color: #0a7ea4; background: rgba(10, 126, 164, 0.12); }
.notice-from { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.notice-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notice-main strong { font-size: 0.92rem; font-weight: 650; letter-spacing: -0.01em; color: var(--text-primary); }
.notice-row.is-unread .notice-main strong { font-weight: 750; }
.notice-text { font-size: 0.82rem; line-height: 1.4; color: var(--text-secondary); white-space: pre-line; overflow-wrap: anywhere; }
.notice-fail { font-size: 0.75rem; color: var(--accent-red); overflow-wrap: anywhere; }
.notice-time {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 2px;
  font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.notice-new {
  padding: 1px 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent); background: rgba(var(--accent-rgb), 0.14);
}
/* Three short buttons side by side, also on the phone (the general rule stacks dialog buttons there) */
.modal-actions.notice-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.modal-actions.notice-actions button { width: 100%; min-width: 0; padding-left: 8px; padding-right: 8px; justify-content: center; }

.native-section-header {
  margin-bottom: 1.25rem;
}

.native-section-header .section-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 3px;
}

.native-section-header .section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.notif-triggers-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notif-trigger-card {
  background: var(--surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: background 0.2s, border-color 0.2s;
}

.notif-trigger-card:hover {
  background: var(--surface-card-hover);
}

.notif-trigger-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.notif-trigger-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-glass-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notif-trigger-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notif-trigger-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* iOS Toggle Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.18);
  transition: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 34px;
}

.ios-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.ios-switch input:checked + .ios-slider {
  background-color: #30d158;
}

.ios-switch input:checked + .ios-slider:before {
  transform: translateX(20px);
}

/* Unified Native Dark Tables & Cards */
.native-table-container {
  background: #151518;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  margin-top: 1rem;
}

.native-table-container .data-table {
  width: 100%;
  margin: 0;
  border: none;
}

.native-table-container .data-table th {
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.native-table-container .data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.native-card-wrapper {
  background: #151518;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  margin-bottom: 14px;
}

/* An alert's own setting (e.g. tyre pressure margin) */
.notif-trigger-extra { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.notif-trigger-extra label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.notif-trigger-extra .form-control { min-height: 40px; }

/* Alert history: status of each delivery */
.notif-log-ok { color: var(--accent-green); }
.notif-log-fail { color: var(--accent-red); }
