/* ═══════════════════════════════════════════════════════
   ELV Project Coordinator — Global Styles
   Red & White Dynamic Modular Theme
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --red:       #C0392B;
  --red-dark:  #8B0000;
  --red-deep:  #6B0000;
  --red-light: #E74C3C;
  --red-pale:  #FADBD8;
  --red-glow:  rgba(192,57,43,0.3);
  --white:     #FFFFFF;
  --off-white: #F9FAFB;
  --gray-50:   #F8F9FA;
  --gray-100:  #F1F3F5;
  --gray-200:  #E9ECEF;
  --gray-300:  #DEE2E6;
  --gray-400:  #CED4DA;
  --gray-500:  #ADB5BD;
  --gray-600:  #6C757D;
  --gray-700:  #495057;
  --gray-800:  #343A40;
  --gray-900:  #212529;
  --success:   #27AE60;
  --warning:   #F39C12;
  --info:      #2980B9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.1);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.16);
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--off-white);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: 3px; }

/* ── Typography ─────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-family: 'Rajdhani', 'Inter', sans-serif; font-weight: 700; line-height: 1.2; }

/* ══════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--red-deep) 0%, var(--red-dark) 40%, var(--red) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Animated particles */
.login-page .particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  animation: float linear infinite;
}

@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100px) scale(1); opacity: 0; }
}

.login-card {
  position: relative;
  background: rgba(255,255,255,0.97);
  border-radius: var(--radius-lg);
  padding: 48px 44px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  animation: slideUp 0.6s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px var(--red-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 8px 24px var(--red-glow); }
  50% { box-shadow: 0 8px 40px rgba(192,57,43,0.6); }
}

