/* =============================================
   RapidResQ – Design System
   Theme: Modern Purple/White + Red SOS
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0');

:root {
  --primary: #0A192F;
  --primary-dark: #071224;
  --primary-light: #112B4F;
  --primary-lighter: #1B4075;
  --primary-subtle: #E6EBF5;
  --primary-ghost: #F2F5FA;
  --sos-red: #E53935;
  --sos-red-dark: #C62828;
  --sos-glow: rgba(229, 57, 53, 0.35);
  --bg: #F9FAFB;
  --bg-alt: #F3F4F6;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-sec: #4B5563;
  --text-ter: #9CA3AF;
  --text-on-primary: #FFF;
  --success: #10B981;
  --warning: #F59E0B;
  --shadow-sm: 0 1px 3px rgba(10,25,47,.06);
  --shadow-md: 0 4px 14px rgba(10,25,47,.09);
  --shadow-lg: 0 8px 28px rgba(10,25,47,.13);
  --sidebar-w: 280px;
  --header-h: 64px;
  --bnav-h: 62px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font: 'Inter', system-ui, sans-serif;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); outline: none; }
img { max-width: 100%; display: block; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; }

/* ---- Splash Screen ---- */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity .6s ease, visibility .6s ease; visibility: visible;
}
.splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-content { text-align: center; }
.splash-logo-img {
  width: 100px; height: 100px; margin: 0 auto 20px;
  display: block; object-fit: contain;
  animation: splashLogoPulse 1.5s ease-in-out infinite alternate;
  box-shadow: 0 8px 32px rgba(229,57,53,0.3);
}
@keyframes splashLogoPulse {
  0% { transform: scale(1); box-shadow: 0 8px 32px rgba(229,57,53,0.3); }
  100% { transform: scale(1.06); box-shadow: 0 12px 40px rgba(229,57,53,0.5); }
}
.splash-title {
  font-size: 3rem; font-weight: 900; letter-spacing: 6px;
  color: #fff; margin-bottom: 8px;
}
.splash-subtitle { font-size: .85rem; letter-spacing: 4px; color: rgba(255,255,255,0.7); font-weight: 500; margin-bottom: 40px; }
.splash-loader { width: 220px; height: 3px; background: var(--border); border-radius: 4px; margin: 0 auto 14px; overflow: hidden; }
.splash-loader-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--primary), var(--sos-red)); border-radius: 4px; animation: splashLoad 2s ease forwards; }
.splash-status { font-size: .7rem; letter-spacing: 3px; color: var(--text-ter); font-weight: 500; }
@keyframes splashLoad { to { width: 100%; } }

/* ---- App Layout ---- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 28px 16px 20px; z-index: 100;
  transition: transform .3s ease;
}
.sidebar-logo { font-size: 1.15rem; font-weight: 800; color: var(--text); letter-spacing: 2px; padding: 0 12px; margin-bottom: 36px; }
.sidebar-logo-img { width: 32px; height: 32px; object-fit: contain; }
.sidebar-logo span { color: var(--sos-red); }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; overflow-x: hidden;}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 10px; color: var(--text-sec); font-size: .88rem; font-weight: 600;
  transition: all .2s ease; cursor: pointer; text-decoration: none;
}
.nav-item:hover { color: var(--primary); background: var(--bg-alt); text-decoration: none; }
.nav-item.active { color: var(--primary); background: var(--primary-subtle); }
.nav-item .material-symbols-outlined { font-size: 22px; color: inherit;}
.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 16px; }
.nav-item.signout { color: var(--text-ter); }
.nav-item.signout:hover { color: var(--sos-red); background: rgba(229,57,53,.08); }

.main-content {
  flex: 1; margin-left: var(--sidebar-w); padding: 32px 36px;
  min-height: 100vh; max-width: 100%;
}

/* ---- Top Bar (mobile) ---- */
.top-bar {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 20px; align-items: center; justify-content: space-between; z-index: 90;
}
.top-bar-logo { font-weight: 800; font-size: 1rem; letter-spacing: 1.5px; color: var(--text); }
.topbar-logo-img { width: 28px; height: 28px; object-fit: contain; }
.top-bar-logo span { color: var(--sos-red); }
.top-bar-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-subtle);
  display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; font-size: .8rem;
}

