:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --dark: #1e293b;
  --light: #f1f5f9;
  --white: #ffffff;
  --sidebar-width: 260px;
  --header-height: 70px;
  --border-radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f8fafc;
  color: var(--dark);
  line-height: 1.6;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: var(--white);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.logo {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 1.2rem;
  font-weight: 600;
}

.logo i {
  font-size: 1.5rem;
  color: var(--success);
}

.nav-links {
  list-style: none;
  padding: 15px 0;
}

.nav-links li {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  position: relative;
}

.nav-links li:hover {
  background: rgba(255,255,255,0.05);
}

.nav-links li.active {
  background: var(--primary);
}

.nav-links li i {
  width: 24px;
  text-align: center;
}

.badge {
  position: absolute;
  right: 15px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 20px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.top-bar h1 {
  font-size: 1.8rem;
  color: var(--dark);
}

.actions {
  display: flex;
  gap: 10px;
}

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

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

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

.btn-secondary {
  background: var(--light);
  color: var(--dark);
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

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

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

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

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

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

.btn-warning:hover {
  background: #d97706;
}

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

/* Pages */
.page {
  display: none;
}

.page.active {
  display: block;
}

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

.stat-card {
  background: white;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 15px;
}

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

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }

.stat-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
}

.stat-info p {
  color: var(--secondary);
  font-size: 0.9rem;
}

.stat-info small {
  color: #94a3b8;
  font-size: 0.8rem;
}

/* Cards */
.card {
  background: white;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card h3, .card h4 {
  margin-bottom: 15px;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

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

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.data-table td {
  font-size: 0.95rem;
}

/* Status Badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.processing {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.fulfilled,
.status-badge.paid,
.status-badge.active {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.cancelled,
.status-badge.out_of_stock {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.partial {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.low {
  background: #ffedd5;
  color: #9a3412;
}

/* Priority badges */
.priority-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.priority-badge.urgent {
  background: #fee2e2;
  color: #991b1b;
}

.priority-badge.high {
  background: #ffedd5;
  color: #9a3412;
}

.priority-badge.normal {
  background: #e0f2fe;
  color: #075985;
}

.priority-badge.low {
  background: #f3f4f6;
  color: #4b5563;
}

/* Page Actions */
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-group input,
.filter-group select {
  padding: 10px 15px;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
}

/* Order Stats */
.order-stats {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 500;
}

.stat-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.stat-pill.processing {
  background: #dbeafe;
  color: #1e40af;
}

.stat-pill.fulfilled {
  background: #d1fae5;
  color: #065f46;
}

.stat-pill .count {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 998;
}

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

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  max-height: 90vh;
  overflow-y: auto;
  width: 90%;
  max-width: 600px;
}

.modal.modal-large {
  max-width: 900px;
}

.modal.active {
  display: block;
}

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

.modal-header h2 {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.close-btn:hover {
  color: var(--dark);
}

.modal-body {
  padding: 20px;
}

/* Forms */
.form-group {
  margin-bottom: 15px;
  flex: 1;
}

.form-group.flex-2 {
  flex: 2;
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--dark);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

/* Sale/Order Items */
.sale-item-row,
.order-item-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  background: #f8fafc;
  border-radius: var(--border-radius);
}

.sale-item-row select,
.order-item-row select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius);
}

.sale-item-row input,
.order-item-row input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius);
  width: 100px;
}

.order-item-row .order-item-select {
  flex: 2;
}

.order-item-total {
  font-weight: 600;
  color: var(--primary);
  min-width: 80px;
  text-align: right;
}

.sale-totals,
.order-totals {
  margin-top: 20px;
  padding: 20px;
  background: #f8fafc;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2rem;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #e2e8f0;
}

.total-row.highlight {
  font-size: 1.4rem;
  color: var(--primary);
}

