/**
 * MMMenu - Main Stylesheet
 * Mobile-first, Material Design-inspired
 */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */

:root {
  /* Colors (reference accent-colors.css for themeable colors) */
  --text-primary: #212121;
  --text-secondary: #616161;  /* Improved from #757575 for better contrast */
  --text-disabled: #9e9e9e;
  --text-inverse: #ffffff;
  
  --background-color: #fafafa;
  --surface-color: #ffffff;
  --divider-color: #e0e0e0;
  
  /* Semantic colors (WCAG AA compliant) */
  --error-color: #d32f2f;
  --error-bg: #ffebee;
  --success-color: #2e7d32;  /* Improved from #388e3c for better contrast */
  --success-bg: #e8f5e9;
  --warning-color: #f57c00;
  --warning-bg: #fff3e0;
  --info-color: #0277bd;  /* Improved from #0288d1 for better contrast */
  --info-bg: #e1f5fe;
  
  /* Button colors */
  --btn-primary-bg: var(--accent-color, #1976d2);
  --btn-primary-text: #ffffff;
  --btn-primary-hover: var(--accent-color-dark, #1565c0);
  --btn-secondary-bg: #f5f5f5;
  --btn-secondary-text: #424242;  /* Improved contrast */
  --btn-secondary-hover: #eeeeee;
  --btn-text-hover: rgba(0, 0, 0, 0.08);
  
  /* Focus ring (for accessibility) */
  --focus-ring: 0 0 0 3px rgba(25, 118, 210, 0.3);
  --focus-ring-error: 0 0 0 3px rgba(211, 47, 47, 0.3);
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-round: 50%;
  
  /* Shadows (Material Design elevation) */
  --shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-2: 0 3px 6px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12);
  --shadow-3: 0 10px 20px rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.10);
  --shadow-4: 0 14px 28px rgba(0,0,0,0.20), 0 5px 10px rgba(0,0,0,0.15);
  --shadow-5: 0 19px 38px rgba(0,0,0,0.25), 0 7px 15px rgba(0,0,0,0.18);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography */
  --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  
  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1060;
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================================
   ACCESSIBILITY - FOCUS RINGS
   ============================================================================ */

/* Remove default outline and add consistent focus rings */
*:focus {
  outline: none;
}

/* Focus-visible for keyboard navigation (respects :focus-visible when supported) */
*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Fallback for browsers without :focus-visible support */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[role="button"]:focus,
[tabindex]:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Don't show focus ring when clicked with mouse (only keyboard) */
*:focus:not(:focus-visible) {
  box-shadow: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================================================
   SHARED BUTTON CLASSES (DX Improvement)
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary button */
.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: var(--shadow-1);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--btn-primary-hover);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  box-shadow: var(--shadow-1);
  transform: translateY(0);
}

/* Secondary button */
.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--divider-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--btn-secondary-hover);
  border-color: var(--text-secondary);
}

/* Text button (no background) */
.btn-text {
  background-color: transparent;
  color: var(--accent-color, #1976d2);
  padding: 8px 16px;
}

.btn-text:hover:not(:disabled) {
  background-color: var(--btn-text-hover);
}

/* Icon button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-round);
}

.btn-icon .material-icons {
  font-size: 24px;
}

/* Button sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--font-size-lg);
}

/* Button with loading state */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: btn-spin 0.6s linear infinite;
  color: var(--btn-primary-text);
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

/* ============================================================================
   LAYOUT
   ============================================================================ */

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}

.main-content {
  flex: 1;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.app-header {
  position: sticky;
  top: 0;
  background: var(--surface-color);
  box-shadow: var(--shadow-1);
  z-index: var(--z-sticky);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  max-width: 1200px;
  margin: 0 auto;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.logo {
  height: 40px;
  width: auto;
}

.restaurant-name {
  font-size: var(--font-size-xl);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  position: relative;
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.icon-button:active {
  background: rgba(0, 0, 0, 0.1);
}

.icon-button .material-icons {
  font-size: 24px;
  color: var(--text-secondary);
}

.language-label {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 10px;
  font-weight: 700;
  background: var(--primary-color);
  color: var(--primary-contrast);
  padding: 2px 4px;
  border-radius: 2px;
}

.cart-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--error-color);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.button-primary {
  background: var(--primary-color);
  color: var(--primary-contrast);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-1);
  width: 100%;
}

.button-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-2);
}

