:root {
  --primary: #6366f1;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --white: #ffffff;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Aliases for View Compatibility */
  --primary-color: var(--primary);
  --buyer-color: var(--info);
  --seller-color: var(--success);
  --collection-color: var(--warning);

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
  background-color: var(--slate-50);
  color: var(--slate-800);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Navbar */
.navbar {
  background: var(--primary-gradient) !important;
  padding: 1.25rem 0;
  box-shadow: var(--shadow-md);
  border: none;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}

.nav-link {
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: all 0.2s ease;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9) !important;
  background-color: transparent !important;
  border-radius: 0.5rem;
}

.nav-link:hover {
  opacity: 1;
  transform: translateY(-1px);
  color: white !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.nav-link:focus,
.nav-link:active {
  color: white !important;
  background-color: rgba(255, 255, 255, 0.15) !important;
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.nav-link.active {
  color: white !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
  opacity: 1;
}

/* Spacing between icons and text in nav links */
.nav-link i {
  margin-right: 0.1rem;
}



/* Page Header */
.page-header {
  margin: 3rem 0 2rem;
  border: none;
}

.page-header h1 {
  font-weight: 800;
  font-size: 2.5rem;
  letter-spacing: -0.05em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Stat Cards */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-card .stat-icon {
  width: 64px;
  height: 64px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-right: 1.25rem;
  background: var(--slate-100);
  color: var(--primary);
  transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-8deg);
  background: var(--primary);
  color: var(--white);
}

.stat-card .stat-content h5 {
  color: var(--slate-700);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.25rem;
}

.stat-card .stat-content p {
  font-size: 2rem;
  font-weight: 800;
  color: var(--slate-900);
  margin: 0;
}

/* Card Overrides */
.stat-card.success .stat-icon {
  color: var(--success);
}

.stat-card.success:hover .stat-icon {
  background: var(--success);
  color: var(--white);
}

.stat-card.warning .stat-icon {
  color: var(--warning);
}

.stat-card.warning:hover .stat-icon {
  background: var(--warning);
  color: var(--white);
}

.stat-card.info .stat-icon {
  color: var(--info);
}

.stat-card.info:hover .stat-icon {
  background: var(--info);
  color: var(--white);
}

.stat-card.danger .stat-icon {
  color: var(--danger);
}

.stat-card.danger:hover .stat-icon {
  background: var(--danger);
  color: var(--white);
}

/* Premium Dashboard Cards */
.admin-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
}

.admin-card .card-header {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 1.5rem;
}

.admin-card .card-header h5 {
  font-weight: 700;
  color: var(--slate-900);
  margin: 0;
}

/* Buttons */
.btn-premium {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-premium-primary {
  background: var(--primary-gradient);
  color: var(--white);
  border: none;
}

.btn-premium-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px -3px rgba(99, 102, 241, 0.4);
  color: var(--white);
}

/* Footer */
footer {
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}

footer h5 {
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--slate-900);
}

/* Progress Bar */
#nprogress {
  pointer-events: none;
}

#nprogress .bar {
  background: var(--white);
  position: fixed;
  z-index: 1031;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.loading-active #nprogress .bar {
  animation: load-progress 2s cubic-bezier(0.1, 0, 0.1, 1) forwards;
}

@keyframes load-progress {
  0% {
    width: 0%;
  }

  100% {
    width: 100%;
  }
}

/* Product Card Styles */
.product-card {
  height: 100%;
  min-height: 450px;
  max-height: 450px;
  transition: all 0.3s ease;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}


.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.product-card-img,
.product-image-container {
  width: 100%;
  height: 250px;
  min-height: 250px;
  max-height: 250px;
  overflow: hidden;
  background-color: var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.product-card-img img,
.product-card-img-img,
.card-img-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.product-card-body,
.product-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.875rem 0.875rem 1.5rem 0.875rem;
  gap: 0.5rem;
}



.product-card-title,
.product-card .card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  max-height: 2.8em;
  min-height: 2.8em;
}

/* Ensure links inside product card titles display correctly */
.product-card .card-title a,
.product-card-title a {
  color: var(--slate-900);
  text-decoration: none;
  display: inline;
  min-height: auto;
  min-width: auto;
}

.product-card .card-title a:hover,
.product-card-title a:hover {
  color: var(--primary);
  text-decoration: none;
}



.product-card .card-text {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 1.5em;
  text-align: left;
}

.product-rating {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.product-rating i {
  line-height: 1;
}

.product-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
  text-align: left;
}

.product-price .price {
  display: block;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.product-price .text-muted {
  font-size: 0.75rem;
  display: block;
  line-height: 1.2;
  font-weight: 400;
}

.product-stock {
  margin-bottom: 0.25rem;
  display: block;
  line-height: 1;
}


.product-stock .badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
  vertical-align: middle;
  text-align: center;
}