/* Order Details View */
.order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.order-info h3 {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.order-dates p {
  margin-bottom: 5px;
  color: var(--secondary);
}

.customer-info {
  margin-bottom: 20px;
}

.customer-info p {
  margin-bottom: 5px;
}

.order-summary {
  background: #f8fafc;
  padding: 20px;
  border-radius: var(--border-radius);
  margin: 20px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.summary-row.total {
  font-size: 1.2rem;
  font-weight: 700;
  border-top: 2px solid var(--dark);
  border-bottom: none;
  margin-top: 10px;
  padding-top: 15px;
}

/* Status Timeline */
#status-timeline {
  padding: 10px 0;
}

.timeline-item {
  display: flex;
  gap: 15px;
  padding: 10px 0;
  border-left: 2px solid #e2e8f0;
  padding-left: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-date {
  font-size: 0.85rem;
  color: var(--secondary);
  min-width: 150px;
}

.timeline-content {
  flex: 1;
}

.timeline-status {
  font-weight: 600;
}

/* Alerts */
.alert {
  padding: 15px;
  border-radius: var(--border-radius);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-info {
  background: #e0f2fe;
  color: #075985;
}

/* Activity List */
.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

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

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  color: var(--primary);
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 500;
}

.activity-meta {
  font-size: 0.85rem;
  color: var(--secondary);
}

/* Reports Grid */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

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

.report-stat {
  display: flex;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid #e2e8f0;
}

.report-stat:last-child {
  border-bottom: none;
}

.report-stat strong {
  font-size: 1.2rem;
  color: var(--dark);
}

.report-list {
  max-height: 300px;
  overflow-y: auto;
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

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

/* Empty state */
.empty {
  text-align: center;
  padding: 40px;
  color: var(--secondary);
}

/* Action buttons in tables */
.action-btns {
  display: flex;
  gap: 5px;
}

.action-btns .btn {
  padding: 6px 10px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 2px;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--secondary);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

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

/* Count Items */
.count-items-container {
  max-height: 500px;
  overflow-y: auto;
  margin: 20px 0;
}

.count-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8fafc;
  border-radius: var(--border-radius);
  margin-bottom: 10px;
}

.count-item-info {
  flex: 2;
}

.count-item-info .item-name {
  font-weight: 600;
}

.count-item-info .item-sku {
  font-size: 0.85rem;
  color: var(--secondary);
}

.count-item-expected {
  flex: 1;
  text-align: center;
}

.count-item-expected .label {
  font-size: 0.8rem;
  color: var(--secondary);
}

.count-item-expected .value {
  font-weight: 600;
}

.count-item-input {
  flex: 1;
}

.count-item-input input {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: var(--border-radius);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.count-item-input input:focus {
  border-color: var(--primary);
  outline: none;
}

.count-item-variance {
  flex: 1;
  text-align: center;
  font-weight: 600;
}

.count-item-variance.positive {
  color: var(--success);
}

.count-item-variance.negative {
  color: var(--danger);
}

.count-item-actions {
  flex: 1;
}

.count-item-actions button {
  width: 100%;
}

/* Schedule Fields */
.schedule-fields {
  padding: 15px;
  background: #f8fafc;
  border-radius: var(--border-radius);
  margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 70px;
  }
  
  .logo span,
  .nav-links li span {
    display: none;
  }
  
  .main-content {
    margin-left: 70px;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .page-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .filter-group {
    flex-wrap: wrap;
  }
  
  .order-stats {
    flex-wrap: wrap;
  }
}

/* Analytics Styles */
.weather-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.weather-main {
  text-align: center;
  padding: 30px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: var(--border-radius);
  color: white;
}

.weather-main .temp {
  font-size: 4rem;
  font-weight: 700;
}

.weather-main .condition {
  font-size: 1.2rem;
  margin-top: 10px;
}

.weather-detail {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: #f8fafc;
  border-radius: var(--border-radius);
}

.weather-detail i {
  font-size: 2rem;
  color: var(--primary);
}

.weather-detail .label {
  font-size: 0.85rem;
  color: var(--secondary);
}

.weather-detail .value {
  font-size: 1.3rem;
  font-weight: 600;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  padding: 20px 0;
}

.forecast-day {
  text-align: center;
  padding: 15px;
  background: #f8fafc;
  border-radius: var(--border-radius);
}

.forecast-day .day-name {
  font-weight: 600;
  color: var(--dark);
}

.forecast-day .temp-range {
  margin-top: 10px;
  font-size: 0.9rem;
}

.forecast-day .temp-high {
  color: var(--danger);
}

.forecast-day .temp-low {
  color: var(--info);
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: var(--border-radius);
}

.insight-card.success {
  background: #d1fae5;
}

.insight-card.warning {
  background: #fef3c7;
}

.insight-card.danger {
  background: #fee2e2;
}

.insight-card i {
  font-size: 1.5rem;
}

.price-trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.price-trend.up {
  color: var(--success);
}

.price-trend.down {
  color: var(--danger);
}

.price-trend.stable {
  color: var(--secondary);
}

.market-alert {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-alert.info {
  background: #e0f2fe;
  color: #075985;
}

.market-alert.success {
  background: #d1fae5;
  color: #065f46;
}

.market-alert.warning {
  background: #fef3c7;
  color: #92400e;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--secondary);
}

/* Payment Method Styles */
.payment-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.payment-method-btn {
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius);
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.payment-method-btn:hover {
  border-color: var(--primary);
}

.payment-method-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.payment-method-btn i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.payment-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.payment-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.payment-status.completed {
  background: #d1fae5;
  color: #065f46;
}

.payment-status.failed {
  background: #fee2e2;
  color: #991b1b;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ============================================ */

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background: var(--primary);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .sidebar {
    width: var(--sidebar-width);
  }

  .main-content {
    margin-left: var(--sidebar-width);
    padding: 15px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
    gap: 15px;
  }

  .form-row .form-group {
    min-width: 100%;
  }

  .page-actions {
    flex-direction: column;
    gap: 10px;
  }

  .filter-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .filter-group input,
  .filter-group select {
    flex: 1;
    min-width: 120px;
  }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: var(--sidebar-width);
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 70px 15px 15px;
  }

  .top-bar {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--white);
  }

  .top-bar h1 {
    font-size: 1.3rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .stat-info h3 {
    font-size: 1.3rem;
  }

  .admin-grid,
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .admin-card {
    padding: 20px;
  }

  .card {
    padding: 15px;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

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

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 3px;
  }

  .tab-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .modal {
    width: 95%;
    max-width: 95%;
    margin: 20px auto;
  }

  .modal-large {
    width: 95%;
  }

  .modal-header {
    padding: 15px 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .form-group {
    margin-bottom: 15px;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .weather-display {
    grid-template-columns: repeat(2, 1fr);
  }

  .weather-main {
    grid-column: span 2;
    padding: 20px;
  }

  .weather-main .temp {
    font-size: 3rem;
  }

  .forecast-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .permission-tree {
    max-height: 300px;
  }

  .count-item {
    flex-direction: column;
    gap: 10px;
  }

  .count-item-info,
  .count-item-expected,
  .count-item-input,
  .count-item-variance,
  .count-item-actions {
    flex: none;
    width: 100%;
    text-align: left;
  }

  .user-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .role-badges {
    justify-content: flex-start;
  }

  .page-actions {
    padding: 10px 0;
  }

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

  .actions {
    width: 100%;
    justify-content: flex-end;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-card {
    padding: 15px;
  }

  .summary-card .icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .summary-card .value {
    font-size: 1.4rem;
  }

  .analytics-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .top-bar h1 {
    font-size: 1.1rem;
  }

  .logo {
    font-size: 1rem;
    padding: 15px;
  }

  .nav-links li {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 10px;
  }

  .form-actions .btn {
    width: 100%;
  }

  .permission-list {
    margin-left: 15px;
  }

  .permission-item {
    font-size: 0.85rem;
  }

  .role-card .role-header {
    flex-direction: column;
    gap: 10px;
  }

  .role-card .role-actions {
    flex-direction: column;
  }

  .role-card .role-actions .btn {
    width: 100%;
  }

  .order-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card {
    text-align: center;
  }

  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
  }

  .insight-card {
    padding: 12px;
  }

  .weather-display {
    grid-template-columns: 1fr;
  }

  .weather-main {
    grid-column: span 1;
  }
}

/* Touch-friendly improvements */
@media (hover: none) {
  .nav-links li:hover {
    background: transparent;
  }

  .nav-links li:active {
    background: rgba(255,255,255,0.1);
  }

  .btn:hover {
    transform: none;
  }

  .btn:active {
    transform: scale(0.98);
  }

  .admin-card:hover {
    transform: none;
  }

  .data-table tr:hover {
    background: transparent;
  }

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

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar {
    overflow-y: auto;
  }

  .nav-links {
    padding: 10px 0;
  }

  .nav-links li {
    padding: 8px 15px;
  }

  .modal {
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* Optional: Add dark mode styles here */
}

/* Print styles */
@media print {
  .sidebar,
  .mobile-menu-toggle,
  .top-bar .actions,
  .page-actions {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