.button-primary:active {
  transform: scale(0.98);
}

/* ============================================================================
   HERO SECTION
   ============================================================================ */

.hero {
  position: relative;
  height: 40vh;
  min-height: 280px;
  max-height: 500px;
  background: var(--gradient-primary);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  text-align: center;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--hero-overlay-color);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: var(--spacing-lg);
  max-width: 800px;
}

.hero-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  text-shadow: var(--hero-text-shadow);
}

.hero-subtitle {
  font-size: var(--font-size-lg);
  font-weight: 300;
  text-shadow: var(--hero-text-shadow);
  opacity: 0.95;
}

@media (min-width: 768px) {
  .hero {
    height: 50vh;
  }
  
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-subtitle {
    font-size: var(--font-size-xl);
  }
}

/* ============================================================================
   SEARCH BAR
   ============================================================================ */

.search-section {
  background: var(--surface-color);
  padding: var(--spacing-md) 0;
  box-shadow: var(--shadow-1);
}

.search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--background-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  transition: box-shadow var(--transition-fast);
}

.search-input-wrapper:focus-within {
  box-shadow: 0 0 0 2px var(--primary-alpha-30);
}

.search-icon {
  color: var(--text-secondary);
  margin-right: var(--spacing-sm);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--font-size-base);
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-clear {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.search-clear:hover {
  background: rgba(0, 0, 0, 0.04);
}

.search-clear .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}

/* ============================================================================
   CATEGORY TABS
   ============================================================================ */

.categories-nav {
  position: sticky;
  top: 64px;
  background: var(--surface-color);
  box-shadow: var(--shadow-1);
  z-index: calc(var(--z-sticky) - 1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Scroll snapping for smooth category selection */
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  position: relative;
}

.categories-nav::-webkit-scrollbar {
  display: none;
}

/* Fade edges to indicate scrollable content */
.categories-nav::before,
.categories-nav::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--transition-normal);
}

.categories-nav::before {
  left: 0;
  background: linear-gradient(to right, var(--surface-color) 0%, transparent 100%);
  opacity: 0;
}

.categories-nav::after {
  right: 0;
  background: linear-gradient(to left, var(--surface-color) 0%, transparent 100%);
}

.categories-nav.scroll-start::before {
  opacity: 0;
}

.categories-nav.scroll-end::after {
  opacity: 0;
}

.categories-nav.scroll-middle::before,
.categories-nav.scroll-middle::after {
  opacity: 1;
}

.categories-scroll {
  display: flex;
  padding: 0 var(--spacing-md);
  min-width: min-content;
}

.category-tab {
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  background: none;
  cursor: pointer;
  border-radius: 0;
  /* Scroll snap alignment */
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.category-tab:hover {
  color: var(--primary-color);
  background: var(--primary-alpha-10);
}

.category-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* ============================================================================
   FEATURED SECTION
   ============================================================================ */

.featured-section {
  padding: var(--spacing-lg) 0;
  margin-bottom: var(--spacing-md);
}

.featured-section .section-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.featured-section .section-title::before {
  content: '⭐';
  font-size: var(--font-size-xl);
}

.featured-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
  .featured-items-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   ATTRIBUTES LEGEND
   ============================================================================ */

.attributes-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  margin-bottom: var(--spacing-lg);
}