.login-logo .logo-icon svg { width: 36px; height: 36px; fill: white; }
.login-logo h1 { font-size: 24px; color: var(--red-dark); letter-spacing: 1px; }
.login-logo p  { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.form-control {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: white;
  width: 100%;
  padding: 15px;
  font-size: 16px;
  box-shadow: 0 4px 16px var(--red-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(192,57,43,0.5);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover { background: var(--gray-200); }

.btn-danger {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: white;
  box-shadow: 0 2px 8px var(--red-glow);
}

.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--red-glow); }

.btn-success { background: linear-gradient(135deg, #1a6b3c, var(--success)); color: white; }
.btn-success:hover { transform: translateY(-1px); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-icon { padding: 9px; border-radius: 8px; background: transparent; }
.btn-icon:hover { background: var(--gray-100); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.alert-error { background: #FDECEA; color: #C0392B; border: 1px solid #F5B7B1; }
.alert-success { background: #D5F5E3; color: #1E8449; border: 1px solid #A9DFBF; }
.alert-info { background: #D6EAF8; color: #1A5276; border: 1px solid #AED6F1; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════════════════════════════
   APP LAYOUT (Admin & Dashboard)
══════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(180deg, var(--red-deep) 0%, var(--red-dark) 60%, #7a0000 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}

.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-box {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.2);
}

.sidebar-logo .logo-box svg { width: 24px; height: 24px; fill: white; }
.sidebar-logo .brand-name { font-family: 'Rajdhani', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.sidebar-logo .brand-sub { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.4);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.18);
  color: white;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: white;
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon { width: 20px; height: 20px; opacity: 0.9; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red-light);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.user-info:hover { background: rgba(255,255,255,0.1); }

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 600; color: white; }
.user-info .user-role { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: capitalize; }

/* ── Main Content ────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────────── */
.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title { font-size: 20px; font-weight: 700; color: var(--gray-800); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.notif-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: var(--transition);
  color: var(--gray-600);
}

.notif-btn:hover { background: var(--gray-100); }
.notif-btn svg { width: 22px; height: 22px; }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid white;
}

/* ── Page Content ────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

/* ══════════════════════════════════════════════════════
   CARDS & PANELS
══════════════════════════════════════════════════════ */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 17px; font-weight: 700; color: var(--gray-800); }
.card-body { padding: 24px; }

/* ── Stats Grid ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.red    { background: #FDECEA; color: var(--red); }
.stat-icon.blue   { background: #D6EAF8; color: #2980B9; }
.stat-icon.green  { background: #D5F5E3; color: #27AE60; }
.stat-icon.orange { background: #FEF9E7; color: #F39C12; }
.stat-icon.purple { background: #F4ECF7; color: #7D3C98; }

.stat-value { font-size: 32px; font-weight: 800; color: var(--gray-800); font-family: 'Rajdhani', sans-serif; }
.stat-label { font-size: 13px; color: var(--gray-500); font-weight: 500; margin-top: 4px; }

/* ── Grid layouts ────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Table ───────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

tbody td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges / Status ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending   { background: #FEF9E7; color: #B7770D; }
.badge-progress  { background: #D6EAF8; color: #1A5276; }
.badge-completed { background: #D5F5E3; color: #1E8449; }
.badge-cancelled { background: var(--gray-100); color: var(--gray-500); }
.badge-urgent    { background: #FDECEA; color: var(--red); }
.badge-normal    { background: var(--gray-100); color: var(--gray-600); }
.badge-high      { background: #FEF3E2; color: #D35400; }

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Progress Bar ────────────────────────────────────── */
.progress-bar {
  background: var(--gray-200);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── Module Tags ─────────────────────────────────────── */
.module-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  cursor: pointer;
  transition: var(--transition);
}

.module-tag.mt-maintenance   { background:#FFF8F0; color:#D35400; border-color:#F0B27A; }
.module-tag.mt-handover      { background:#F0F9FF; color:#1A6E9F; border-color:#93C6E7; }
.module-tag.mt-installation  { background:#FFF0F0; color:#C0392B; border-color:#F1948A; }
.module-tag.mt-programming   { background:#F0FFF4; color:#1A7431; border-color:#82E0AA; }
.module-tag.mt-delivering    { background:#F5F0FF; color:#6C3483; border-color:#BB8FCE; }
.module-tag.mt-survey        { background:#FFF9F0; color:#9A7D0A; border-color:#F9E79F; }
.module-tag.mt-poc           { background:#F0F4FF; color:#154360; border-color:#85C1E9; }

/* ══════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: white;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.form-group textarea { resize: vertical; min-height: 90px; }
.form-group select { cursor: pointer; }

/* ── Checkbox / Toggle ───────────────────────────────── */
.checkbox-group { display: flex; align-items: center; gap: 10px; }
.checkbox-group input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red); cursor: pointer; }

/* ── Module Selector ─────────────────────────────────── */
.module-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.module-option {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  background: white;
  position: relative;
}

.module-option:hover {
  border-color: var(--red);
  background: var(--red-pale);
}

.module-option.selected {
  border-color: var(--red);
  background: var(--red-pale);
}

.module-option.selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
}

.module-option .mod-icon { font-size: 24px; margin-bottom: 8px; }
.module-option .mod-name { font-size: 12px; font-weight: 600; color: var(--gray-700); }

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h2 { font-size: 20px; color: var(--gray-800); }

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--gray-100);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--gray-600);
  transition: var(--transition);
}

.modal-close:hover { background: var(--red-pale); color: var(--red); }

.modal-body { padding: 28px; }
.modal-footer { padding: 20px 28px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 12px; }

/* ── Large modal ─────────────────────────────────────── */
.modal.modal-lg { max-width: 960px; }
.modal.modal-xl { max-width: 1100px; }

/* ══════════════════════════════════════════════════════
   PROJECT CARDS
══════════════════════════════════════════════════════ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.project-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.project-card-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: white;
  position: relative;
}

.project-card-header .proj-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.project-card-header .proj-client { font-size: 13px; opacity: 0.85; }

.project-card-header .proj-priority {
  position: absolute;
  top: 12px;
  right: 16px;
  background: rgba(255,255,255,0.2);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.project-card-body { padding: 16px 20px; }

.proj-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.proj-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-600);
}

.proj-meta-row svg { width: 14px; height: 14px; color: var(--red); flex-shrink: 0; }

.project-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ══════════════════════════════════════════════════════
   CHECKLIST
══════════════════════════════════════════════════════ */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item.completed { opacity: 0.6; }
.checklist-item.completed .item-title { text-decoration: line-through; color: var(--gray-400); }

.check-circle {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  margin-top: 1px;
}

.check-circle.checked {
  background: var(--red);
  border-color: var(--red);
}

.check-circle.checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.item-title { font-size: 14px; font-weight: 500; color: var(--gray-800); }
.item-desc  { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

/* ══════════════════════════════════════════════════════
   ACHIEVEMENT / USER ANALYTICS
══════════════════════════════════════════════════════ */
.achievement-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.achievement-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.ach-header { display: flex; align-items: center; gap: 14px; }
.ach-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.ach-name { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.ach-dept { font-size: 12px; color: var(--gray-500); }

.ach-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: center; }
.ach-stat-val { font-size: 22px; font-weight: 800; color: var(--red); font-family: 'Rajdhani', sans-serif; }
.ach-stat-lbl { font-size: 11px; color: var(--gray-500); font-weight: 500; }

/* ══════════════════════════════════════════════════════
   NOTIFICATION PANEL
══════════════════════════════════════════════════════ */
.notif-panel {
  position: fixed;
  top: 64px;
  right: 0;
  width: 360px;
  max-height: calc(100vh - 64px);
  background: white;
  border-left: 1px solid var(--gray-200);
  box-shadow: -8px 0 32px rgba(0,0,0,0.1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.notif-panel.open { transform: translateX(0); }

.notif-panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-list { flex: 1; overflow-y: auto; }

.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: #FFF5F4; border-left: 3px solid var(--red); }
.notif-item .notif-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.notif-item .notif-msg   { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.notif-item .notif-time  { font-size: 11px; color: var(--gray-400); margin-top: 6px; }

/* ══════════════════════════════════════════════════════
   MAP PICKER
══════════════════════════════════════════════════════ */
#map-picker { height: 320px; border-radius: var(--radius-sm); border: 2px solid var(--gray-200); }
.map-coords { font-size: 12px; color: var(--gray-500); margin-top: 8px; }
.map-search-result-item { padding: 10px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--gray-100); line-height: 1.4; }
.map-search-result-item:last-child { border-bottom: none; }
.map-search-result-item:hover { background: var(--gray-50); }

/* ══════════════════════════════════════════════════════
   DEVICE LIST
══════════════════════════════════════════════════════ */
.device-row {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

/* ══════════════════════════════════════════════════════
   FILE UPLOAD AREA
══════════════════════════════════════════════════════ */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--red);
  background: var(--red-pale);
}

.upload-area svg { width: 40px; height: 40px; color: var(--gray-400); margin-bottom: 12px; }
.upload-area p { font-size: 14px; color: var(--gray-500); }
.upload-area strong { color: var(--red); }

/* ══════════════════════════════════════════════════════
   SECTION HEADERS
══════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
}

.section-title span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════ */
.tabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: var(--radius-sm); }

.tab-btn {
  flex: 1;
  padding: 9px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.tab-btn.active {
  background: white;
  color: var(--red);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════ */
.text-red { color: var(--red); }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-gap { gap: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 15px;
  color: var(--gray-600);
}

/* ══════════════════════════════════════════════════════
   MOBILE MENU TOGGLE BUTTON
══════════════════════════════════════════════════════ */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--gray-100);
  border-radius: 10px;
  cursor: pointer;
  color: var(--gray-700);
  transition: var(--transition);
  flex-shrink: 0;
}
.menu-toggle:hover { background: var(--gray-200); }
.menu-toggle svg { width: 20px; height: 20px; }

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Mobile sidebar close button */
.sidebar-close {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: var(--transition);
}
.sidebar-close:hover { background: rgba(255,255,255,0.25); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar { width: 240px; min-width: 240px; }
  .main-content { margin-left: 240px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    min-width: 280px;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }

  /* Main content full width */
  .main-content { margin-left: 0; }

  /* Topbar */
  .topbar { padding: 0 16px; }
  .menu-toggle { display: flex; }
  .topbar-title { font-size: 16px; }

  /* Hide search on mobile – accessible via page content */
  .search-input { display: none; }

  /* Grids */
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
  .projects-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 28px; }

  /* New Project page — stack the two-column layout */
  #page-new-project > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  /* Excel sidebar — remove sticky positioning */
  #page-new-project .card[style*="position:sticky"] {
    position: relative !important;
    top: auto !important;
  }

  /* Page content padding */
  .page-content { padding: 16px; }

  /* Cards */
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }

  /* Section headers */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .section-header > div[style*="display:flex"] {
    width: 100%;
  }

  /* Tables — horizontal scroll */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* Modals */
  .modal {
    margin: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    border-radius: var(--radius);
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-overlay .modal {
    margin: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
  }
  .modal-xl { max-width: 100% !important; }
  .modal-lg { max-width: 100% !important; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 16px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }

  /* Form grids in modals */
  .modal .form-grid { grid-template-columns: 1fr; }
  .modal .form-full { grid-column: 1; }

  /* Admin settings grid */
  #page-settings > .card .card-body > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  #page-settings .card .card-body > div[style*="display:flex"][style*="gap"] {
    flex-direction: column;
  }

  /* Map height reduction */
  #map-picker { height: 200px !important; }

  /* Notification panel */
  .notif-panel { width: 100%; right: 0; left: 0; border-radius: 0; }

  /* Achievement cards */
  #achievements-grid { grid-template-columns: 1fr !important; }

  /* Footer */
  .espark-footer { padding: 10px 16px; font-size: 11px; }

  /* Project card detail table */
  #proj-detail-body > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONES (≤ 480px)
══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 11px; }
  .stat-icon { width: 36px; height: 36px; margin-bottom: 10px; }
  .stat-icon svg { width: 18px; height: 18px; }

  .topbar { height: 56px; }
  .topbar-title { font-size: 14px; }

  .page-content { padding: 12px; }

  /* Buttons in section headers stack */
  .section-header { gap: 8px; }
  .btn { font-size: 13px; padding: 8px 14px; }

  /* Module selector grid */
  .module-selector { grid-template-columns: repeat(2, 1fr) !important; }

  /* Project cards */
  .proj-name { font-size: 15px; }
  .project-card-footer { flex-direction: column; gap: 8px; align-items: flex-start; }

  /* Form controls */
  .form-control, input, select, textarea { font-size: 16px !important; } /* Prevent iOS zoom */

  /* Filter row on projects page */
  #page-projects .section-header > div {
    flex-direction: column;
    width: 100%;
  }
  #filter-status { width: 100% !important; }
}

/* ══════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION BAR
══════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════
   MODERN MOBILE BOTTOM NAVIGATION
   Design: Material You / iOS 17 hybrid
   ─ Solid-color active pill behind icon
   ─ Bold label + red tint on active
   ─ Rounded top, glass shadow
═══════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.14), 0 -1px 0 rgba(0,0,0,0.04);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-bar {
  display: flex;
  align-items: stretch;
  height: 64px;
  padding: 0 4px;
  gap: 0;
}

/* ── Each tab ── */
.mobile-nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.01em;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.2s ease;
}

/* Icon wrapper — this gets the pill background on active */
.mobile-nav-tab .nav-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 30px;
  border-radius: 15px;
  transition: background 0.25s cubic-bezier(0.34, 1.4, 0.64, 1),
              transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.mobile-nav-tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: block;
  transition: stroke 0.2s ease;
}

