/* web-v2/css/components/alert-card.css */

.alert-card {
  position: relative;
  padding: .45rem .55rem .45rem .7rem;
  border-radius: 0 4px 4px 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  transition: opacity .3s, border-color .2s;
  overflow: hidden;
}

/* Left-border severity strip */
.alert-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

/* Phase-based severity coloring */
.alert-card[data-cat="1"]::before,
.alert-card[data-cat="7"]::before {
  background: var(--threat-rockets);
}
.alert-card[data-cat="1"],
.alert-card[data-cat="7"] {
  background: var(--threat-rockets-bg);
  border-color: rgba(255, 45, 45, .2);
  box-shadow: var(--threat-rockets-glow);
}

.alert-card[data-cat="2"]::before,
.alert-card[data-cat="6"]::before {
  background: var(--threat-uav);
}
.alert-card[data-cat="2"],
.alert-card[data-cat="6"] {
  background: var(--threat-uav-bg);
  border-color: rgba(179, 77, 255, .2);
  box-shadow: var(--threat-uav-glow);
}

.alert-card[data-cat="5"]::before,
.alert-card[data-cat="10"]::before,
.alert-card[data-cat="14"]::before {
  background: var(--threat-prealert);
}
.alert-card[data-cat="5"],
.alert-card[data-cat="10"],
.alert-card[data-cat="14"] {
  background: var(--threat-prealert-bg);
  border-color: rgba(251, 191, 36, .25);
}

.alert-card[data-cat="13"]::before {
  background: var(--threat-clearing);
}
.alert-card[data-cat="13"] {
  background: var(--threat-clearing-bg);
  border-color: rgba(59, 130, 246, .2);
}

/* Phase opacity */
.alert-card[data-phase="live"]     { opacity: 1; }
.alert-card[data-phase="context"]  { opacity: .7; }

/* Clearing: override all cat-based colors to blue, animate opacity out */
.alert-card[data-phase="clearing"] {
  background:   var(--threat-clearing-bg) !important;
  border-color: rgba(59, 130, 246, .3)   !important;
  box-shadow:   none                      !important;
  animation: card-fade-out 45s ease-out forwards;
}
.alert-card[data-phase="clearing"]::before {
  background: var(--threat-clearing) !important;
}
.alert-card[data-phase="clearing"] .alert-card__category {
  color: var(--threat-clearing) !important;
}
@keyframes card-fade-out {
  0%   { opacity: 1; }
  40%  { opacity: .7; }
  100% { opacity: 0; }
}

/* Card content */
.alert-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .15rem;
}
.alert-card__category {
  font-size: .55rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.alert-card[data-cat="1"] .alert-card__category { color: var(--threat-rockets); }
.alert-card[data-cat="2"] .alert-card__category,
.alert-card[data-cat="6"] .alert-card__category { color: var(--threat-uav); }
.alert-card[data-cat="5"] .alert-card__category,
.alert-card[data-cat="10"] .alert-card__category,
.alert-card[data-cat="14"] .alert-card__category { color: var(--threat-prealert); }
.alert-card[data-cat="13"] .alert-card__category { color: var(--threat-clearing); }

.alert-card__time {
  font-size: .5rem;
  color: var(--text-muted);
}
.alert-card__areas {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-card__meta {
  font-size: .55rem;
  color: var(--accent-dim);
}

/* RTL: flip color strip and card padding */
[dir="rtl"] .alert-card {
  padding: .45rem .7rem .45rem .55rem;
  border-radius: 4px 0 0 4px;
}
[dir="rtl"] .alert-card::before {
  left: auto;
  right: 0;
  border-radius: 0 3px 3px 0;
}
[dir="rtl"] .hist-incident__head {
  padding: .45rem .7rem .45rem .55rem;
}
[dir="rtl"] .hist-incident__waves {
  padding: .3rem .7rem .4rem .55rem;
}

/* Shelter/safe countdown timer */
.ec-timer {
  display: inline-block;
  font-size: .6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: .08em;
  padding: .1rem .3rem;
  border-radius: 2px;
  margin-top: .2rem;
}
.ec-timer.danger {
  color: var(--threat-rockets);
  background: rgba(255, 45, 45, .12);
}
.ec-timer.ok {
  color: #22c55e;
  background: rgba(34, 197, 94, .1);
}

/* Live feed: wave sections inside incident card */
.alert-card__waves {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-top: .3rem;
  padding-top: .3rem;
  border-top: 1px solid var(--border-subtle);
}
.alert-card__wave {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .5rem;
  color: var(--text-muted);
}
.alert-card__wave-num {
  color: var(--accent);
  font-weight: 700;
  font-size: .45rem;
  min-width: 16px;
  flex-shrink: 0;
}
.alert-card__wave-areas {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}
.alert-card__wave-time {
  color: var(--accent-dim);
  flex-shrink: 0;
}

/* Mobile: tap-for-map hint */
.alert-card__map-hint {
  display: none;
  font-size: .45rem;
  color: var(--accent-dim);
  margin-top: .2rem;
}
@media (max-width: 768px) {
  .alert-card__map-hint { display: block; }
}

/* History incident card (multi-wave) */
.hist-incident {
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--bg-card);
  overflow: hidden;
  cursor: pointer;
}
.hist-incident[data-cat="1"] {
  border-color: rgba(255,45,45,.2);
  background: var(--threat-rockets-bg);
}
.hist-incident[data-cat="2"],
.hist-incident[data-cat="6"] {
  border-color: rgba(179,77,255,.2);
  background: var(--threat-uav-bg);
}
.hist-incident[data-cat="5"],
.hist-incident[data-cat="10"],
.hist-incident[data-cat="14"] {
  border-color: rgba(251,191,36,.25);
  background: var(--threat-prealert-bg);
}
.hist-incident[data-cat="13"] {
  border-color: rgba(59,130,246,.2);
  background: var(--threat-clearing-bg);
}
.hist-incident__head {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .55rem .45rem .7rem;
  flex-wrap: wrap;
}
.hist-incident__meta {
  font-size: .5rem;
  color: var(--accent-dim);
}
.hist-incident__waves {
  display: flex;
  flex-direction: column;
  padding: .3rem .55rem .4rem .7rem;
  gap: .2rem;
  border-top: 1px solid var(--border-subtle);
}
.hist-wave {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .5rem;
  color: var(--text-muted);
}
.hist-wave__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  color: var(--accent);
  font-size: .45rem;
  font-weight: 700;
  flex-shrink: 0;
}
.hist-wave__time { color: var(--accent-dim); flex-shrink: 0; }
.hist-wave__areas { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }

/* Infinite scroll sentinel */
.hist-sentinel {
  display: flex;
  justify-content: center;
  padding: .75rem;
}
.hist-sentinel__label {
  font-size: .5rem;
  font-family: var(--font-mono);
  letter-spacing: .1em;
  color: var(--text-muted);
}