.attributes-legend-title {
  width: 100%;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.attributes-legend-title .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  background: var(--background-color);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.legend-item .material-icons {
  font-size: 18px;
}

.legend-item.vegetarian .material-icons {
  color: #4caf50;
}

.legend-item.vegan .material-icons {
  color: #8bc34a;
}

.legend-item.gluten-free .material-icons {
  color: #ff9800;
}

.legend-item.spicy .material-icons {
  color: #f44336;
}

.legend-item.seafood .material-icons {
  color: #2196f3;
}

/* ============================================================================
   FILTERS
   ============================================================================ */

.filters-section {
  padding: var(--spacing-md) 0;
}

.filters-container {
  display: flex;
  gap: var(--spacing-sm);
  overflow-x: auto;
  padding: var(--spacing-xs) 0;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius-xl);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.filter-chip:hover {
  border-color: var(--primary-color);
  background: var(--primary-alpha-10);
}

.filter-chip.selected {
  background: var(--primary-color);
  color: var(--primary-contrast);
  border-color: var(--primary-color);
}

.filter-chip .material-icons {
  font-size: 18px;
}

/* ============================================================================
   EMPTY STATES (UX Improvement)
   ============================================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xxl) var(--spacing-lg);
  text-align: center;
  min-height: 300px;
}

.empty-state .material-icons {
  font-size: 72px;
  color: var(--text-disabled);
  margin-bottom: var(--spacing-lg);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.empty-state-message {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: var(--spacing-lg);
  line-height: 1.6;
}

.empty-state .btn {
  margin-top: var(--spacing-md);
}

/* ============================================================================
   SKELETON LOADERS (UX Improvement)
   ============================================================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--divider-color) 0%,
    #f0f0f0 50%,
    var(--divider-color) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-product-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  animation: fadeIn 0.3s ease-in;
}

.skeleton-product-image {
  width: 100%;
  height: 200px;
  background: var(--divider-color);
}

.skeleton-product-content {
  padding: var(--spacing-md);
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--spacing-sm);
  border-radius: var(--radius-sm);
}

.skeleton-text.title {
  width: 80%;
  height: 20px;
  margin-bottom: var(--spacing-md);
}

.skeleton-text.subtitle {
  width: 60%;
}

.skeleton-text.price {
  width: 40%;
  height: 18px;
  margin-top: var(--spacing-md);
}

/* ============================================================================
   SECTIONS
   ============================================================================ */

.section {
  padding: var(--spacing-xl) 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.view-toggle {
  display: flex;
  gap: var(--spacing-xs);
}

.view-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  border: 1px solid var(--divider-color);
}

.view-button:hover {
  background: var(--primary-alpha-10);
  border-color: var(--primary-color);
}

.view-button.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.view-button.active .material-icons {
  color: var(--primary-contrast);
}

.view-button .material-icons {
  font-size: 20px;
  color: var(--text-secondary);
}

/* ============================================================================
   PRODUCTS GRID & CARDS
   ============================================================================ */

.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

@media (min-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.product-card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}

.product-card:hover {
  box-shadow: var(--shadow-3);
  transform: translateY(-4px);
}

.product-card:active {
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--divider-color);
  transition: transform var(--transition-slow);
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

/* Lazy loading image style */
.product-image[data-src] {
  opacity: 0.5;
  filter: blur(10px);
}

.product-image.loaded {
  opacity: 1;
  filter: blur(0);
  transition: opacity var(--transition-slow), filter var(--transition-slow);
}

.product-body {
  padding: var(--spacing-md);
}

.product-name {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
  line-height: 1.3;
}

.product-description {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-sm);
}

.product-price {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--primary-color);
}