.badge.bg-success {
  background-color: #198754 !important;
  color: white !important;
}

.badge.bg-danger {
  background-color: #dc3545 !important;
  color: white !important;
}



.product-card .d-grid {
  margin-top: auto;
  gap: 0.5rem;
}

/* Ensure buttons after stock have proper spacing */
.product-stock+a.btn,
.product-stock+.d-grid {
  margin-top: 0.75rem;
}



/* Ensure consistent button sizing */
.product-card .btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  min-height: 38px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.product-card .btn i {
  flex-shrink: 0;
  font-size: 1rem;
}

.product-card .btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}


/* Hero Section */
.hero {
  background: var(--primary-gradient);
  color: white;
  text-align: center;
  padding: 4rem 0;
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.95;
}

.section-spacing {
  padding: 3rem 0;
}

/* ===== 508 COMPLIANCE & ACCESSIBILITY ===== */

/* Skip Navigation Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: var(--white);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 4px 0;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--warning);
  outline-offset: 2px;
}

/* Enhanced Focus Indicators for Keyboard Navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
.btn:focus,
.nav-link:focus,
.form-control:focus,
.form-select:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --primary: #0000ff;
    --slate-800: #000000;
    --slate-200: #000000;
  }

  .btn,
  .nav-link,
  a {
    text-decoration: underline;
  }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Improved Touch Targets (Minimum 44x44px) */
/* Only apply to specific interactive elements, not all links */
.btn,
button:not(.btn-close),
input[type="submit"],
input[type="button"] {
  min-height: 44px;
  padding: 0.5rem 1rem;
}

/* Checkboxes and radio buttons need different styling */
input[type="checkbox"],
input[type="radio"] {
  min-width: 20px !important;
  min-height: 20px !important;
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  cursor: pointer;
  flex-shrink: 0;
}

/* Form check styling */
.form-check {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 0;
  margin-bottom: 0;
}

.form-check-input {
  margin-top: 0 !important;
  margin-right: 0.5rem;
  margin-left: 0 !important;
  flex-shrink: 0;
  float: none !important;
  position: static !important;
}

.form-check-label {
  margin-bottom: 0 !important;
  cursor: pointer;
  user-select: none;
  padding-left: 0 !important;
}


/* Navigation links should have adequate touch targets */
.nav-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

/* Ensure buttons in forms have minimum size */
button[type="submit"],
button[type="button"] {
  min-height: 44px;
}

/* Exception for inline text links - keep them inline */
p a,
li a:not(.btn):not(.nav-link),
.card-title a,
a:not(.btn):not(.nav-link) {
  min-height: auto;
  min-width: auto;
  display: inline;
}

/* Screen Reader Only Content */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .page-header h1,
  .page-header h2 {
    font-size: 1.75rem;
  }

  .stat-card {
    margin-bottom: 1rem;
  }

  .product-card {
    min-height: 380px;
    max-height: 380px;
  }

  .product-card-img,
  .product-image-container {
    height: 200px;
    min-height: 200px;
    max-height: 200px;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }

  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  footer .col-md-4 {
    margin-bottom: 2rem;
  }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .hero h1 {
    font-size: 2.5rem;
  }

  .product-card {
    min-height: 400px;
    max-height: 400px;
  }

  .product-card-img,
  .product-image-container {
    height: 220px;
    min-height: 220px;
    max-height: 220px;
  }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .hero h1 {
    font-size: 2.75rem;
  }

  .stat-card .stat-icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  .stat-card .stat-content p {
    font-size: 1.75rem;
  }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
  }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .hero h1 {
    font-size: 3.5rem;
  }

  .hero p {
    font-size: 1.5rem;
  }
}

/* Print Styles for Accessibility */
@media print {

  .navbar,
  .skip-link,
  footer,
  .btn,
  #nprogress {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
  .hero {
    padding: 2rem 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .section-spacing {
    padding: 2rem 0;
  }
}

/* Dark Mode Support (Optional - respects user preference) */
@media (prefers-color-scheme: dark) {
  /* Uncomment to enable dark mode
  :root {
    --slate-50: #0f172a;
    --slate-100: #1e293b;
    --slate-200: #334155;
    --slate-800: #f1f5f9;
    --slate-900: #f8fafc;
  }

  body {
    background-color: var(--slate-50);
    color: var(--slate-800);
  }

  .card,
  .admin-card,
  .product-card {
    background-color: var(--slate-100);
    border-color: var(--slate-200);
  }
  */
}

/* Ensure images are responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Responsive tables */
@media (max-width: 767.98px) {
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Improved form accessibility */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border: 2px solid var(--slate-300);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 0;
}

/* Error states */
.is-invalid,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: var(--danger);
}

.invalid-feedback {
  display: block;
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Loading states */
.loading,
[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}