/* ═══════════════════════════════════════════════════════════════
   e-Beat System — Main CSS Design System
   Tokens, resets, utilities, shared components
═══════════════════════════════════════════════════════════════ */

/* ─── TOKENS ───────────────────────────────────────────────── */
:root {
  /* Police color palette */
  --c-primary:      #1e3a8a;
  --c-primary-dark: #1e2d6b;
  --c-accent:       #2563eb;
  --c-accent-light: #3b82f6;
  --c-gold:         #f59e0b;

  --c-danger:       #dc2626;
  --c-danger-dark:  #991b1b;
  --c-warning:      #d97706;
  --c-success:      #16a34a;
  --c-success-light:#22c55e;

  /* Dark theme */
  --c-bg:           #0a0f1e;
  --c-bg-2:         #0f172a;
  --c-surface:      #1e293b;
  --c-surface-2:    #263348;
  --c-surface-3:    #2d3f5a;
  --c-border:       rgba(255,255,255,0.08);
  --c-border-2:     rgba(255,255,255,0.15);

  /* Text */
  --c-text:         #f8fafc;
  --c-text-2:       #cbd5e1;
  --c-text-3:       #94a3b8;
  --c-text-4:       #64748b;

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  --grad-danger:    linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  --grad-dark:      linear-gradient(135deg, #0a0f1e 0%, #0f172a 100%);
  --grad-gold:      linear-gradient(135deg, #92400e 0%, #f59e0b 100%);
  --grad-surface:   linear-gradient(180deg, #1e293b 0%, #0f172a 100%);

  /* Typography */
  --font-main:      'Inter', 'Noto Sans Devanagari', system-ui, sans-serif;
  --font-hindi:     'Noto Sans Devanagari', sans-serif;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Radii */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(37,99,235,0.35);
  --shadow-red:  0 0 30px rgba(220,38,38,0.4);

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-med:    0.3s ease;
  --t-slow:   0.5s ease;

  /* Layout */
  --header-h:     60px;
  --bottom-nav-h: 68px;
  --sidebar-w:    260px;
}

/* ─── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ─── SCREEN SYSTEM ─────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--t-med), transform var(--t-med);
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(37,99,235,0.4);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(37,99,235,0.6); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-danger {
  background: var(--grad-danger);
  color: white;
  box-shadow: 0 4px 16px rgba(220,38,38,0.4);
}
.btn-danger:hover { box-shadow: var(--shadow-red); transform: translateY(-1px); }

.btn-secondary {
  background: var(--c-surface-2);
  color: var(--c-text);
  border: 1px solid var(--c-border-2);
}
.btn-secondary:hover { background: var(--c-surface-3); }

.btn-outline {
  background: transparent;
  color: var(--c-accent-light);
  border: 1px solid var(--c-accent-light);
}
.btn-outline:hover { background: rgba(37,99,235,0.1); }

.btn-lg { padding: 16px 24px; font-size: 1rem; border-radius: var(--r-lg); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--r-sm); }

/* ─── FORM ELEMENTS ──────────────────────────────────────────── */
.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-input::placeholder { color: var(--c-text-4); }
.form-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-text-3);
  margin-bottom: var(--space-xs);
}

.form-group { margin-bottom: var(--space-md); }

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
  padding: var(--space-md) 0 var(--space-sm);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--space-md);
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.input-with-action {
  position: relative;
}
.input-with-action .form-input { padding-right: 48px; }
.input-action {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--c-text-3);
  cursor: pointer;
}
.checkbox-label input { accent-color: var(--c-accent); }

.link-btn {
  background: none;
  border: none;
  color: var(--c-accent-light);
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 500;
}
.link-btn:hover { text-decoration: underline; }

/* ─── TOGGLE GROUP ───────────────────────────────────────────── */
.toggle-group {
  display: flex;
  gap: var(--space-sm);
  background: var(--c-surface-2);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}
.toggle-opt {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text-3);
  transition: all var(--t-fast);
  text-align: center;
}
.toggle-opt.active {
  background: var(--c-surface-3);
  color: var(--c-text);
}
.toggle-opt.active.green-opt { background: var(--c-success); color: white; }
.toggle-opt.active.red-opt { background: var(--c-danger); color: white; }

/* ─── PHOTO UPLOAD ───────────────────────────────────────────── */
.photo-upload-area {
  border: 2px dashed var(--c-border-2);
  border-radius: var(--r-lg);
  padding: var(--space-xl);
  text-align: center;
  margin-bottom: var(--space-md);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.photo-upload-area:hover { border-color: var(--c-accent); background: rgba(37,99,235,0.05); }
.photo-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  color: var(--c-text-3);
  font-size: 0.9rem;
}
.photo-upload-icon { font-size: 2rem; }

/* ─── LOCATION TAG ───────────────────────────────────────────── */
.location-tag {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(22,163,74,0.1);
  border: 1px solid rgba(22,163,74,0.3);
  border-radius: var(--r-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.85rem;
  color: var(--c-success-light);
}

/* ─── STATUS CHIPS ───────────────────────────────────────────── */
.status-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.status-chip.active { background: rgba(22,163,74,0.2); color: #4ade80; }
.status-chip.inactive { background: rgba(100,116,139,0.2); color: #94a3b8; }
.status-chip.alert-chip { background: rgba(220,38,38,0.2); color: #f87171; }
.status-chip.yellow-chip { background: rgba(217,119,6,0.2); color: #fbbf24; }

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--c-surface-3);
  color: var(--c-text);
  padding: 12px 24px;
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all var(--t-med);
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  border: 1px solid var(--c-border-2);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── SECTION HEADER ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-lg) 0 var(--space-sm);
}
.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--c-text);
}
.section-date {
  font-size: 0.8rem;
  color: var(--c-text-4);
}

/* ─── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-surface-3); border-radius: 4px; }

/* ─── HIDDEN UTILITY ─────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── GOOGLE MAPS FIXES ──────────────────────────────────────── */
.gm-style .gm-style-iw, 
.gm-style .gm-style-iw-c, 
.gm-style .gm-style-iw-d, 
.gm-style .gm-style-iw-t::after {
  color: #000000 !important;
}
.gm-style .gm-style-iw a {
  color: #2563eb !important;
}
