/* ==========================================================================
   Distributor Directory Portal Stylesheet
   ========================================================================== */

/* Importing premium modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Color Palettes & System Tokens */
:root {
  /* Light Theme Variables */
  --bg-body: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-panel: #ffffff;
  --bg-input: #f1f5f9;
  
  --border-color: rgba(99, 102, 241, 0.08);
  --border-hover: rgba(99, 102, 241, 0.25);
  --border-focus: #6366f1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.18);
  --primary-grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  
  --secondary: #f1f5f9;
  --secondary-hover: #e2e8f0;
  
  --accent-purple: #a855f7;
  --accent-blue: #0ea5e9;
  --accent-orange: #f97316;
  --accent-green: #10b981;
  
  --font-bangla: 'Hind Siliguri', sans-serif;
  --font-eng: 'Outfit', sans-serif;
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s ease;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 25px -5px rgba(99, 102, 241, 0.04), 0 8px 10px -6px rgba(99, 102, 241, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(99, 102, 241, 0.08), 0 10px 10px -6px rgba(99, 102, 241, 0.08);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --bg-body: #090d16;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(17, 24, 39, 0.85);
  --bg-panel: #111827;
  --bg-input: #1f2937;
  
  --border-color: rgba(99, 102, 241, 0.15);
  --border-hover: rgba(99, 102, 241, 0.4);
  --border-focus: #818cf8;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-inverse: #090d16;
  
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-glow: rgba(129, 140, 248, 0.25);
  --primary-grad: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  
  --secondary: #1f2937;
  --secondary-hover: #374151;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 25px 35px -5px rgba(0, 0, 0, 0.5), 0 15px 15px -6px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   Resets & Base Layout
   -------------------------------------------------------------------------- */
.distributor-portal-wrapper * {
  box-sizing: border-box;
}

.distributor-portal-wrapper {
  scroll-behavior: smooth;
  font-family: var(--font-bangla);
  color: var(--text-main);
  line-height: 1.5;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.dp-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Background Soft Ambient Light Spheres */
.ambient-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
}

.glow-1 {
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(255,255,255,0) 70%);
}

.glow-2 {
  bottom: 10%;
  right: -100px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, rgba(255,255,255,0) 70%);
}

[data-theme="dark"] .glow-1 {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(0,0,0,0) 70%);
}

