/* --- Global Reset & Base Setup --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #080c14;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Header & Navigation Bar --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-logo span {
  color: #38bdf8;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.925rem;
  color: #94a3b8;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: #ffffff;
}

.nav-security-btn {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s !important;
}

.nav-security-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
}

/* --- Hero Section --- */
.hero-section {
  max-width: 850px;
  margin: 6rem auto 4rem auto;
  text-align: center;
  padding: 0 1.5rem;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 3.25rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  background: linear-gradient(180deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  line-height: 1.6;
  color: #94a3b8;
  max-width: 650px;
  margin: 0 auto 2.5rem auto;
}

/* --- Waitlist Form --- */
.waitlist-form {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.waitlist-form input {
  flex: 1;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.waitlist-form input:focus {
  border-color: #38bdf8;
}

.waitlist-form button {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.85rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.waitlist-form button:hover {
  background: #0369a1;
}

.form-msg {
  font-size: 0.85rem;
  margin-top: 0.85rem;
  min-height: 1.25rem;
}

/* --- Features Grid --- */
.features-section {
  max-width: 1100px;
  margin: 4rem auto 6rem auto;
  padding: 0 1.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: #0f1523;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 2rem;
  transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.3);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.feature-card p {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
}

/* --- Modals Common Styles --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  z-index: 9999;
  padding: 1.5rem;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  position: relative;
  background: #111726;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  padding: 2.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease-in-out;
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.6rem;
}

.modal-header h2 {
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}

.modal-header p {
  font-size: 0.875rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #cbd5e1;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  background: #1a2336;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.925rem;
  outline: none;
}

.form-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.form-error {
  font-size: 0.825rem;
  color: #f87171;
  min-height: 1.25rem;
  margin-bottom: 0.75rem;
}

.modal-submit-btn {
  width: 100%;
  padding: 0.8rem;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.modal-submit-btn:hover {
  background: #0369a1;
}

/* --- Admin Data Table Layout --- */
.modal-box.admin-box {
  max-width: 950px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: #1a2336;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.admin-actions-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.action-btn {
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.action-btn.secondary {
  background: #334155;
}

.table-scroll-container {
  overflow: auto;
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #0a0e17;
}

.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.admin-data-table th, 
.admin-data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.admin-data-table th {
  background: #141b2b;
  color: #cbd5e1;
  position: sticky;
  top: 0;
}

.admin-data-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.table-edit-btn {
  background: #0284c7;
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.record-drawer {
  margin-top: 1rem;
  padding: 1.25rem;
  background: #141b2b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.record-drawer.hidden {
  display: none;
}

.drawer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.modal-cancel-btn {
  background: #475569;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.8rem;
  cursor: pointer;
}
/* --- Live Video Page Styles --- */
.live-body {
  background: #06090e;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.live-header {
  height: 56px;
  background: #0d121d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 20;
}

.live-header-left, .live-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-location-badge {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
}

.grid-controls {
  display: flex;
  background: #151c2c;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}

.grid-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.grid-btn.active {
  background: #0284c7;
  color: #ffffff;
}

.user-pill {
  font-size: 0.825rem;
  color: #cbd5e1;
}

.nav-btn-secondary {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.live-viewport {
  flex: 1;
  padding: 0.75rem;
  overflow: auto;
}

/* Dynamic Grids */
.camera-grid {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
}

.camera-grid.grid-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.camera-grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.camera-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.camera-tile {
  background: #0b0f17;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.camera-tile-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
}

.cam-status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

.cam-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  flex: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.fullscreen-tile-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem;
}

.video-container {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stream-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
}

.no-cams-alert, .stream-error {
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem;
}