/* CSS Reset and Global Styles */
:root {
  --bg: #090d16;
  --bg-sidebar: #0f1626;
  --bg-card: #141c2f;
  --bg-input: #0b0f19;
  
  --accent: #10b981; /* Emerald Green */
  --accent-glow: rgba(16, 185, 129, 0.2);
  --accent-hover: #34d399;
  
  --border: rgba(255, 255, 255, 0.05);
  --border-focus: rgba(16, 185, 129, 0.4);
  
  --text: #f8fafc;
  --text-muted: #64748b;
  --text-active: #ffffff;
  
  --pending: #f59e0b; /* Amber */
  --processing: #3b82f6; /* Blue */
  --shipped: #8b5cf6; /* Purple */
  --completed: #10b981; /* Green */
  --cancelled: #ef4444; /* Red */
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Hind Siliguri', 'Inter', sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-sidebar);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  font-size: 24px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-text {
  font-family: 'Noto Serif Bengali', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.sidebar-menu {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.menu-item {
  width: 100%;
  background: none;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.menu-item svg {
  transition: var(--transition);
}

.menu-item:hover, .menu-item.active {
  color: var(--text-active);
  background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
  background-color: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.menu-item.active svg {
  stroke: var(--accent);
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.btn-logout {
  width: 100%;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 8px;
  padding: 10px;
  color: #ef4444;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-logout:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Main Content Layout */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 40px;
  min-height: 100vh;
  transition: var(--transition);
}

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

.content-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-active);
}

.datetime {
  font-size: 14px;
  color: var(--text-muted);
}

/* Toast Message */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background-color: var(--accent);
  color: var(--bg);
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background-color: var(--cancelled);
  color: white;
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* KPI Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.revenue-icon { background: rgba(16, 185, 129, 0.1); color: var(--accent); }
.orders-icon { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.pending-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.completed-icon { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.abandoned-icon { background: rgba(148, 163, 184, 0.1); color: #94a3b8; }

.stat-info h3 {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-info p {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-active);
}

/* Recent Orders Section */
.recent-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title h2 {
  font-size: 18px;
  font-weight: 600;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Data Table Styling */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.loading-td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
}

.no-orders-td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge.pending { background: rgba(245, 158, 11, 0.1); color: var(--pending); }
.badge.processing { background: rgba(59, 130, 246, 0.1); color: var(--processing); }
.badge.shipped { background: rgba(139, 92, 246, 0.1); color: var(--shipped); }
.badge.completed { background: rgba(16, 185, 129, 0.1); color: var(--completed); }
.badge.cancelled { background: rgba(239, 68, 68, 0.1); color: var(--cancelled); }
.badge.abandoned { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px dashed rgba(148, 163, 184, 0.4); }

/* Orders Toolbar */
.orders-toolbar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.search-box {
  flex: 1;
}

.search-box input {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-box select {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.filter-box select:focus {
  border-color: var(--accent);
}

/* Status Change Dropdown inside table */
.select-status {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.select-status:focus {
  border-color: var(--accent);
}

/* Action Buttons */
.btn-delete {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 6px;
  color: var(--cancelled);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-delete:hover {
  background: var(--cancelled);
  color: white;
}

/* Editor Cards */
.editor-section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  background-color: rgba(255, 255, 255, 0.01);
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-active);
}

.card-body {
  padding: 24px;
}

/* Forms Grid */
.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-col-12 { flex: 0 0 100%; }
.form-col-6 { flex: 0 0 calc(50% - 10px); }
.form-col-4 { flex: 0 0 calc(33.33% - 13.3px); }

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.editor-input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.editor-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.editor-textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  resize: vertical;
  transition: var(--transition);
}

.editor-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Upload input group */
.upload-group {
  display: flex;
  gap: 10px;
}

.upload-group input {
  flex: 1;
}

.upload-btn {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  color: var(--text-active);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.upload-btn:hover {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--accent);
}

.upload-btn input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.upload-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* Editor actions */
.editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn-save {
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-save:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

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

.form-group-block {
  margin-bottom: 20px;
}

.form-group-block label span {
  color: var(--cancelled);
}

/* Responsive adjustments */
/* Mobile Header Bar */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 85;
}

.btn-menu-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Noto Serif Bengali', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.mobile-profile {
  width: 32px;
  height: 32px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

/* Sidebar mobile backdrop overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -260px; /* Hide completely offscreen */
    width: 260px;
    height: 100vh;
    z-index: 100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  body.sidebar-open .sidebar {
    left: 0; /* Slide in drawer */
  }

  .main-content {
    margin-left: 0;
    padding: 84px 20px 24px 20px; /* Give room for mobile header */
  }

  .mobile-header {
    display: flex; /* Show mobile header */
  }
}

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 16px;
  }
  .form-col-6, .form-col-4 {
    flex: 0 0 100%;
  }
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
  }
  .content-header h1 {
    font-size: 22px;
  }
  .orders-toolbar {
    flex-direction: column;
    gap: 12px;
  }
  .orders-toolbar > div {
    width: 100%;
  }
  .orders-toolbar .search-box input,
  .orders-toolbar .filter-box select,
  .orders-toolbar .export-box button {
    width: 100%;
  }
  .recent-section {
    padding: 16px;
  }
  .editor-section-card {
    margin-bottom: 16px;
  }
  .card-body, .card-header {
    padding: 16px;
  }
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  /* Tables horizontal scroll prevention */
  .table-container {
    -webkit-overflow-scrolling: touch;
  }
  .table-container .data-table {
    min-width: 900px;
  }

  /* Tap targets for mobile screens */
  .btn-save, .btn-logout, .upload-btn, .editor-input, .editor-textarea, .filter-box select {
    padding: 14px 20px;
    font-size: 15px;
  }
  .btn-action-icon {
    min-width: 38px;
    min-height: 38px;
    padding: 10px;
    border-radius: 8px;
  }
  .order-actions-cell {
    gap: 12px;
  }
  .btn-delete {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }
  .editor-actions {
    margin-top: 20px;
  }
  .editor-actions .btn-save {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }
  .stats-grid:nth-of-type(1) > .stat-card:last-child {
    grid-column: span 2;
  }
  .stat-card {
    padding: 12px;
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
    border-radius: 8px;
  }
  .stat-info h3 {
    font-size: 11px;
    margin-bottom: 2px;
  }
  .stat-info p {
    font-size: 16px;
  }

  /* File upload layout optimization */
  .upload-group {
    flex-direction: column;
    gap: 8px;
  }
  .upload-btn {
    width: 100%;
  }
}

@media (max-width: 350px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid:nth-of-type(1) > .stat-card:last-child {
    grid-column: span 1;
  }
}

/* New Admin Upgrades Styling */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
.analytics-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.analytics-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-active);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.analytics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.analytics-item {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}
.analytics-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.analytics-item-name {
  color: var(--text);
  font-weight: 500;
}
.analytics-item-value {
  font-weight: 700;
  color: var(--accent);
}
.analytics-bar-bg {
  background: rgba(255, 255, 255, 0.05);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.analytics-bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 3px;
}

/* Quick Action Icons */
.btn-action-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}
.btn-whatsapp { color: #25d366; }
.btn-whatsapp:hover { background: rgba(37, 211, 102, 0.1); }
.btn-call { color: #3b82f6; }
.btn-call:hover { background: rgba(59, 130, 246, 0.1); }
.btn-print { color: var(--accent); }
.btn-print:hover { background: rgba(16, 185, 129, 0.1); }
.order-actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

