/* ============================================================
   NDPS MONITORING SYSTEM - MAIN STYLESHEET
   Tirupati District Police & Excise Department
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0d1b2a;
  --sidebar-text: #a8b8cc;
  --sidebar-active-bg: rgba(13, 110, 253, 0.15);
  --sidebar-active-border: #0d6efd;
  --sidebar-hover-bg: rgba(255,255,255,0.07);
  --topnav-height: 64px;
  --topnav-bg: #ffffff;
  --content-bg: #f0f4f8;
  --primary: #0d6efd;
  --danger: #dc3545;
  --warning: #ffc107;
  --success: #198754;
  --info: #0dcaf0;
  --purple: #6f42c1;
  --dark: #212529;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --border-radius: 10px;
}

* { box-sizing: border-box; }

body.app-body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  margin: 0;
  overflow-x: hidden;
}

/* ============================================================
   APP WRAPPER & LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.content-area {
  padding: 24px;
  flex: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: all 0.3s ease;
  box-shadow: 3px 0 20px rgba(0,0,0,0.3);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(135deg, #0a1628 0%, #0d2137 100%);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), #0056cc);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13,110,253,0.4);
}

.brand-title {
  display: block;
  color: white;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.brand-subtitle {
  display: block;
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Menu */
.sidebar-menu {
  flex: 1;
  padding: 12px 0;
}

.menu-label {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.sidebar-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: white;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: #4d9fff;
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer small {
  color: rgba(255,255,255,0.3);
  font-size: 11px;
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.topnav {
  height: var(--topnav-height);
  background: var(--topnav-bg);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.topnav-left { display: flex; align-items: center; gap: 16px; }
.topnav-right { display: flex; align-items: center; gap: 12px; }

.sidebar-toggle {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s;
}
.sidebar-toggle:hover { background: #f3f4f6; color: var(--dark); }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box i {
  position: absolute;
  left: 12px;
  color: #9ca3af;
  font-size: 14px;
}
.search-box input {
  padding-left: 36px;
  width: 240px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  height: 38px;
}
.search-box input:focus {
  box-shadow: 0 0 0 3px rgba(13,110,253,0.1);
  border-color: var(--primary);
  outline: none;
}

.topnav-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  color: #6b7280;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.2s;
}
.topnav-btn:hover { background: #f3f4f6; color: var(--dark); border-color: #d1d5db; }

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.user-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.user-btn::after { display: none; }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #6f42c1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.user-name { display: block; font-size: 13px; font-weight: 600; color: #111827; }
.user-role { display: block; font-size: 11px; color: #9ca3af; }
.user-info { text-align: left; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
}
.page-subtitle { font-size: 14px; margin: 0; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  border-radius: var(--border-radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }

.stat-icon {
  font-size: 28px;
  margin-bottom: 10px;
  opacity: 0.9;
}
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; font-weight: 500; margin-top: 4px; opacity: 0.8; }
.stat-link { font-size: 11px; opacity: 0.75; text-decoration: none; display: block; margin-top: 8px; }
.stat-link:hover { opacity: 1; }

.stat-card-primary  { background: linear-gradient(135deg, #0d6efd, #0056cc); color: white; }
.stat-card-danger   { background: linear-gradient(135deg, #dc3545, #b02a37); color: white; }
.stat-card-warning  { background: linear-gradient(135deg, #fd7e14, #e35d0a); color: white; }
.stat-card-dark     { background: linear-gradient(135deg, #343a40, #212529); color: white; }
.stat-card-info     { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: white; }
.stat-card-purple   { background: linear-gradient(135deg, #7c3aed, #5b21b6); color: white; }
.stat-card-success  { background: linear-gradient(135deg, #10b981, #059669); color: white; }

/* ============================================================
   CATEGORY BADGES
   ============================================================ */
.category-badge { font-size: 11px; padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.cat-consumer        { background: #dbeafe; color: #1d4ed8; }
.cat-local_peddler   { background: #fef3c7; color: #d97706; }
.cat-supplier        { background: #fee2e2; color: #b91c1c; }
.cat-transporter     { background: #ede9fe; color: #7c3aed; }
.cat-king_pin        { background: #fce7f3; color: #be185d; }

/* ============================================================
   TABLE STYLES
   ============================================================ */
.table th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.table td { vertical-align: middle; font-size: 13px; }
.table-hover tbody tr:hover { background: rgba(13,110,253,0.04); }

/* Avatar */
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-circle.female { background: linear-gradient(135deg, #ec4899, #be185d); }

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-photo-wrapper {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-photo { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-placeholder {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 52px;
  font-weight: 700;
}
.profile-photo-placeholder.female { background: linear-gradient(135deg, #ec4899, #be185d); }

.info-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #9ca3af;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.info-value { font-size: 14px; font-weight: 500; color: #111827; }
.info-item { padding: 4px 0; }
.intelligence-text {
  background: #f8fafc;
  border-left: 3px solid #0d6efd;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #374151;
  line-height: 1.7;
}

/* ============================================================
   CARDS
   ============================================================ */
.card { border-radius: var(--border-radius); }
.card-header { border-radius: var(--border-radius) var(--border-radius) 0 0 !important; padding: 14px 20px; }

/* ============================================================
   MINI STAT BAR
   ============================================================ */
.mini-stat { transition: all 0.2s; }
.mini-stat:hover { transform: translateY(-2px); }

/* ============================================================
   LOGIN PAGE STYLES
   ============================================================ */
.login-body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

.login-bg-pattern {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-container {
  display: flex;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, rgba(13,110,253,0.1), rgba(111,66,193,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.login-left-content { max-width: 480px; }

.gov-emblem {
  width: 90px;
  height: 90px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #6f42c1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: white;
  box-shadow: 0 12px 40px rgba(13,110,253,0.4);
}

.feature-item { display: flex; align-items: center; font-size: 16px; }
.feature-item i { font-size: 22px; }

.login-right {
  width: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  background: rgba(255,255,255,0.03);
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-header { margin-bottom: 28px; }

.login-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #0d6efd, #6f42c1);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: white;
  box-shadow: 0 8px 24px rgba(13,110,253,0.35);
}

.login-btn {
  background: linear-gradient(135deg, #0d6efd, #0056cc);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(13,110,253,0.35);
}
.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13,110,253,0.45);
  background: linear-gradient(135deg, #0b5ed7, #004bb5);
  border: none;
}

.demo-creds { border-top: 1px solid #f3f4f6; padding-top: 16px; }

.cred-box {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.cred-box:hover { background: #f9fafb; border-color: #d1d5db; transform: translateY(-1px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

@media (max-width: 768px) {
  .content-area { padding: 16px; }
  .page-header { flex-direction: column; gap: 12px; }
  .stat-value { font-size: 26px; }
  .login-right { width: 100%; padding: 24px 20px; }
}

@media (max-width: 576px) {
  .topnav { padding: 0 16px; }
  .content-area { padding: 12px; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* Utilities */
.fs-tiny { font-size: 11px; }
.font-monospace { font-family: 'Courier New', monospace; }
