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

/* CSS Variables for Premium Theme */
:root {
  --font-primary: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-urdu: 'Noto Naskh Arabic', 'Jameel Noori Nastaleeq', sans-serif;
  
  --primary: #4f46e5;       /* Indigo */
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  --secondary: #0d9488;     /* Teal */
  --secondary-hover: #0f766e;
  --success: #10b981;       /* Emerald */
  --danger: #ef4444;        /* Rose */
  --warning: #f59e0b;       /* Amber */
  
  --bg-app: #f8fafc;        /* Soft Slate */
  --bg-card: rgba(255, 255, 255, 0.85);
  --border-color: #e2e8f0;
  
  --text-dark: #0f172a;     /* Deep Slate */
  --text-medium: #475569;
  --text-light: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.03);
  --shadow-premium: 0 20px 25px -5px rgba(79, 70, 229, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-app);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.03) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(13, 148, 136, 0.03) 0px, transparent 50%);
}

.urdu-text {
  font-family: var(--font-urdu);
  direction: rtl;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  overflow-x: hidden;
}

/* Glassmorphism Header */
header {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

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

.btn-secondary:hover {
  background: var(--bg-app);
  border-color: var(--text-light);
}

.btn-accent {
  background: linear-gradient(135deg, var(--secondary), #14b8a6);
  color: white;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.3);
}

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

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

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Accessibility Focus States */
.btn:focus-visible,
.filter-chip:focus-visible,
.auth-tab:focus-visible,
.sidebar-link:focus-visible,
.qty-btn:focus-visible,
.modal-close:focus-visible {
  outline: 3px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* Landing Page Hero Section */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-dark);
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-dark), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-medium);
  max-width: 600px;
  margin: 0 auto 30px;
}

/* Feature Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 50px;
}

/* Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  overflow: hidden;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  text-align: right;
  overflow: hidden;
  min-width: 0;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-premium);
  border-color: rgba(79, 70, 229, 0.3);
}

.feature-icon {
  width: 50px;
  height: 50px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-left: auto;
  margin-bottom: 20px;
}

.feature-card h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.feature-card p {
  color: var(--text-medium);
  font-size: 0.95rem;
}

/* Login/Registration Page Layout */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 40px 20px;
}

.auth-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-premium);
  width: 100%;
  max-width: 480px;
  padding: 40px;
  transition: var(--transition);
  animation: fadeIn 0.5s ease-out;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-medium);
}

/* Tab Switcher for login/register */
.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 30px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  font-weight: 500;
  border-radius: 8px;
  transition: var(--transition);
  color: var(--text-medium);
}

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

/* Forms styling */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-medium);
  text-align: right;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  outline: none;
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.input-prefix {
  display: flex;
}

.prefix {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-right: none;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-medium);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  font-size: 0.9rem;
}

.input-prefix .form-control {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-weight: 500;
  text-align: right;
  display: none;
}

.alert-danger {
  background-color: #fee2e2;
  color: #ef4444;
  border: 1px solid #fca5a5;
}

.alert-success {
  background-color: #ecfdf5;
  color: #10b981;
  border: 1px solid #6ee7b7;
}

/* Dashboard Panel Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  padding: 40px 0;
}

/* Prevent grid children from overflowing their tracks */
.dashboard-grid > * {
  min-width: 0;
  overflow: hidden;
}

.dashboard-sidebar {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 30px 20px;
  box-shadow: var(--shadow-md);
  height: fit-content;
}

.wholesaler-info {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 25px;
}

.wholesaler-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  font-weight: 700;
}

.wholesaler-info h3 {
  font-size: 1.15rem;
  margin-bottom: 5px;
}