.dietary-badges {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px var(--spacing-xs);
  background: var(--divider-color);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.vegan { background: #c8e6c9; color: #2e7d32; }
.badge.vegetarian { background: #fff9c4; color: #f57f17; }
.badge.gluten-free { background: #ffccbc; color: #d84315; }
.badge.spicy { background: #ffccbc; color: #d32f2f; }

/* List view */
.products-grid.list-view {
  grid-template-columns: 1fr;
}

.products-grid.list-view .product-card {
  display: flex;
  flex-direction: row;
}

.products-grid.list-view .product-image {
  width: 200px;
  height: 150px;
  flex-shrink: 0;
}

/* ============================================================================
   LOADING & EMPTY STATES
   ============================================================================ */

.loading-state,
.empty-state {
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-lg);
  color: var(--text-secondary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--divider-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--spacing-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-icon {
  font-size: 64px;
  color: var(--divider-color);
  display: block;
  margin-bottom: var(--spacing-md);
}

/* ============================================================================
   MODALS & DRAWERS
   ============================================================================ */

.modal,
.cart-drawer {
  position: fixed;
  z-index: var(--z-modal);
}

.modal {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.modal-overlay,
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  animation: fadeIn var(--transition-fast);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  background: var(--surface-color);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-5);
  animation: slideUp var(--transition-normal);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  z-index: 1;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.modal-close .material-icons {
  font-size: 24px;
  color: var(--text-secondary);
}

.modal-body {
  padding: var(--spacing-lg);
}

/* Cart Drawer */
.cart-drawer {
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 400px;
  background: var(--surface-color);
  box-shadow: var(--shadow-5);
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--transition-normal);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--divider-color);
}

.cart-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
}

/* ============================================================================
   EMPTY CART ILLUSTRATION (Pure CSS)
   ============================================================================ */

.cart-empty {
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-lg);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
}

.cart-empty-illustration {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto var(--spacing-md);
}

/* Shopping cart body */
.cart-empty-illustration::before {
  content: '';
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 80px;
  height: 60px;
  background: var(--divider-color);
  border-radius: var(--radius-md);
  border: 3px solid var(--text-disabled);
}

/* Cart handle */
.cart-empty-illustration::after {
  content: '';
  position: absolute;
  bottom: 60px;
  left: 30px;
  width: 60px;
  height: 30px;
  border: 3px solid var(--text-disabled);
  border-bottom: none;
  border-radius: 30px 30px 0 0;
}

/* Cart wheels */
.cart-wheel-left,
.cart-wheel-right {
  position: absolute;
  bottom: 5px;
  width: 16px;
  height: 16px;
  background: var(--text-disabled);
  border-radius: 50%;
  border: 2px solid var(--surface-color);
}

.cart-wheel-left {
  left: 30px;
}

.cart-wheel-right {
  right: 30px;
}

/* Empty indicator (dashed circle) */
.cart-empty-indicator {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border: 2px dashed var(--text-disabled);
  border-radius: 50%;
  opacity: 0.5;
  animation: cart-pulse 2s ease-in-out infinite;
}

@keyframes cart-pulse {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.6; transform: translateX(-50%) scale(1.1); }
}

.cart-empty-text {
  font-size: var(--font-size-lg);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.cart-empty-hint {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 250px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.cart-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--divider-color);
  background: var(--surface-color);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-md);
}

#cart-total-amount {
  color: var(--primary-color);
}

/* ============================================================================
   FLOATING CART (Mobile)
   ============================================================================ */

.floating-cart {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-round);
  background: var(--primary-color);
  color: var(--primary-contrast);
  box-shadow: var(--shadow-4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-fixed);
  transition: all var(--transition-fast);
}

.floating-cart:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-5);
}

.floating-cart:active {
  transform: scale(1.05);
}

.floating-cart .material-icons {
  font-size: 28px;
}

.floating-cart .cart-badge {
  top: -4px;
  right: -4px;
}

@media (min-width: 768px) {
  .floating-cart {
    display: none;
  }
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
  background: var(--surface-color);
  padding: var(--spacing-xxl) 0 var(--spacing-lg);
  margin-top: var(--spacing-xxl);
  border-top: 1px solid var(--divider-color);
}

.footer .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-xl);
}

@media (min-width: 768px) {
  .footer .container {
    grid-template-columns: repeat(3, 1fr);
  }
}

.footer-section {
  text-align: left;
}

.footer-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.footer-content {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.8;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer-links a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary-color);
}