[data-theme="dark"] .glow-2 {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, rgba(0,0,0,0) 70%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Typography styles */
.distributor-portal-wrapper h1, 
.distributor-portal-wrapper h2, 
.distributor-portal-wrapper h3, 
.distributor-portal-wrapper h4, 
.distributor-portal-wrapper h5, 
.distributor-portal-wrapper h6 {
  font-family: var(--font-eng);
  font-weight: 700;
  color: var(--text-main);
}

.distributor-portal-wrapper .number-font {
  font-family: var(--font-eng);
  font-weight: 500;
}

.distributor-portal-wrapper a {
  text-decoration: none;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Header Components (Frosted Glass Interface)
   -------------------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 99;
  background: var(--bg-card);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

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

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-grad);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-text {
  font-family: var(--font-eng);
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tagline {
  font-family: var(--font-eng);
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
}

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

/* --------------------------------------------------------------------------
   Button Elements
   -------------------------------------------------------------------------- */
.distributor-portal-wrapper button, .distributor-portal-wrapper .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  border: none;
  font-family: inherit;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--primary-grad);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-icon:hover {
  background: var(--secondary-hover);
  border-color: var(--border-hover);
}

.btn-text-icon {
  background: transparent;
  color: var(--primary);
  padding: 6px 12px;
}

.btn-text-icon:hover {
  background: var(--primary-glow);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Stats Dashboard
   -------------------------------------------------------------------------- */
.stats-section {
  padding-top: 30px;
  padding-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
}

.purple-gradient { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.blue-gradient { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.orange-gradient { background: linear-gradient(135deg, #f97316, #ea580c); }
.green-gradient { background: linear-gradient(135deg, #10b981, #059669); }

.stat-number {
  font-family: var(--font-eng);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-family: var(--font-eng);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   Portal Grid Layout
   -------------------------------------------------------------------------- */
.portal-main-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 30px;
  padding-bottom: 60px;
}

/* --------------------------------------------------------------------------
   Control Panel & Advanced Filters
   -------------------------------------------------------------------------- */
.control-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: fit-content;
}

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

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

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Form Controls & Inputs */
.input-wrapper {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.95rem;
}

.distributor-portal-wrapper input[type="text"], 
.distributor-portal-wrapper select, 
.distributor-portal-wrapper textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
}

.distributor-portal-wrapper input[type="text"]:focus, 
.distributor-portal-wrapper select:focus, 
.distributor-portal-wrapper textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-panel);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-wrapper input {
  padding-left: 40px;
}

.select-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-wrapper label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-eng);
}

.distributor-portal-wrapper select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

.distributor-portal-wrapper select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Interactive SVG Map of Bangladesh
   -------------------------------------------------------------------------- */
.map-card {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

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

.map-header h4 {
  font-size: 0.95rem;
}

.map-instruction {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-navigation-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-map-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-map-back:hover {
  background: var(--secondary-hover);
  border-color: var(--border-hover);
}

.btn-map-back.hidden {
  display: none !important;
}

.map-breadcrumbs {
  font-family: var(--font-eng);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 2px 8px;
  border-radius: 4px;
}

.map-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 10px;
  border: 1px solid var(--border-color);
}

/* SVG Styling & Layer transitions */
.map-layer {
  transition: opacity 0.3s ease;
}

.map-layer.hidden {
  display: none !important;
}

.map-layer.active {
  display: block;
}

.map-division, .map-district {
  fill: var(--bg-input);
  stroke: var(--bg-body);
  stroke-width: 1.5px;
  cursor: pointer;
  transition: fill 0.3s ease, stroke-width 0.2s ease, filter 0.3s ease;
}

.map-division:hover, .map-district:hover {
  fill: var(--primary-glow);
  stroke: var(--primary);
  stroke-width: 2px;
  filter: drop-shadow(0 4px 8px var(--primary-glow));
}

.map-division.active, .map-district.active {
  fill: var(--primary);
  stroke: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.map-label {
  font-family: var(--font-eng);
  font-size: 10px;
  font-weight: 600;
  fill: var(--text-muted);
  pointer-events: none;
  text-anchor: middle;
  transition: fill 0.3s ease;
}

.map-division:hover + .map-label,
.map-division.active + .map-label,
.map-district:hover + .map-label,
.map-district.active + .map-label {
  fill: var(--text-main);
  font-weight: 700;
}

[data-theme="dark"] .map-division,
[data-theme="dark"] .map-district {
  fill: #111827;
  stroke: #1f2937;
}

[data-theme="dark"] .map-division:hover,
[data-theme="dark"] .map-district:hover {
  fill: rgba(129, 140, 248, 0.15);
  stroke: var(--primary);
}

[data-theme="dark"] .map-division.active,
[data-theme="dark"] .map-district.active {
  fill: var(--primary);
  stroke: var(--primary);
}

.map-selected-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Data Panel & Listing Area
   -------------------------------------------------------------------------- */
.data-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.data-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.data-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.data-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

/* View Switcher Toggle Group */
.toggle-group {
  display: flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.btn-toggle {
  width: 36px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.btn-toggle:hover {
  color: var(--text-main);
}

.btn-toggle.active {
  background: var(--bg-panel);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Directory Table view style */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.distributor-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.distributor-table th {
  background: var(--bg-body);
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.distributor-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.distributor-table tbody tr {
  transition: background-color 0.2s ease;
}

.distributor-table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.02);
}

.distributor-table tbody tr:last-child td {
  border-bottom: none;
}

.code-badge {
  font-family: var(--font-eng);
  background: var(--bg-input);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
}

.mobile-call-btn {
  font-family: var(--font-eng);
  color: var(--primary);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mobile-call-btn:hover {
  text-decoration: underline;
}

/* Card View Grid */
.cards-grid-container {
  width: 100%;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.distributor-card {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-smooth);
}

.distributor-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-glow);
  box-shadow: var(--shadow-sm);
}

.card-header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-header-info h4 {
  font-size: 1rem;
  font-weight: 700;
}

.card-area-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.area-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
}

.card-body-info {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card-footer-info {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Empty State Styling */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 1.2rem;
  font-weight: 700;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 400px;
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Modal Interfaces
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 13, 22, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

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

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

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 70vh;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

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

/* Manual Form inside Modal */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* CSV Drop zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-body);
  cursor: pointer;
  transition: var(--transition-fast);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-glow);
}

.drop-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.import-format-guide {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.import-format-guide h5 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.columns-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.columns-badge-row .badge {
  font-family: var(--font-eng);
  font-size: 0.75rem;
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

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

.import-summary {
  margin-top: 20px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  font-size: 0.9rem;
}

[data-theme="dark"] .import-summary {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* ==========================================================================
   Responsive Queries & Page Adaptations
   ========================================================================== */

/* Large screens and middle dimensions */
@media (max-width: 1024px) {
  .portal-main-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .map-card {
    display: none !important;
  }
}

/* Small screens / Tablets */
@media (max-width: 768px) {
  .dp-container {
    padding: 0 16px;
  }

  .header-container {
    flex-direction: column;
    gap: 16px;
    align-items: center;
    padding: 16px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }


  /* Table collapses to horizontal scroll */
  .table-container {
    border: none;
  }

  .distributor-table thead {
    display: none; /* Hide header on mobile if screen is tiny */
  }

  .distributor-table, .distributor-table tbody, .distributor-table tr, .distributor-table td {
    display: block;
    width: 100%;
  }

  .distributor-table tr {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
  }

  .distributor-table td {
    border-bottom: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }

  .distributor-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 120px;
  }

  .distributor-table td[data-label="Mobile Number"] {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: 6px;
  }

  .data-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .data-actions {
    width: 100%;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Printable layout styling */
@media print {
  body {
    background: white;
    color: black;
  }
  
  header, .ambient-glow, .control-panel, .data-actions, .stats-section, footer, .modal-overlay {
    display: none !important;
  }
  
  .portal-main-grid {
    grid-template-columns: 1fr !important;
  }
  
  .data-panel {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  
  .distributor-table {
    font-size: 0.8rem;
  }
  
  .distributor-table th, .distributor-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #ccc !important;
  }
}

/* CORS Error Warning Card */
.cors-error-card {
  background: rgba(239, 68, 68, 0.04);
  border: 1px dashed #ef4444;
  border-radius: var(--radius-sm);
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.4s ease;
}

.cors-error-icon {
  font-size: 2.5rem;
  color: #ef4444;
}

.cors-error-card h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #b91c1c;
}

[data-theme="dark"] .cors-error-card h4 {
  color: #fca5a5;
}

.cors-error-card p {
  color: var(--text-muted);
  max-width: 500px;
  font-size: 0.92rem;
}

.cors-solutions {
  text-align: left;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius-sm);
  max-width: 550px;
  width: 100%;
}

.cors-solutions h5 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.cors-solutions ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  padding-left: 20px;
  list-style-type: disc;
}
