/* ===================================================
   FIELD SHOPS TRACKER - STYLESHEET
   Arabic RTL First, Modern Clean UI, Mobile-Optimized
   =================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #475569;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  direction: rtl;
  min-height: 100vh;
  padding-bottom: 75px; /* for mobile bottom nav */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 30px;
  }
}

/* Header */
.app-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.brand-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

/* Desktop Nav */
.desktop-nav {
  display: none;
  gap: 8px;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-full);
}

@media (min-width: 860px) {
  .desktop-nav {
    display: flex;
  }
}

.nav-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--primary);
}

.nav-tab.active {
  background-color: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Content & Tabs */
.main-content {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
  display: block;
}

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

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header.bg-gradient {
  background: linear-gradient(to left, #eff6ff, #f8fafc);
  border-bottom: 1px solid #dbeafe;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title i {
  font-size: 1.25rem;
  color: var(--primary);
}

.header-title h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.header-title h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-body {
  padding: 20px;
}

/* Forms */
.shop-form {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .full-width {
    grid-column: span 2;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label.required::after {
  content: "*";
  color: var(--danger);
  font-weight: bold;
}

.text-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
}

.form-control {
  font-family: var(--font-family);
  font-size: 0.95rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.2s ease;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

/* GPS Section */
.gps-box {
  background: #f0fdf4;
  border: 1.5px dashed #86efac;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.gps-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 580px) {
  .gps-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.gps-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulse-icon {
  font-size: 1.6rem;
  color: var(--success);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.gps-title strong {
  display: block;
  font-size: 1rem;
  color: #166534;
}

.gps-status-muted {
  font-size: 0.8rem;
  color: #15803d;
}

.btn-gps {
  background-color: #16a34a;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.btn-gps:hover {
  background-color: #15803d;
}

.mini-map-wrapper {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #bbf7d0;
  display: none;
}

.mini-map {
  width: 100%;
  height: 200px;
}

.map-hint {
  background-color: #dcfce7;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: #14532d;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coords-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.coord-pill {
  background: white;
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: #166534;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Photo Section */
.photo-section {
  margin-top: 8px;
}

.photo-uploader {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

.photo-uploader:hover {
  border-color: var(--primary);
  background-color: #f1f5f9;
}

.file-input-hidden {
  display: none;
}

.upload-placeholder {
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.upload-text strong {
  display: block;
  font-size: 0.95rem;
  color: #1e293b;
}

.upload-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.preview-container {
  position: relative;
  text-align: center;
  padding: 12px;
  background-color: #0f172a;
}

.preview-container img {
  max-height: 250px;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.preview-actions {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--secondary);
}

.btn-outline:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.btn-light {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border);
}

.btn-light:hover {
  background-color: #f8fafc;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.form-actions {
  margin-top: 24px;
}

/* Filters & Search */
.filter-card {
  padding: 16px 20px;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .filter-grid {
    grid-template-columns: 2fr repeat(5, 1fr);
  }
}

.search-input-box {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.9rem;
}

.search-input-box input {
  padding-right: 36px;
}

/* Quick Area Pills */
.area-pills-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.pills-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.area-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 110px;
  overflow-y: auto;
}

.area-pill-btn {
  border: 1px solid var(--border);
  background-color: #f8fafc;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-family: var(--font-family);
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.area-pill-btn:hover {
  background-color: var(--primary-light);
  border-color: #93c5fd;
  color: var(--primary);
}

.area-pill-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.area-pill-btn .pill-count {
  background-color: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.area-pill-btn.active .pill-count {
  background-color: rgba(255, 255, 255, 0.25);
  color: white;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

/* Shops Cards Grid */
.shops-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 680px) {
  .shops-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .shops-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.shop-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.shop-card-media {
  height: 160px;
  background-color: #f1f5f9;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.shop-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.shop-card-media:hover img {
  transform: scale(1.04);
}

.shop-no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #94a3b8;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.shop-no-photo i {
  font-size: 2.2rem;
}

.shop-card-category-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.shop-card-status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.status-green { background: #dcfce7; color: #15803d; }
.status-blue { background: #dbeafe; color: #1e40af; }
.status-yellow { background: #fef3c7; color: #b45309; }
.status-gray { background: #f1f5f9; color: #475569; }
.status-red { background: #fee2e2; color: #b91c1c; }

.shop-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 8px;
}

.shop-card-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.shop-card-info-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: #475569;
}

.shop-card-info-item i {
  margin-top: 3px;
  color: var(--primary);
  width: 14px;
  text-align: center;
}

.shop-card-area-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.shop-card-notes {
  background-color: #fffbeb;
  border-right: 3px solid #f59e0b;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #92400e;
  margin-top: 4px;
}

.shop-card-date {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.shop-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 10px 14px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border);
}

.action-btn-call {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 7px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.action-btn-wa {
  background-color: #22c55e;
  color: white;
  border: none;
  padding: 7px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.action-btn-map {
  background-color: #ea580c;
  color: white;
  border: none;
  padding: 7px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.shop-card-manage-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px 14px;
  background-color: #ffffff;
  border-top: 1px solid #f1f5f9;
}

.btn-text-sm {
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-text-sm:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.btn-text-danger:hover {
  background-color: var(--danger-light);
  color: var(--danger);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background-color: white;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
}

.empty-state i {
  font-size: 4rem;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.25rem;
  color: #334155;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Full Map View */
.map-view-card {
  position: relative;
  height: calc(100vh - 160px);
  min-height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.full-map {
  width: 100%;
  height: 100%;
}

.map-floating-bar {
  position: absolute;
  top: 16px;
  right: 16px;
  left: 16px;
  z-index: 999;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  pointer-events: none;
}

.map-filter-group,
.map-action-group {
  display: flex;
  gap: 8px;
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.form-control-sm {
  padding: 4px 10px;
  font-size: 0.82rem;
  height: 32px;
}

/* Map Popups */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
  font-family: var(--font-family) !important;
  direction: rtl;
  width: 260px !important;
}

.map-popup-card {
  display: flex;
  flex-direction: column;
}

.map-popup-img {
  height: 110px;
  width: 100%;
  object-fit: cover;
}

.map-popup-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-popup-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.map-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
}

/* Stats View */
.stats-overview {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.metric-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.bg-card-blue { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.bg-card-green { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.bg-card-purple { background: #f5f3ff; border-color: #ddd6fe; color: #5b21b6; }
.bg-card-amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.metric-content {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.9;
}

.metric-value {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.1;
  margin-top: 2px;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-lead {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Data Table */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 12px 14px;
  text-align: right;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

.progress-cell {
  width: 180px;
}

.progress-bg {
  height: 8px;
  background-color: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: var(--radius-full);
}

.stats-two-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .stats-two-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.progress-bars-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-lightbox {
  background: transparent;
  box-shadow: none;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-lightbox img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.lightbox-caption {
  margin-top: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 16px;
  border-radius: var(--radius-full);
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 85px;
  left: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 580px) {
  .toast-container {
    bottom: 24px;
    right: 24px;
    left: auto;
    max-width: 380px;
  }
}

.toast {
  background-color: #1e293b;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideIn 0.3s ease;
}

.toast.toast-success { background-color: #15803d; }
.toast.toast-error { background-color: #b91c1c; }
.toast.toast-info { background-color: #1d4ed8; }

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

@media (min-width: 860px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  padding: 4px;
  transition: all 0.2s ease;
}

.bottom-nav-item i {
  font-size: 1.25rem;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.text-emerald { color: #10b981; }

/* ===================================================
   LOGIN SCREEN & AUTH STYLES
   =================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.login-card {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
  padding: 30px 26px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.login-header {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  margin: 0 auto 14px;
  width: 58px;
  height: 58px;
  font-size: 28px;
}

.login-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control-lg {
  padding: 12px 16px;
  font-size: 1rem;
}

.login-hint {
  margin-top: 18px;
  padding: 10px 14px;
  background-color: #f1f5f9;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
}

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-danger {
  background-color: var(--danger-light);
  border: 1px solid #fecaca;
  color: var(--danger);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #f1f5f9;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  border: 1px solid var(--border);
}

.btn-logout {
  color: #dc2626 !important;
  border-color: #fecaca !important;
}

.btn-logout:hover {
  background-color: #fee2e2 !important;
}

.add-user-inline-form {
  background-color: #f8fafc;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-md);
}

.form-control-primary {
  border-color: #93c5fd;
  background-color: #f0f7ff;
  font-weight: 600;
}

.text-ltr {
  direction: ltr !important;
  text-align: left !important;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  padding-left: 45px !important;
}

.btn-toggle-password {
  position: absolute;
  left: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px 8px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: color 0.2s ease;
}

.btn-toggle-password:hover {
  color: var(--primary);
}

/* Zero-Flicker Authentication Rules */
html.has-auth #loginScreen {
  display: none !important;
}

html.has-auth #appContainer {
  display: block !important;
}

html:not(.has-auth) #appContainer {
  display: none !important;
}