.mobile-nav-tab .nav-label {
  display: block;
  line-height: 1;
  white-space: nowrap;
  font-size: 10px;
  transition: color 0.2s ease, font-weight 0.1s;
}

/* ── ACTIVE STATE ── solid pill + red icon + bold label ── */
.mobile-nav-tab.active {
  color: var(--red);
}

.mobile-nav-tab.active .nav-icon-wrap {
  background: #C0392B;          /* solid red pill */
  transform: translateY(-2px);  /* slight lift */
}

.mobile-nav-tab.active svg {
  stroke: #ffffff;              /* white icon on red pill */
}

.mobile-nav-tab.active .nav-label {
  color: var(--red);
  font-weight: 700;
}

/* ── Tap press feedback ── */
.mobile-nav-tab:active .nav-icon-wrap {
  transform: scale(0.90) translateY(-1px);
}

/* ── Notification badge ── */
.mobile-nav-badge {
  position: absolute;
  top: 3px;
  right: calc(50% - 26px);
  background: #e74c3c;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid rgba(255,255,255,0.97);
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.5);
  letter-spacing: 0;
  pointer-events: none;
}

.mobile-nav-badge.hidden { display: none; }

/* ── Show on mobile ── */
@media (max-width: 768px) {
  .mobile-bottom-nav { display: block; }

  /* Push page content above the bottom nav */
  .main-content { padding-bottom: 88px !important; }

  /* Hide hamburger toggle — bottom nav replaces it */
  .menu-toggle { display: none !important; }

  /* Hide the espark footer on mobile */
  .espark-footer { display: none; }

  /* Lift toasts above nav */
  #toast-container { bottom: 80px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ── Very small phones ── */
@media (max-width: 360px) {
  .mobile-nav-bar { height: 58px; }
  .mobile-nav-tab .nav-icon-wrap { width: 42px; height: 28px; }
  .mobile-nav-tab svg { width: 20px; height: 20px; }
  .mobile-nav-tab .nav-label { font-size: 9px; }
}

/* ── Decorative hex pattern on cards ─────────────────── */
.hex-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%23000' stroke-width='1'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Animated Red Line accent ────────────────────────── */
.red-accent-line {
  height: 3px;
  background: linear-gradient(90deg, var(--red-dark), var(--red), var(--red-light));
  background-size: 200% 100%;
  animation: shimmer 3s ease infinite;
  border-radius: 2px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Search input */
.search-input {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gray-100);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  transition: var(--transition);
}

.search-input:focus-within {
  background: white;
  border-color: var(--red);
}

.search-input svg { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.search-input input { border: none; background: transparent; outline: none; font-size: 14px; font-family: inherit; width: 200px; }

/* Report card */
.report-card {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--gray-200);
  margin-bottom: 12px;
}

.report-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.report-meta .submitter { font-size: 13px; font-weight: 600; }
.report-meta .date { font-size: 12px; color: var(--gray-400); }
.report-section label { font-size: 11px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 4px; margin-top: 10px; }
.report-section p { font-size: 14px; color: var(--gray-700); }

/* ══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  pointer-events: all;
  animation: toast-in 0.3s cubic-bezier(0.4,0,0.2,1);
  color: #fff;
}

.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--red); }
.toast.toast-info    { background: var(--info); }
.toast.toast-warning { background: var(--warning); }

.toast.toast-out { animation: toast-out 0.3s cubic-bezier(0.4,0,0.2,1) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(60px); }
}

/* eSpark Brand Footer */
.espark-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-top: none;
  padding: 0 16px 8px 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
  z-index: 999;
  pointer-events: none;
}
.espark-footer > span {
  font-size: 10px;
  color: var(--gray-500);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.02em;
  pointer-events: auto;
}
.espark-brand {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 11px;
  background: linear-gradient(135deg, #C0392B, #E74C3C);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
}
/* Add bottom padding to main content so footer doesn't overlap */
.main-content { padding-bottom: 44px !important; }
.login-page   { padding-bottom: 44px; }
