/* ============================================
   ALERTS LIST + ALERT DETAIL SCREENS
   Frosted glass overlays matching devices/conversations.
   ============================================ */

/* ---- Alerts list overlay ---- */

.alerts-screen {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: rgba(247, 247, 245, 0.88);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-radius: var(--frame-radius);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow: hidden;
}

.alerts-screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Header ---- */

.alerts-header {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  margin-top: max(30px, env(safe-area-inset-top, 0px));
  padding: 0 var(--side-padding);
}

.alerts-back {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.alerts-back:hover {
  background: rgba(0, 0, 0, 0.05);
}

.alerts-header-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  color: #1A1A1A;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}

/* ---- Filter bar ---- */

.alerts-filter-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px var(--side-padding) 4px;
}

.alerts-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 100px;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s ease;
}

.alerts-filter-btn:hover {
  background: rgba(0, 0, 0, 0.07);
}

.alerts-filter-btn svg {
  width: 18px;
  height: 18px;
  color: #1A1A1A;
  stroke-width: 2;
}

.alerts-filter-label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 13px;
  color: #1A1A1A;
  line-height: 20px;
  letter-spacing: 0.1px;
}

.alerts-results-count {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  color: rgba(26, 26, 26, 0.5);
  line-height: 20px;
}

/* ---- Scrollable content ---- */

.alerts-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px var(--side-padding) 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

.alerts-content::-webkit-scrollbar {
  display: none;
}

/* ---- Group (Today, This week…) ---- */

.alerts-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alerts-group-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  color: rgba(26, 26, 26, 0.5);
  line-height: normal;
  letter-spacing: -0.1px;
}

/* ---- Alert card ---- */

.alert-card {
  position: relative;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-left-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  padding: 14px 16px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.alert-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 60%);
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.alert-card:hover {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alert-card:hover::before {
  opacity: 0.7;
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .alert-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }
}

.alert-card-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.alert-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-card-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: #1A1A1A;
  line-height: 22px;
}

/* Color-coded status dots */
.alert-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-card-dot--green {
  background: var(--green-accent);
}

.alert-card-dot--orange {
  background: var(--yellow-accent);
}

.alert-card-dot--red {
  background: var(--red-accent);
  box-shadow: 0 0 6px rgba(245, 10, 10, 0.4);
}

/* State-driven group visibility:
   - green state  → only auto-handled (no red/yellow groups)
   - yellow state → show orange group + auto-handled
   - red state    → show red + orange + auto-handled
*/
.alerts-group[data-alert-state="red"],
.alerts-group[data-alert-state="yellow"] {
  display: none;
}

.phone-frame[data-state="yellow"] .alerts-group[data-alert-state="yellow"],
.phone-frame[data-state="red"] .alerts-group[data-alert-state="yellow"],
.phone-frame[data-state="red"] .alerts-group[data-alert-state="red"] {
  display: flex;
}


.alert-card-type {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  color: #1A1A1A;
  line-height: 22px;
  letter-spacing: -0.02em;
}

.alert-card-desc {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  color: rgba(26, 26, 26, 0.55);
  line-height: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alert-card-time {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 12px;
  color: rgba(26, 26, 26, 0.5);
  line-height: 18px;
  margin-top: 2px;
}

.alert-card-chevron {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.35;
}


/* ============================================
   ALERT DETAIL OVERLAY
   ============================================ */

.alert-detail-screen {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(247, 247, 245, 0.88);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-radius: var(--frame-radius);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  overflow: hidden;
}

.alert-detail-screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Header ---- */

.alert-detail-header {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  margin-top: max(30px, env(safe-area-inset-top, 0px));
  padding: 0 var(--side-padding);
}

.alert-detail-back {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.alert-detail-back:hover {
  background: rgba(0, 0, 0, 0.05);
}

.alert-detail-header-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  color: #1A1A1A;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
  white-space: nowrap;
}

/* Invisible spacer to balance the header */
.alert-detail-header-spacer {
  width: 24px;
  flex-shrink: 0;
}

/* ---- Scrollable body ---- */

.alert-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px var(--side-padding) 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  -webkit-overflow-scrolling: touch;
}

.alert-detail-content::-webkit-scrollbar {
  display: none;
}

/* ---- Device info card ---- */

.alert-detail-device {
  position: relative;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-left-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-detail-device::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 60%);
  opacity: 0.3;
  pointer-events: none;
}

.alert-detail-device-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.alert-detail-device-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #E8F0FE;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #1A73E8;
}

.alert-detail-device-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.alert-detail-device-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.alert-detail-device-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-detail-device-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: #1A1A1A;
  line-height: 22px;
}

.alert-detail-device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow-accent);
  flex-shrink: 0;
}

.alert-detail-device-status {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  color: rgba(26, 26, 26, 0.5);
  line-height: normal;
}

.alert-detail-device-signal {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  flex-shrink: 0;
}

.alert-detail-device-signal .device-signal-bar {
  background: rgba(0, 0, 0, 0.1);
}

/* ---- Date line ---- */

.alert-detail-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  color: rgba(26, 26, 26, 0.5);
  line-height: 20px;
}

.alert-detail-date svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
  flex-shrink: 0;
  color: rgba(26, 26, 26, 0.4);
}

/* ---- Section (Issue detected / What to do) ---- */

.alert-detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-detail-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-detail-section-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-detail-section-icon--warning {
  /* Peach badge + orange “attention” mark (Issue detected) */
  width: 28px;
  height: 28px;
  background: rgba(255, 151, 32, 0.16);
  color: var(--yellow-accent);
}

.alert-detail-section-icon--warning .alert-detail-attention-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.alert-detail-section-icon--success {
  background: rgba(0, 195, 127, 0.12);
  color: var(--green-accent);
}

.alert-detail-section-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

.alert-detail-section-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: #1A1A1A;
  line-height: 22px;
}

.alert-detail-section-body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 14px;
  color: #1A1A1A;
  line-height: 1.55;
}

.alert-detail-section-body strong {
  font-weight: 600;
}