/* ---- Bottom Nav (mobile) ---- */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; height: var(--bnav-h);
  background: var(--surface); border-top: 1px solid var(--border);
  justify-content: space-around; align-items: center; z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-ter); font-size: .65rem; font-weight: 600; cursor: pointer;
  transition: color .2s ease; padding: 6px 12px; text-decoration: none;
}
.bnav-item:hover { text-decoration: none; }
.bnav-item .material-symbols-outlined { font-size: 24px; }
.bnav-item.active { color: var(--primary); }

/* ---- Page Header ---- */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.65rem; font-weight: 700; color: var(--text); }
.page-header p { color: var(--text-sec); font-size: .9rem; margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-ter); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-sec); }
.breadcrumb .sep { font-size: .7rem; }

/* ---- SOS Button ---- */
.sos-section { display: flex; flex-direction: column; align-items: center; padding: 36px 0 44px; }
.sos-wrapper { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.sos-btn {
  width: 180px; height: 180px; border-radius: 50%;
  background: linear-gradient(145deg, var(--sos-red) 0%, var(--sos-red-dark) 100%);
  border: none; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; position: relative; z-index: 2;
  box-shadow: 0 8px 32px var(--sos-glow); transition: transform .15s ease, box-shadow .15s ease;
}
.sos-btn:hover { transform: scale(1.05); box-shadow: 0 12px 48px var(--sos-glow); }
.sos-btn:active { transform: scale(0.96); }
.sos-btn .sos-icon { font-size: 36px; color: #fff; }
.sos-btn .sos-text { font-size: 2rem; font-weight: 900; color: #fff; letter-spacing: 4px; }
.sos-btn .sos-sub { font-size: .7rem; color: rgba(255,255,255,.75); font-weight: 500; letter-spacing: 1px; }
.sos-ring {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 180px; height: 180px; border-radius: 50%;
  border: 2px solid rgba(229,57,53,.3); animation: sosPulse 2.5s ease-out infinite;
}
.sos-ring:nth-child(2) { animation-delay: .8s; }
.sos-ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes sosPulse {
  0% { width: 180px; height: 180px; opacity: .6; }
  100% { width: 300px; height: 300px; opacity: 0; }
}

/* ---- Section Headers ---- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-header h2 { font-size: 1.15rem; font-weight: 700; }
.section-header a { font-size: .82rem; color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 4px; }

/* ---- Service Grid (Dashboard) ---- */
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 36px; }
.service-card {
  background: var(--surface); border-radius: var(--radius); padding: 22px 18px;
  border: 1px solid var(--border); cursor: pointer;
  transition: all .25s ease; position: relative; overflow: hidden;
}
.service-card:hover { border-color: var(--primary-lighter); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.service-card-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; margin-bottom: 14px; font-size: 24px; color: #fff;
}
.service-card-icon.hospital { background: linear-gradient(135deg, #E53935, #EF5350); }
.service-card-icon.police { background: linear-gradient(135deg, #1E88E5, #42A5F5); }
.service-card-icon.fire { background: linear-gradient(135deg, #FF8F00, #FFB300); }
.service-card-icon.towing { background: linear-gradient(135deg, #43A047, #66BB6A); }
.service-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.service-card p { font-size: .78rem; color: var(--text-sec); line-height: 1.4; }

/* ---- Recent Alerts Table ---- */
.alerts-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.alerts-table { width: 100%; border-collapse: collapse; }
.alerts-table th {
  text-align: left; padding: 14px 18px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-ter);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.alerts-table td { padding: 14px 18px; font-size: .85rem; border-bottom: 1px solid var(--border); }
.alerts-table tr:last-child td { border-bottom: none; }
.alerts-table tr:hover td { background: var(--primary-ghost); }
.status-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.status-badge.dispatched { background: rgba(229,57,53,.1); color: var(--sos-red); }
.status-badge.completed { background: rgba(16,185,129,.1); color: var(--success); }
.status-badge.pending { background: rgba(245,158,11,.1); color: var(--warning); }
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-sec); }
.empty-state .material-symbols-outlined { font-size: 48px; color: var(--text-ter); margin-bottom: 12px; display: block; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: .85rem; }

/* ---- Nearby Services Page ---- */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-tab {
  padding: 8px 18px; border-radius: 20px; font-size: .82rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-sec);
  cursor: pointer; transition: all .2s ease;
}
.filter-tab:hover { border-color: var(--primary-lighter); color: var(--primary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.service-list { display: flex; flex-direction: column; gap: 12px; }
.service-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; transition: all .25s ease;
}
.service-item:hover { border-color: var(--primary-lighter); box-shadow: var(--shadow-sm); }
.service-item-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-subtle); color: var(--primary); flex-shrink: 0;
}
.service-item-info { flex: 1; min-width: 0; }
.service-item-info h3 { font-size: .92rem; font-weight: 700; margin-bottom: 3px; }
.service-item-info p { font-size: .78rem; color: var(--text-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-item-meta { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: .75rem; color: var(--text-ter); }
.service-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-sec); transition: all .2s ease;
}
.btn-icon:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-icon.call:hover { background: var(--success); border-color: var(--success); }
.btn-icon.navigate:hover { background: #1E88E5; border-color: #1E88E5; }
.btn-icon .material-symbols-outlined { font-size: 20px; }

/* ---- Profile Page ---- */
.profile-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.profile-avatar-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 24px; text-align: center;
}
.avatar-circle {
  width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: #fff;
}
.profile-avatar-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.profile-avatar-card .profile-role { font-size: .8rem; color: var(--text-sec); }
.profile-details-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.profile-tabs { display: flex; border-bottom: 1px solid var(--border); }
.profile-tab {
  padding: 16px 24px; font-size: .85rem; font-weight: 600; color: var(--text-sec);
  cursor: pointer; border-bottom: 2px solid transparent; transition: all .2s ease;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.profile-content { padding: 28px; }
.profile-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.profile-section-header h2 { font-size: 1.05rem; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-sec); }
.form-input {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: .88rem; color: var(--text); background: var(--bg);
  transition: border-color .2s ease;
}
.form-input:focus { border-color: var(--primary); background: #fff; }

/* ---- Emergency Contacts (Profile) ---- */
.contacts-section { border-top: 1px solid var(--border); padding-top: 24px; }
.contact-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.contact-item:last-child { border-bottom: none; }
.contact-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--primary-subtle);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--primary); flex-shrink: 0;
}
.contact-info { flex: 1; }
.contact-info h4 { font-size: .88rem; font-weight: 600; }
.contact-info p { font-size: .78rem; color: var(--text-sec); }
.contact-phone { font-size: .85rem; color: var(--text); font-weight: 500; margin-right: 8px; }
.contact-actions { display: flex; gap: 4px; }
.contact-actions button {
  width: 32px; height: 32px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; background: transparent;
  color: var(--text-ter); transition: all .2s ease;
}
.contact-actions button:hover { background: var(--bg); color: var(--text); }
.contact-actions button .material-symbols-outlined { font-size: 18px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 10px; font-size: .88rem; font-weight: 600;
  transition: all .2s ease; border: none; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-sec); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(229,57,53,.1); color: var(--sos-red); }
.btn-danger:hover { background: var(--sos-red); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: .8rem; border-radius: 8px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .top-bar { display: flex; }
  .bottom-nav { display: flex; }
  .main-content { margin-left: 0; padding: 20px 16px; padding-top: calc(var(--header-h) + 16px); padding-bottom: calc(var(--bnav-h) + 16px); }
  .page-header h1 { font-size: 1.3rem; }
  .sos-btn { width: 150px; height: 150px; }
  .sos-ring { width: 150px; height: 150px; }
  @keyframes sosPulse { 0% { width: 150px; height: 150px; opacity: .6; } 100% { width: 260px; height: 260px; opacity: 0; } }
  .service-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .service-card { padding: 16px 14px; }
  .alerts-table th, .alerts-table td { padding: 10px 12px; font-size: .78rem; }
  .service-item { flex-wrap: wrap; }
  .service-item-actions { width: 100%; justify-content: flex-end; }
  .form-grid { grid-template-columns: 1fr; }
  .profile-tabs { overflow-x: auto; }
  .filter-tabs { gap: 6px; }
}
@media (max-width: 480px) {
  .splash-title { font-size: 2rem; letter-spacing: 4px; }
  .service-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ---- Utility Animations ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}

/* ---- Feature Cards (Dashboard) ---- */
.feature-cards-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.feature-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; cursor: pointer; transition: all .25s ease;
}
.feature-card:hover { border-color: var(--primary-lighter); transform: translateX(4px); box-shadow: var(--shadow-sm); }
.feature-card-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.feature-card-icon .material-symbols-outlined { font-size: 24px; }
.feature-card-info { flex: 1; }
.feature-card-info h3 { font-size: .95rem; font-weight: 700; margin-bottom: 3px; }
.feature-card-info p { font-size: .78rem; color: var(--text-sec); line-height: 1.4; }

/* ---- AI Voice Toggle Card ---- */
.ai-voice-toggle-card {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 26px; transition: .3s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 20px; height: 20px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ---- Safety Timer Page ---- */
.timer-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px 24px; margin-bottom: 20px;
}
.timer-icon-header { text-align: center; margin-bottom: 28px; }
.timer-icon-circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(108,60,225,0.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.timer-icon-circle .material-symbols-outlined { font-size: 32px; }
.timer-icon-header h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.timer-icon-header p { font-size: .85rem; color: var(--text-sec); }
.timer-presets {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px;
}
.timer-preset-btn {
  padding: 12px; border-radius: 10px; font-size: .88rem; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-sec);
  cursor: pointer; transition: all .2s ease;
}
.timer-preset-btn:hover { border-color: var(--primary-lighter); color: var(--primary); }
.timer-preset-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.timer-custom, .timer-destination { margin-bottom: 16px; }

.timer-ring-container { width: 220px; height: 220px; margin: 0 auto 24px; position: relative; }
.timer-ring-container.warning .timer-ring-progress { stroke: var(--sos-red) !important; }
.timer-ring-container.warning { animation: pulseRed 1.5s ease-in-out infinite; }
@keyframes pulseRed {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(229,57,53,0)); }
  50% { filter: drop-shadow(0 0 20px rgba(229,57,53,0.5)); }
}
.timer-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.timer-ring-progress {
  fill: none; stroke: var(--primary); stroke-width: 8;
  stroke-linecap: round; stroke-dasharray: 565; stroke-dashoffset: 565;
  transition: stroke-dashoffset 1s linear;
}
.timer-ring-inner {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-countdown { font-size: 2.8rem; font-weight: 900; letter-spacing: 2px; color: var(--text); }
.timer-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: var(--text-sec); }
.timer-dest-display {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: .88rem; color: var(--text-sec); margin-bottom: 20px;
}
.timer-warning-msg {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(229,57,53,0.1); color: var(--sos-red); padding: 14px 20px;
  border-radius: 12px; font-size: .88rem; margin-bottom: 20px; text-align: center;
  animation: pulseGreen 2s ease-in-out infinite;
}
.timer-warning-msg .material-symbols-outlined { font-size: 22px; }
.timer-actions { display: flex; gap: 12px; }
.timer-info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px;
}
.timer-info-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 12px; }
.timer-info-card ul { display: flex; flex-direction: column; gap: 10px; }
.timer-info-card li {
  display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--text-sec);
}
.timer-info-card li .material-symbols-outlined { color: var(--primary); }

