/* ==========================================================================
   CampusTrade — Core Design System & Styling
   Zero external dependencies / 100% Offline Compatible
   Primary: #4F46E5 | Secondary: #10B981 | Light/Dark Theme System
   ========================================================================== */

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --secondary: #10B981;
  --secondary-hover: #059669;
  --secondary-light: #ECFDF5;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --info: #3B82F6;
  
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;
  --border-color: #E2E8F0;
  --border-focus: #4F46E5;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --container-max: 1280px;
}

html.dark {
  --bg-main: #0F172A;
  --bg-card: #1E293B;
  --bg-input: #0B1120;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-inverse: #0F172A;
  --border-color: #334155;
  --border-focus: #818CF8;
  --primary-light: rgba(79, 70, 229, 0.22);
  --secondary-light: rgba(16, 185, 129, 0.18);
  --danger-light: rgba(239, 68, 68, 0.18);
  --warning-light: rgba(245, 158, 11, 0.18);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font: inherit;
}

select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Layout Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-icon svg {
  width: 1.75rem;
  height: 1.75rem;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Header Action Buttons & Icons */
.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 2.375rem;
  height: 2.375rem;
  padding: 0;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

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

.btn-icon svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  display: block !important;
  flex-shrink: 0;
}

/* Theme Toggle Dynamic Display */
.theme-toggle-btn .theme-icon-light {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}
.theme-toggle-btn .theme-icon-dark {
  display: none !important;
  align-items: center;
  justify-content: center;
  color: #FBBF24;
}
html.dark .theme-toggle-btn .theme-icon-light {
  display: none !important;
}
html.dark .theme-toggle-btn .theme-icon-dark {
  display: inline-flex !important;
  color: #FBBF24;
}

/* WebApp Download Button */
.webapp-download-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  background: var(--bg-card);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.webapp-download-btn:hover {
  background: var(--border-color);
  color: var(--primary);
  border-color: var(--primary);
}

/* Brand Logo Icon */
.brand-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-logo-icon svg {
  width: 1.75rem !important;
  height: 1.75rem !important;
  display: block !important;
}

/* Universal SVG Utility Classes for All Devices */
svg.w-3, .w-3 { width: 0.75rem !important; height: 0.75rem !important; min-width: 0.75rem; }
svg.w-4, .w-4 { width: 1rem !important; height: 1rem !important; min-width: 1rem; }
svg.w-5, .w-5 { width: 1.25rem !important; height: 1.25rem !important; min-width: 1.25rem; }
svg.w-6, .w-6 { width: 1.5rem !important; height: 1.5rem !important; min-width: 1.5rem; }
svg.w-7, .w-7 { width: 1.75rem !important; height: 1.75rem !important; min-width: 1.75rem; }
svg.w-8, .w-8 { width: 2rem !important; height: 2rem !important; min-width: 2rem; }
svg.w-10, .w-10 { width: 2.5rem !important; height: 2.5rem !important; min-width: 2.5rem; }
svg.w-12, .w-12 { width: 3rem !important; height: 3rem !important; min-width: 3rem; }

svg.h-3, .h-3 { height: 0.75rem !important; }
svg.h-4, .h-4 { height: 1rem !important; }
svg.h-5, .h-5 { height: 1.25rem !important; }
svg.h-6, .h-6 { height: 1.5rem !important; }
svg.h-7, .h-7 { height: 1.75rem !important; }
svg.h-8, .h-8 { height: 2rem !important; }
svg.h-10, .h-10 { height: 2.5rem !important; }
svg.h-12, .h-12 { height: 3rem !important; }

/* SVG Protection inside Buttons & Badges */
.btn svg {
  width: 1.125rem !important;
  height: 1.125rem !important;
  max-width: 1.25rem !important;
  max-height: 1.25rem !important;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.badge-fav svg {
  width: 1rem !important;
  height: 1rem !important;
  display: block;
}

/* Responsive adjustments for phone view - strictly stays under device display */
@media (max-width: 639px) {
  .nav-desktop-only {
    display: none !important;
  }
  .navbar-inner {
    height: 3.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    gap: 0.35rem;
  }
  .brand-link {
    font-size: 1rem;
    gap: 0.35rem;
  }
  .brand-link span:last-child {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand-logo-icon svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
  .nav-actions {
    gap: 0.35rem;
  }
  .btn-icon {
    width: 2rem !important;
    height: 2rem !important;
  }
  .btn-icon svg {
    width: 1rem !important;
    height: 1rem !important;
  }
  .webapp-download-btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
  }
  .webapp-download-btn svg {
    width: 0.875rem !important;
    height: 0.875rem !important;
  }
  .btn-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
  }
  .sell-btn-label {
    display: none;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5625rem 1.125rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.25;
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--secondary);
  color: #FFFFFF;
}

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

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

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

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

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

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

/* Normal, Professional WhatsApp Button */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--radius-md);
  background-color: #ECFDF5;
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}

.btn-whatsapp svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.btn-whatsapp:hover {
  background-color: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}

