/* ═══════════════════════════════════════════════════════════
   COCHLEA CAP WEB PORTAL — style.css (White Theme)
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors from Presentation */
  --primary-dark:  #014335;
  --primary:       #086653;
  --primary-light: #4BAA92;
  --accent:        #F2C785; /* Soft yellow/orange */
  --accent-dark:   #D9AC6A;
  
  --danger:        #E85C5C;
  --danger-light:  #FDECEA;
  --success:       #4BAA92;
  
  /* Layout Colors */
  --bg:            #FFFFFF;
  --bg-alt:        #F8FAF9;
  --card-bg:       #FFFFFF;
  --card-border:   #E2EAE7;
  
  /* Typography */
  --text-primary:  #1A2E26;
  --text-muted:    #5F756D;
  
  /* Shadows & Radius */
  --shadow-sm:     0 4px 12px rgba(8, 102, 83, 0.05);
  --shadow-md:     0 8px 24px rgba(8, 102, 83, 0.08);
  --shadow-lg:     0 16px 48px rgba(8, 102, 83, 0.12);
  --radius-sm:     12px;
  --radius-md:     18px;
  --radius-lg:     24px;
  --radius-xl:     32px;
  --nav-h:         80px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(8, 102, 83, 0.25);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8, 102, 83, 0.35);
}
.btn-accent {
  background: var(--accent);
  color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(242, 199, 133, 0.4);
}
.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--bg-alt);
}

/* ═══════════════════════════════════════════════════════════
   NAVIGATION (Landing Page)
   ═══════════════════════════════════════════════════════════ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 1000;
}
.navbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
}
.navbar__logo {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.navbar__links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.navbar__links a.nav-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}
.navbar__links a.nav-link:hover { color: var(--primary); }

@media (max-width: 768px) {
  .navbar { padding: 0 20px; }
  .navbar__links .nav-link { display: none; } /* Hide links on mobile, keep CTA */
}

/* ═══════════════════════════════════════════════════════════
   LANDING PAGE SECTIONS
   ═══════════════════════════════════════════════════════════ */
.section {
  padding: 100px 40px;
  max-width: 1200px;
  margin: 0 auto;
}
.section--alt { background: var(--bg-alt); max-width: none; }
.section--alt .container { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

.section-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--primary-dark);
  font-size: 0.8125rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.section-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 24px;
  line-height: 1.2;
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  padding-top: calc(var(--nav-h) + 80px);
  padding-bottom: 80px;
  text-align: center;
}
.hero-title {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--primary-dark);
  letter-spacing: -1px;
  margin-bottom: 24px;
  line-height: 1.1;
}
.hero-title span { color: var(--primary); }
.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* ── Grid Layouts ──────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.5rem; }
}

/* ── Cards ─────────────────────────────────────────────── */
.info-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s, box-shadow 0.3s;
}
.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.info-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 12px;
}
.info-card p {
  color: var(--text-muted);
  line-height: 1.6;
}

.stat-number {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 8px;
  display: block;
}

/* Image Placeholders */
.img-placeholder {
  width: 100%;
  height: 250px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  border: 2px dashed var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════
   AUTH PAGE (login.html)
   ═══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  padding: 20px;
}
.auth-wrapper {
  width: 100%;
  max-width: 440px;
}
.auth-brand { text-align: center; margin-bottom: 32px; }
.auth-logo {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: white;
  box-shadow: var(--shadow-sm);
}
.auth-title {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--primary-dark);
}
.auth-subtitle {
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 32px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-md);
}

.tab-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 4px;
  position: relative;
  margin-bottom: 24px;
}
.tab-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.25s;
}
.tab-btn.active { color: var(--primary-dark); }
.tab-indicator {
  position: absolute;
  top: 4px; left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
}

.error-box {
  background: var(--danger-light);
  border: 1px solid rgba(232,92,92,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.8125rem;
  color: var(--danger);
  font-weight: 600;
  line-height: 1.4;
}

.input-group { margin-bottom: 16px; }
.input-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--primary-light); width: 18px; height: 18px;
}
.input-wrap input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 40px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}
.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 102, 83, 0.1);
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD PAGE
   ═══════════════════════════════════════════════════════════ */
.dashboard-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Top nav ─────────────────────────────────────────────── */
.topnav {
  height: var(--nav-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
  z-index: 100;
}
.topnav__brand { display: flex; align-items: center; gap: 12px; }
.topnav__logo {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.topnav__name { font-size: 1.125rem; font-weight: 800; color: var(--primary-dark); }

.live-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--danger-light);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--danger);
  letter-spacing: 1px;
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.topnav__right { display: flex; align-items: center; gap: 14px; }
.user-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 6px 14px 6px 6px;
}
.user-avatar {
  width: 30px; height: 30px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
}
.user-pill span { font-size: 0.875rem; font-weight: 700; color: var(--primary-dark); }
.btn-logout {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none;
  font-family: inherit; font-size: 0.8125rem; font-weight: 700;
  color: var(--text-muted); cursor: pointer; transition: color 0.2s;
}
.btn-logout:hover { color: var(--danger); }