.footer-bottom {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--divider-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.powered-by {
  margin-bottom: var(--spacing-xs);
}

.copyright {
  margin: 0;
}

/* ============================================================================
   DARK THEME
   ============================================================================ */

.dark-theme {
  /* Improved contrast for WCAG AA */
  --text-primary: #f5f5f5;  /* Improved from #e0e0e0 */
  --text-secondary: #b8b8b8;  /* Improved from #b0b0b0 */
  --text-disabled: #808080;  /* Improved from #757575 */
  --text-inverse: #121212;
  
  --background-color: #121212;
  --surface-color: #1e1e1e;
  --divider-color: #3a3a3a;  /* Improved from #2e2e2e */
  
  /* Button colors for dark mode */
  --btn-secondary-bg: #2a2a2a;
  --btn-secondary-text: #e8e8e8;
  --btn-secondary-hover: #353535;
  
  /* Focus ring for dark mode */
  --focus-ring: 0 0 0 3px rgba(66, 165, 245, 0.4);
  
  /* Semantic colors adjusted for dark mode */
  --error-bg: #3a1616;
  --success-bg: #1b3620;
  --warning-bg: #3d2816;
  --info-bg: #142938;
  
  /* Darker shadows for dark mode */
  --shadow-1: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
  --shadow-2: 0 3px 6px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.6);
  --shadow-3: 0 10px 20px rgba(0,0,0,0.6), 0 3px 6px rgba(0,0,0,0.7);
  --shadow-4: 0 14px 28px rgba(0,0,0,0.7), 0 5px 10px rgba(0,0,0,0.8);
  --shadow-5: 0 19px 38px rgba(0,0,0,0.8), 0 7px 15px rgba(0,0,0,0.9);
}

.dark-theme .skeleton {
  background: linear-gradient(
    90deg,
    #2a2a2a 0%,
    #333333 50%,
    #2a2a2a 100%
  );
  background-size: 200% 100%;
}

.dark-theme .icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dark-theme .icon-button:active {
  background: rgba(255, 255, 255, 0.12);
}

.dark-theme .category-tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dark-theme .search-input-wrapper {
  background: var(--surface-color);
}

.dark-theme .filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dark-theme .modal-close:hover,
.dark-theme .search-clear:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ============================================================================
   TOAST NOTIFICATIONS (UX Improvement)
   ============================================================================ */

.toast {
  position: fixed;
  bottom: var(--spacing-lg);
  left: 50%;
  transform: translateX(-50%);
  max-width: 500px;
  min-width: 320px;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--surface-color);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-4);
  z-index: var(--z-tooltip);
  animation: toast-slide-up 0.3s ease-out;
}

@keyframes toast-slide-up {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.toast .material-icons {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

.toast .btn {
  flex-shrink: 0;
}

.toast-success {
  border-left: 4px solid var(--success-color);
  background: var(--success-bg);
}

.toast-success .material-icons {
  color: var(--success-color);
}

.toast-error {
  border-left: 4px solid var(--error-color);
  background: var(--error-bg);
}

.toast-error .material-icons {
  color: var(--error-color);
}

.toast-warning {
  border-left: 4px solid var(--warning-color);
  background: var(--warning-bg);
}

.toast-warning .material-icons {
  color: var(--warning-color);
}

.toast-info {
  border-left: 4px solid var(--info-color);
  background: var(--info-bg);
}

.toast-info .material-icons {
  color: var(--info-color);
}

/* Toast on mobile */
@media (max-width: 768px) {
  .toast {
    left: var(--spacing-md);
    right: var(--spacing-md);
    transform: translateX(0);
    min-width: auto;
  }
  
  @keyframes toast-slide-up {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ============================================================================
   RTL SUPPORT
   ============================================================================ */

[dir="rtl"] .logo-container,
[dir="rtl"] .filter-chip {
  flex-direction: row-reverse;
}

[dir="rtl"] .search-icon {
  margin-right: 0;
  margin-left: var(--spacing-sm);
}

[dir="rtl"] .cart-badge,
[dir="rtl"] .language-label {
  right: auto;
  left: 4px;
}

[dir="rtl"] .cart-drawer {
  right: auto;
  left: 0;
  animation: slideInLeft var(--transition-normal);
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ============================================================================
   RESPONSIVE UTILITIES
   ============================================================================ */

@media (max-width: 767px) {
  .section-title {
    font-size: var(--font-size-xl);
  }
  
  .product-name {
    font-size: var(--font-size-base);
  }
  
  .product-price {
    font-size: var(--font-size-xl);
  }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus visible styles */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: var(--primary-contrast);
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  .app-header,
  .categories-nav,
  .filters-section,
  .floating-cart,
  .search-section {
    display: none;
  }
  
  .product-card {
    break-inside: avoid;
  }
}