/* ---- Emergency QR Page ---- */
.qr-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.qr-form-card, .qr-preview-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px;
}
.qr-phone-frame {
  width: 220px; height: 476px; margin: 16px auto;
  background: #111; border-radius: 28px; padding: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.qr-phone-screen {
  width: 100%; height: 100%; border-radius: 22px; overflow: hidden;
  background: linear-gradient(145deg, #0f0c29, #302b63, #24243e);
  display: flex; align-items: center; justify-content: center;
}
.qr-wallpaper-placeholder {
  text-align: center; color: rgba(255,255,255,0.4); font-size: .8rem;
}
.qr-wallpaper-placeholder p { margin-top: 12px; line-height: 1.5; }
.qr-photo-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

@media (max-width: 768px) {
  .qr-layout { grid-template-columns: 1fr; }
  .qr-phone-frame { width: 180px; height: 390px; }
  .timer-presets { grid-template-columns: repeat(3, 1fr); }
  .feature-cards-row { gap: 10px; }
}

/* ---- AI Assistant FAB ---- */
.fab-ai {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(108,60,225,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  transition: all 0.2s ease;
}
.fab-ai:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(108,60,225,0.5);
}
.fab-ai .material-symbols-outlined {
  font-size: 28px;
}
@media (min-width: 769px) {
  .fab-ai {
    bottom: 30px;
    right: 30px;
  }
}

/* ============ SOS Countdown Overlay ============ */
#sos-countdown-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  animation: fadeInOverlay 0.3s ease;
}
@keyframes fadeInOverlay {
  from { opacity: 0; } to { opacity: 1; }
}
.sos-countdown-modal {
  text-align: center; padding: 40px 32px;
  max-width: 360px; width: 90%;
  position: relative;
}
.sos-countdown-pulse {
  position: absolute; top: 50%; left: 50%;
  width: 200px; height: 200px;
  transform: translate(-50%, -60%);
  border-radius: 50%;
  background: rgba(229, 57, 53, 0.2);
  animation: sosPulse 1s ease-in-out infinite;
}
@keyframes sosPulse {
  0%, 100% { transform: translate(-50%, -60%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -60%) scale(1.5); opacity: 0; }
}
.sos-countdown-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, #E53935, #C62828);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; position: relative; z-index: 1;
  box-shadow: 0 0 40px rgba(229, 57, 53, 0.6);
  animation: iconPulse 0.6s ease-in-out infinite alternate;
}
@keyframes iconPulse {
  from { box-shadow: 0 0 20px rgba(229,57,53,0.4); }
  to { box-shadow: 0 0 60px rgba(229,57,53,0.8); }
}
.sos-countdown-title {
  font-size: 1.6rem; font-weight: 800; color: #fff;
  margin: 0 0 8px; position: relative; z-index: 1;
}
.sos-countdown-subtitle {
  font-size: 0.9rem; color: rgba(255,255,255,0.7);
  margin: 0 0 24px; position: relative; z-index: 1;
}
.sos-countdown-timer {
  font-size: 5rem; font-weight: 900; color: #E53935;
  line-height: 1; margin: 0 0 16px;
  text-shadow: 0 0 40px rgba(229,57,53,0.6);
  position: relative; z-index: 1;
  animation: countBlink 1s step-end infinite;
}
@keyframes countBlink {
  50% { opacity: 0.6; }
}
.sos-countdown-info {
  font-size: 0.82rem; color: rgba(255,255,255,0.5);
  margin: 0 0 28px; line-height: 1.5;
  position: relative; z-index: 1;
}
.sos-countdown-cancel {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px; border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: #fff; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  position: relative; z-index: 1;
}
.sos-countdown-cancel:hover, .sos-countdown-cancel:active {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}