.dark .btn-whatsapp {
  background-color: rgba(16, 185, 129, 0.14);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

.dark .btn-whatsapp:hover {
  background-color: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}

/* Hero Header */
.hero-header {
  background: linear-gradient(135deg, #EEF2FF 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 3.5rem 1rem;
  text-align: center;
  transition: background 0.2s ease;
}

.dark .hero-header {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-main);
}

@media (max-width: 639px) {
  .hero-title {
    font-size: 1.875rem;
  }
}

.hero-gradient-text {
  background: linear-gradient(90deg, #4F46E5 0%, #10B981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 40rem;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}

/* Category Filter Chips Bar */
.category-bar-wrapper {
  position: sticky;
  top: 4.25rem;
  z-index: 40;
  background-color: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(8px);
  padding: 0.875rem 0;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s ease;
}

.dark .category-bar-wrapper {
  background-color: rgba(15, 23, 42, 0.95);
}

@media (max-width: 639px) {
  .category-bar-wrapper {
    top: 3.5rem;
    padding: 0.625rem 0;
  }
}

.category-chips {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

.chip.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}

html.dark .chip.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

/* Search and Filters Bar */
.search-filter-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.search-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: flex-end;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.5625rem 0.8125rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

/* Product Grid & Cards */
.product-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

@media (min-width: 580px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1180px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

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

.product-card-media {
  position: relative;
  height: 12.5rem;
  background-color: var(--border-color);
  overflow: hidden;
}

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

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

.badge-category {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  background: rgba(255, 255, 255, 0.95);
  color: #1E293B;
  backdrop-filter: blur(4px);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dark .badge-category {
  background: rgba(30, 41, 59, 0.95);
  color: #F8FAFC;
  border: 1px solid #334155;
}

.badge-fav {
  position: absolute;
  top: 0.625rem;
  left: 0.625rem;
  background: rgba(255, 255, 255, 0.9);
  color: #64748B;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.badge-fav:hover, .badge-fav.active {
  color: var(--danger);
  background: #FFFFFF;
}

.dark .badge-fav {
  background: rgba(30, 41, 59, 0.9);
  color: #94A3B8;
}

.dark .badge-fav.active {
  background: #1E293B;
  color: #EF4444;
}

.product-card-body {
  padding: 1.125rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card-body > :last-child {
  margin-top: auto;
}

.product-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.7rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.product-price {
  font-size: 1.375rem;
  font-weight: 900;
  color: var(--primary);
}

.product-original-price {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.product-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.product-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

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

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

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.125rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Alerts and Banners */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert-success {
  background-color: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.alert-danger {
  background-color: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-warning {
  background-color: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}

html.dark .alert-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

html.dark .alert-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.3);
}

html.dark .alert-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Footer */
.footer {
  margin-top: auto;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1rem 2rem;
  transition: background 0.2s ease;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.875rem;
  color: var(--text-main);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

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

.table th, .table td {
  padding: 0.8125rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background-color: var(--bg-main);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table td {
  color: var(--text-main);
}

.table tr:hover td {
  background-color: rgba(79, 70, 229, 0.04);
}

html.dark .table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-active { background: #ECFDF5; color: #065F46; }
.badge-pending { background: #FFFBEB; color: #92400E; }
.badge-sold { background: #F1F5F9; color: #475569; }
.badge-rejected, .badge-banned, .badge-suspended { background: #FEF2F2; color: #991B1B; }

html.dark .badge-active { background: rgba(16, 185, 129, 0.2); color: #34D399; }
html.dark .badge-pending { background: rgba(245, 158, 11, 0.2); color: #FBBF24; }
html.dark .badge-sold { background: #334155; color: #94A3B8; }
html.dark .badge-rejected, html.dark .badge-banned, html.dark .badge-suspended { background: rgba(239, 68, 68, 0.2); color: #F87171; }

/* Dashboard layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 240px 1fr;
  }
}

.sidebar-menu {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.sidebar-link svg {
  flex-shrink: 0;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* User Dropdown */
.user-dropdown-menu.open { display: block !important; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s ease;
}
.dropdown-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* ==========================================================================
   Large Text & Content Arrangement Protection (Never overflows layout)
   ========================================================================== */
*, *::before, *::after {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1, h2, h3, h4, h5, h6, p, span, a, label, div {
  word-break: break-word;
}

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

.table td, .table th {
  max-width: 280px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.product-card {
  min-width: 0;
}

/* ==========================================================================
   Progressive WebApp (PWA) — Standalone Display Mode Hiding
   When opened as an installed WebApp, NEVER show download prompts
   ========================================================================== */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .webapp-download-btn,
  .webapp-install-banner,
  #webappDownloadBtn,
  #webappInstallBanner {
    display: none !important;
  }
}

html.is-standalone-webapp .webapp-download-btn,
html.is-standalone-webapp .webapp-install-banner,
html.is-standalone-webapp #webappDownloadBtn,
html.is-standalone-webapp #webappInstallBanner {
  display: none !important;
}

/* ==========================================================================
   Interactive Toast Notification Engine
   ========================================================================== */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 25rem;
  width: calc(100% - 3rem);
  pointer-events: none;
}

@media (max-width: 639px) {
  #toast-container {
    top: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-width: 100%;
  }
}

.toast-item {
  pointer-events: auto;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.25s ease;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-item.toast-success {
  border-left: 4px solid var(--secondary);
}
.toast-item.toast-error {
  border-left: 4px solid var(--danger);
}
.toast-item.toast-warning {
  border-left: 4px solid var(--warning);
}
.toast-item.toast-info {
  border-left: 4px solid var(--primary);
}

.toast-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toast-success .toast-icon { color: var(--secondary); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--primary); }

.toast-message {
  flex: 1;
  line-height: 1.45;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
  flex-shrink: 0;
}
.toast-close:hover {
  color: var(--text-main);
}

@keyframes toastSlideIn {
  from {
    transform: translateY(-1rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