.wholesaler-info p {
  font-size: 0.85rem;
  color: var(--text-medium);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-medium);
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.sidebar-link:hover, .sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Dashboard Main Content */
.dashboard-content {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.dashboard-content.active {
  display: block;
}

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

/* Dashboard Link Box */
.link-box {
  background: linear-gradient(135deg, #e0e7ff, #ccfbf1);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(79, 70, 229, 0.1);
  overflow: hidden;
}

.link-box-details {
  text-align: right;
}

.link-box-url {
  font-family: monospace;
  background: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-top: 5px;
  display: inline-block;
  direction: ltr;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Modal Dialogs */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 15px;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 600px;
  padding: 30px;
  animation: slideUp 0.3s ease-out;
}

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

.modal-close {
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
}

/* Product grid for dashboard */
.products-table-container {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}

.products-table {
  width: 100%;
  border-collapse: collapse;
}

.products-table th, .products-table td {
  padding: 16px 20px;
  text-align: right;
}

.products-table th {
  background: #f8fafc;
  color: var(--text-medium);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.products-table td {
  border-bottom: 1px solid var(--border-color);
}

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

.table-product-img {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* Image library selection in modal */
.image-library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  max-height: 160px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.image-library-item {
  width: 100%;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.image-library-item:hover, .image-library-item.selected {
  border-color: var(--primary);
  transform: scale(1.05);
}

/* Store / Showcase View Styles */
.store-hero {
  background: linear-gradient(135deg, #312e81, #0f766e);
  color: white;
  padding: 60px 0;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 40px;
}

.store-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.store-hero p {
  opacity: 0.85;
}

/* Toolbar & Search */
.store-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.search-box {
  width: 100%;
  max-width: 350px;
}

/* Category Filters */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
  align-items: center;
  justify-content: flex-end;
}

.filter-chip {
  padding: 8px 18px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 100px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.filter-chip:hover, .filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.desktop-chips, .mobile-category-dropdown {
  display: none;
}

/* Unified Category Dropdown Selector */
.category-dropdown-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 350px;
}

.category-select-wrapper {
  position: relative;
  flex: 1;
}

.category-select {
  width: 100%;
  padding: 10px 15px 10px 35px; /* RTL padding: left gets space for the absolute-positioned arrow icon */
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-family: var(--font-urdu), sans-serif;
  font-size: 1rem;
  background-color: white;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: var(--transition);
  font-weight: 600;
}

.category-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.category-select-wrapper::after {
  content: '▼';
  font-size: 0.75rem;
  color: var(--text-medium);
  position: absolute;
  left: 12px; /* absolute on the left because document dir is RTL */
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Retailer Product Card */
.store-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 100px; /* Space for floating cart */
}

.product-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(13, 148, 136, 0.2);
}

.product-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  text-align: right;
}

.product-card-category {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.product-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.product-card-desc {
  font-size: 0.85rem;
  color: var(--text-medium);
  margin-bottom: 15px;
  flex-grow: 1;
}

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

.product-card-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Quantity controls in card */
.qty-controls {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-medium);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.qty-input {
  width: 50px;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  outline: none;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Floating Cart Drawer */
.floating-cart {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  width: 90%;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(79, 70, 229, 0.15);
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 50px;
  padding: 8px 10px 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 500;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-cart.visible {
  transform: translateX(-50%) translateY(0);
}

.floating-cart-summary {
  text-align: right;
  line-height: 1.2;
}

.floating-cart-total {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

/* Invoice template modal styles */
.invoice-sheet {
  background: white;
  padding: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 25px;
}

.invoice-title {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 700;
}

.invoice-header-grid {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--bg-app);
}

.invoice-meta {
  text-align: left;
}

.invoice-parties {
  display: flex;
  justify-content: space-between;
  padding: 25px 0;
  border-bottom: 2px solid var(--bg-app);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 30px 0;
}

.invoice-table th {
  border-bottom: 2px solid var(--text-dark);
  padding: 12px 10px;
  font-weight: 700;
}

.invoice-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 12px 10px;
}

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

.invoice-total-row {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--bg-app);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  /* Dashboard layout stacking */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    padding: 20px 0 !important;
  }
  
  /* Dashboard Link Box mobile adjustments */
  .link-box {
    flex-direction: column-reverse !important;
    align-items: center !important;
    text-align: center !important;
    gap: 15px !important;
    padding: 20px 15px !important;
  }
  .link-box-details {
    text-align: center !important;
    width: 100% !important;
  }
  .link-box-url {
    font-size: 0.8rem !important;
    word-break: break-all !important;
    white-space: normal !important;
    display: block !important;
    margin-top: 10px !important;
    direction: ltr !important;
    text-align: center !important;
    background: #f8fafc !important;
    padding: 8px 12px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
  }
  .link-box button {
    width: 100% !important;
    max-width: 280px !important;
    margin: 0 auto !important;
  }

  /* Wholesaler Dashboard Category Chips horizontal scrolling */
  #dashCategoryFilters {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    gap: 8px !important;
    padding-bottom: 8px !important;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
    justify-content: flex-start !important;
  }
  #dashCategoryFilters::-webkit-scrollbar {
    display: none;
  }
  #dashCategoryFilters .filter-chip {
    padding: 8px 16px !important;
    font-size: 0.88rem !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  
  /* Sidebar menu horizontal scrolling */
  .dashboard-sidebar {
    padding: 20px 15px !important;
    margin-bottom: 20px !important;
  }
  .wholesaler-info {
    display: flex !important;
    align-items: center !important;
    text-align: right !important;
    gap: 15px !important;
    padding-bottom: 12px !important;
    margin-bottom: 15px !important;
    border-bottom: 1px solid var(--border-color) !important;
  }
  .wholesaler-avatar {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.3rem !important;
    margin: 0 !important;
  }
  .sidebar-menu {
    flex-direction: row !important;
    overflow-x: auto !important;
    padding-bottom: 8px !important;
    gap: 10px !important;
    white-space: nowrap !important;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
  }
  .sidebar-menu::-webkit-scrollbar {
    height: 4px;
  }
  .sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
  }
  .sidebar-link {
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  /* Responsive Grid Overrides */
  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 15px !important;
    margin-bottom: 25px !important;
  }

  /* Header adjustments */
  .header-container {
    padding: 0 10px;
  }
  
  /* Hero typography */
  .hero h1 {
    font-size: 2rem;
  }

  /* Content header stacking on mobile */
  .content-header {
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
    text-align: right !important;
  }
  .content-header h2 {
    font-size: 1.3rem !important;
    margin: 0 !important;
  }
  .content-header button {
    width: 100% !important;
  }

  /* Dashboard products list horizontal card layout on mobile */
  #dashProductsGrid {
    grid-template-columns: 1fr !important; /* Stack rows */
    gap: 15px !important;
    margin-bottom: 30px !important;
  }
  #dashProductsGrid .product-card {
    flex-direction: row !important;
    align-items: stretch !important;
    min-height: 180px !important;
    height: auto !important;
    background: white !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden !important;
    box-shadow: var(--shadow-sm) !important;
  }
  #dashProductsGrid .product-card-img-wrapper {
    width: 140px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    min-height: 180px !important;
  }
  #dashProductsGrid .product-card-img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
  }
  #dashProductsGrid .product-card-body {
    padding: 12px 14px !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    text-align: right !important;
    min-width: 0 !important;
  }
  #dashProductsGrid .product-card-title {
    font-size: 1rem !important;
    margin-bottom: 4px !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
  }
  #dashProductsGrid .product-card-category {
    font-size: 0.7rem !important;
    margin-bottom: 2px !important;
    display: block !important;
  }
  #dashProductsGrid .product-card-desc {
    display: none !important;
  }
  #dashProductsGrid .product-card-price {
    font-size: 1.05rem !important;
    margin-bottom: 8px !important;
  }
  #dashProductsGrid .product-card select {
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
    height: 32px !important;
    margin-bottom: 8px !important;
    line-height: 1 !important;
  }
  #dashProductsGrid .product-card .btn {
    padding: 6px !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Storefront enhancements */
  .store-hero {
    padding: 40px 0 !important;
    margin-bottom: 25px !important;
  }
  .store-hero h1 {
    font-size: 1.8rem !important;
  }
  .store-products-grid {
    gap: 20px !important;
    grid-template-columns: 1fr !important; /* Stack product cards on small screens */
  }

  /* Search and Toolbar */
  .search-box {
    max-width: 100% !important;
  }
  .store-toolbar {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 15px !important;
  }
  .filters-bar {
    justify-content: flex-start !important;
    width: 100%;
    padding-bottom: 5px;
  }
  
  /* Make category dropdown fill width on mobile */
  .category-dropdown-container {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Cart drawer scaling - Sleek compact floating pill */
  .floating-cart {
    flex-direction: row !important;
    gap: 8px !important;
    padding: 6px 8px 6px 16px !important;
    border-radius: 50px !important;
    bottom: 10px !important;
    width: 94% !important;
    max-width: 420px !important;
    justify-content: space-between !important;
  }
  .floating-cart .btn-lg {
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
    border-radius: 25px !important;
    white-space: nowrap !important;
  }
  .floating-cart-summary {
    text-align: left !important;
    line-height: 1.15 !important;
  }
  .floating-cart-summary small {
    font-size: 0.7rem !important;
  }
  .floating-cart-total {
    font-size: 1rem !important;
  }
  
  /* Invoice template layouts */
  .invoice-header-grid, .invoice-parties {
    flex-direction: column;
    gap: 15px;
    text-align: right !important;
  }
  .invoice-meta {
    text-align: right !important;
  }
  
  /* Table to Card conversion (Screen only, keeps print layouts intact) */
  @media screen {
    .products-table-container {
      border: none !important;
      box-shadow: none !important;
      background: transparent !important;
      overflow-x: visible !important;
    }
    .products-table, 
    .products-table thead, 
    .products-table tbody, 
    .products-table tr, 
    .products-table td, 
    .products-table th {
      display: block !important;
      width: 100% !important;
    }
    .products-table {
      min-width: auto !important; /* Overrides inline min-width of 800px on mobile */
    }
    .products-table thead {
      display: none !important;
    }
    .products-table tr {
      background: white !important;
      border: 1px solid var(--border-color) !important;
      border-radius: var(--radius-md) !important;
      margin-bottom: 15px !important;
      padding: 15px !important;
      box-shadow: var(--shadow-sm) !important;
      text-align: right !important;
    }
    .products-table td {
      border: none !important;
      border-bottom: 1px dashed var(--border-color) !important;
      padding: 12px 0 !important;
      display: flex !important;
      justify-content: space-between !important;
      align-items: flex-start !important;
      text-align: left !important;
      direction: ltr !important;
      min-height: 48px !important;
      gap: 15px !important;
      word-break: break-word !important;
      flex-wrap: wrap !important;
    }
    .products-table td:last-child {
      border-bottom: none !important;
      padding-bottom: 0 !important;
    }
    .products-table td::before {
      content: attr(data-label);
      font-weight: 700;
      color: var(--text-medium);
      font-family: var(--font-urdu);
      direction: rtl;
      text-align: right;
      margin-right: 10px;
      flex-shrink: 0;
      max-width: 50%;
    }
    /* Action button container spacing */
    .products-table td .btn, .products-table td a {
      margin-top: 2px !important;
      margin-bottom: 2px !important;
    }
  }

  /* Header navigation alignment */
  .header-container {
    flex-direction: column-reverse !important;
    height: auto !important;
    padding: 15px 10px !important;
    gap: 10px !important;
  }
  .logo {
    font-size: 1.25rem !important;
  }
  .nav-links {
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .nav-links .btn {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
  }
}

@media (max-width: 600px) {
  /* Modal responsive adjustments */
  .modal-card {
    padding: 20px 15px !important;
    border-radius: var(--radius-md) !important;
    width: 95% !important;
    max-width: 95% !important;
  }
  
  /* Stacking overrides for mobile layout */
  .settings-grid, .form-row-2col {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .image-library-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .invoice-sheet {
    padding: 15px 10px !important;
    margin-bottom: 15px !important;
  }
  .invoice-title {
    font-size: 1.5rem !important;
  }
  
  /* Keep stats in 2 columns on mobile for better visibility */
  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
  }
  .analytics-grid .feature-card {
    padding: 15px 10px !important;
  }
  
  /* Hero buttons stacking */
  .hero div[style*="flex"] {
    flex-direction: column !important;
    align-items: center !important;
  }
  .hero div[style*="flex"] a.btn {
    width: 100% !important;
    max-width: 320px !important;
  }
  
  /* Auth login/register page mobile responsiveness */
  .auth-wrapper {
    padding: 20px 10px !important;
    min-height: auto !important;
  }
  .auth-card {
    padding: 25px 15px !important;
    border-radius: var(--radius-md) !important;
  }
  .auth-header h2 {
    font-size: 1.4rem !important;
  }
  .auth-tabs {
    margin-bottom: 20px !important;
  }
  .auth-tab {
    padding: 8px 5px !important;
    font-size: 0.9rem !important;
  }
  #slugPreview {
    word-break: break-all !important;
    white-space: normal !important;
  }
}
/* Active state for storefront category filter buttons */
.btn-secondary.active-filter {
  background-color: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 6px var(--primary-light) !important;
}
.btn-secondary.active-filter:hover {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}/* Success Button styles */
.btn-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2) !important;
}
.btn-success:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3) !important;
}

/* ------------------- PRINT CSS ------------------- */
@media print {
  /* Hide everything except the invoice sheet */
  body * {
    visibility: hidden;
  }
  
  #invoiceModal, #invoiceModal * {
    visibility: visible;
  }
  
  #invoiceModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    background: white;
  }
  
  .modal-backdrop {
    background: white !important;
    position: relative !important;
    display: block !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
  }
  
  .modal-card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  /* Hide close button and action buttons */
  .modal-header .modal-close,
  .modal-card > div:last-child {
    display: none !important;
  }
  
  .invoice-sheet {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  
  /* Standardize margins and colors for printing */
  body {
    background: white !important;
    color: black !important;
  }
}