/* ── Dashboard layout ─────────────────────────────────────── */
.dashboard-layout { display: grid; grid-template-columns: 360px 1fr; flex: 1; overflow: hidden; background: var(--bg-alt); }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

/* Account card */
.account-card { display: flex; align-items: center; gap: 14px; }
.account-card__avatar {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.account-card__info { flex: 1; min-width: 0; }
.account-card__name { font-size: 1rem; font-weight: 800; color: var(--primary-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-card__email { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Devices */
.section-label {
  font-size: 0.6875rem; font-weight: 800; color: var(--text-muted);
  letter-spacing: 1.2px; margin-bottom: 16px;
}
.device-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.device-row + .device-row { border-top: 1px solid var(--card-border); }
.device-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.device-icon--green { background: rgba(75, 170, 146, 0.1); color: var(--primary); }
.device-icon--amber { background: rgba(242, 199, 133, 0.2); color: var(--accent-dark); }
.device-info { flex: 1; }
.device-name { display: block; font-size: 0.875rem; font-weight: 700; color: var(--primary-dark); }
.device-status { font-size: 0.75rem; color: var(--primary-light); font-weight: 700; }
.device-status--warn { color: var(--accent-dark); }

/* SOS feed */
.sos-card { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.sos-card .section-label { padding: 20px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.sos-count {
  background: var(--danger); color: #fff; font-size: 0.625rem; font-weight: 800;
  padding: 2px 8px; border-radius: 12px;
}
.sos-feed { flex: 1; overflow-y: auto; padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.sos-empty { padding: 30px 20px; text-align: center; color: var(--text-muted); font-size: 0.8125rem; }
.sos-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px; background: var(--danger-light);
  border-radius: var(--radius-sm); border-left: 4px solid var(--danger);
}
.sos-item--resolved { background: rgba(75, 170, 146, 0.08); border-left-color: var(--success); }
.sos-item__title { display: block; font-size: 0.875rem; font-weight: 800; color: var(--danger); }
.sos-item--resolved .sos-item__title { color: var(--primary); }
.sos-item__loc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; display: block; }
.sos-item__meta { margin-left: auto; text-align: right; }
.sos-item__time { font-size: 0.6875rem; color: var(--text-muted); display: block; }

/* ── Map section ─────────────────────────────────────────── */
.map-section { display: flex; flex-direction: column; }
.map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; background: var(--bg-alt);
}
.map-title { font-size: 1.25rem; font-weight: 800; color: var(--primary-dark); }
.map-sub { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; }
.map-actions { display: flex; align-items: center; gap: 16px; }

.conn-indicator { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; font-weight: 700; color: var(--text-muted); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.leaflet-map { flex: 1; min-height: 0; background: #e5e3df; border-top: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); }

/* Stats bar */
.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card-bg); flex-shrink: 0;
}
.stat-item { padding: 16px 24px; border-right: 1px solid var(--card-border); }
.stat-item:last-child { border-right: none; }
.stat-label { display: block; font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { display: block; font-size: 0.9375rem; font-weight: 800; color: var(--primary-dark); margin-top: 4px; }
.stat-value--danger { color: var(--danger); }

/* Pulse Marker */
.pulse-marker { width: 40px; height: 40px; position: relative; }
.pulse-marker__dot {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 16px; background: var(--primary); border-radius: 50%;
  border: 3px solid #fff; box-shadow: var(--shadow-md); z-index: 2;
}
.pulse-marker__ring {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border: 2px solid var(--primary); border-radius: 50%;
  animation: ring-pulse 2s ease-out infinite; opacity: 0;
}
@keyframes ring-pulse { 0% { transform: translate(-50%,-50%) scale(0.5); opacity: 0.8; } 100% { transform: translate(-50%,-50%) scale(1.5); opacity: 0; } }

/* SOS Marker */
.sos-marker {
  width: 30px; height: 30px; background: var(--danger); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff; box-shadow: 0 4px 12px rgba(232,92,92,0.4);
  animation: sos-pulse 1s infinite alternate;
}
@keyframes sos-pulse { from { transform: scale(1); } to { transform: scale(1.1); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--card-border); max-height: 40vh; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .stat-item:nth-child(2) { border-right: none; }
  .stat-item:nth-child(1), .stat-item:nth-child(2) { border-bottom: 1px solid var(--card-border); }
}
