/* ═══════════════════════════════════════
   GUARDIFY — Shared Stylesheet
   Dark Safety OS Theme + Premium Animations
═══════════════════════════════════════ */

:root {
  --bg: #080810;
  --surface: #0f0f1a;
  --surface2: #16161f;
  --surface3: #1c1c28;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --red: #e63946;
  --red-dim: rgba(230,57,70,0.15);
  --red-glow: rgba(230,57,70,0.28);
  --text: #f0f0f5;
  --text2: rgba(240,240,245,0.55);
  --text3: rgba(240,240,245,0.28);
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96,165,250,0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251,191,36,0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167,139,250,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  animation: pageEnter 0.4s ease-out;
  position: relative;
}

/* ── PAGE ENTER ANIMATION ── */
@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── BACKGROUND TEXTURE ── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at top right, rgba(139,26,26,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

a { text-decoration: none; color: inherit; }
button { font-family: 'DM Sans', sans-serif; cursor: pointer; }
input, select, textarea { font-family: 'DM Sans', sans-serif; }

/* ── LAYOUT ── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 430px;
  margin: 0 auto;
}

/* ── TOP NAV ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-icon {
  width: 34px;
  height: 34px;
  background: var(--red);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-name {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.nav-name span { color: var(--red); }
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  padding: 6px 0;
}
.nav-back svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.safe-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-dim);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}
.safe-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── PAGE CONTENT ── */
.page {
  flex: 1;
  padding: 16px 16px 100px;
  overflow-y: auto;
}
.page::-webkit-scrollbar { display: none; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 6px 20px;
  gap: 2px;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  z-index: 50;
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}
.bn-item:hover { background: var(--surface2); }
.bn-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--text3);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.3s ease;
}
.bn-item span {
  font-size: 10px;
  color: var(--text3);
  font-weight: 500;
  transition: all 0.3s ease;
}
.bn-item.active svg { 
  stroke: var(--red);
  transform: scale(1.15);
}
.bn-item.active span { color: var(--red); }

/* ── ACTIVE NAV INDICATOR DOT ── */
.bn-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 4px;
  height: 4px;
  background: var(--red);
  border-radius: 50%;
  animation: navDotPop 0.4s ease-out;
}

@keyframes navDotPop {
  0% { 
    transform: scale(0);
    opacity: 0;
  }
  70% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── SECTION HEADING ── */
.section-hd {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 20px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--red);
}
.section-hd:first-child { margin-top: 4px; }

/* ── CARDS — GLASSMORPHISM ── */
.card {
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  animation: cardFadeUp 0.5s ease-out backwards;
}

@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(230,57,70,0.4);
  box-shadow: 0 12px 48px rgba(230,57,70,0.15);
}

.card + .card { margin-top: 8px; }

/* ── FORM ELEMENTS ── */
.inp {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 40px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 100%;
  transition: all 0.3s ease;
}
.inp:focus { 
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.15);
}
.inp::placeholder { color: var(--text3); }
.inp-sel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 40px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.inp-sel option { background: var(--surface2); }

/* ── BUTTONS — WITH MICRO-INTERACTIONS ── */
.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* ── BUTTON SHIMMER SWEEP ── */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.6s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:active { 
  transform: scale(0.97);
}

.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { 
  opacity: 0.88;
  box-shadow: 0 4px 16px rgba(230,57,70,0.3);
}
.btn-green { background: var(--green); color: #052e16; font-family: 'Syne', sans-serif; font-weight: 600; letter-spacing: 0.3px; }
.btn-green:hover { 
  opacity: 0.88;
  box-shadow: 0 4px 16px rgba(74,222,128,0.2);
}
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-outline:hover { background: var(--surface2); }
.btn-full { width: 100%; height: 46px; font-size: 14px; }

/* ── ICON BUTTON ── */
.ic-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}
.ic-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.ic-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}
.ic-btn-green { border-color: rgba(74,222,128,0.25); background: var(--green-dim); }
.ic-btn-green svg { stroke: var(--green); }
.ic-btn-red { border-color: rgba(230,57,70,0.25); background: var(--red-dim); }
.ic-btn-red svg { stroke: #f87171; }

/* ── BADGE ── */
.badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.badge-primary { background: rgba(230,57,70,0.15); color: #f87171; }
.badge-backup { background: var(--blue-dim); color: var(--blue); }
.badge-silent { background: var(--purple-dim); color: var(--purple); }

/* ── INFO BANNER ── */
.info-banner {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  line-height: 1.5;
}
.info-banner svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── EMPTY STATE ── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 13px;
}
.empty svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--text3);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.4;
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* ── UTILITIES ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.w-full { width: 100%; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text2); }
.text-faint { color: var(--text3); }
.font-syne { font-family: 'Syne', sans-serif; }