/* Frontend styles for Smart Restaurant Menu */
:root {
  --srm-accent-color: #c6b19b; /* Default accent color */
  --srm-title-color: #f0f0f0; /* Light color for titles on dark background */
  --srm-price-color: #f0f0f0; /* Light color for prices on dark background */
  --srm-excerpt-color: #cccccc; /* Lighter grey for descriptions */
  --srm-filter-btn-bg: #444;
  --srm-filter-btn-hover-bg: #555;
  --srm-filter-btn-active-bg: #c6b19b;
  --srm-filter-btn-active-color: #fff;
  --srm-item-gap: 28px;
  --srm-item-border-radius: 12px;
  --srm-item-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  --srm-item-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.srm-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  background-color: #2c2c2c; /* Dark background for the main wrapper */
  color: #f0f0f0; /* Default text color for the wrapper */
  padding: 20px; /* Add some padding around the wrapper */
  border-radius: var(--srm-item-border-radius); /* Match card border radius */
}
.srm-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
  background: #3a3a3a; /* Darker background for controls to match cards */
  padding: 16px; /* Consistent padding with cards */
  margin: var(--srm-filters-margin, 0 0 15px 0);
  height: var(--srm-filters-height, auto);
  border-radius: var(--srm-item-border-radius); /* Match card border radius */
  box-shadow: var(--srm-item-shadow); /* Use card shadow for consistency */
}
.srm-controls .srm-filters {
  gap: 12px; /* Slightly larger gap for filter buttons */
}
.srm-controls .srm-filters button {
  background: #444; /* Darker button background */
  color: var(--srm-title-color); /* Use light title color */
  border: 1px solid #555; /* Subtle border */
  padding: 8px 16px; /* Larger padding for buttons */
  border-radius: 8px; /* Slightly rounded buttons */
}
.srm-controls .srm-filters button:hover {
  background: #555; /* Darker hover background */
  border-color: #666;
}
.srm-controls .srm-filters button.active {
  background: var(--srm-accent-color); /* Accent color for active button */
  color: #fff;
  border-color: var(--srm-accent-color);
}
.srm-search {
  flex: 1;
  min-width: 220px;
}
.srm-search input[type="search"] {
  background-color: #444; /* Dark background for search input */
  color: var(--srm-title-color); /* Light text color */
  border: 1px solid #555; /* Subtle border */
  border-radius: 8px; /* Rounded corners */
  padding: 8px 16px;
}
.srm-search input[type="search"]::placeholder {
  color: #aaa; /* Lighter placeholder color */
}
.srm-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.srm-filters button {
  border: 1px solid transparent;
  background: var(--srm-filter-btn-bg, #fff);
  color: var(--srm-filter-btn-color, #333);
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease-in-out;
}
.srm-filters button:hover {
  background: var(--srm-filter-btn-hover-bg, #eee);
  color: var(--srm-filter-btn-hover-color, #111);
}
.srm-filters button.active {
  background: var(--srm-filter-btn-active-bg, #111);
  color: var(--srm-filter-btn-active-color, #fff);
  border-color: var(--srm-filter-btn-active-bg, #111);
}
.srm-grid {
  display: grid;
  gap: var(--srm-item-gap, 28px); /* Increased gap for better spacing */
}
/* Responsive Grid Layout */
@media (min-width: 1200px) {
  .srm-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on large screens */
  }
}
@media (min-width: 768px) and (max-width: 1199px) {
  .srm-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
  }
}
@media (max-width: 767px) {
  .srm-grid {
    grid-template-columns: 1fr; /* 1 column on small screens */
  }
  .srm-grid .srm-item {
    /* Prevent layout shifts on mobile */
    min-height: 280px; /* Minimum height to prevent layout jumps */
  }
  .srm-grid .srm-item img {
    /* Ensure consistent image height on mobile */
    height: 160px;
    max-height: 160px;
  }
  /* Improve touch targets on mobile */
  .srm-item-actions {
    gap: 12px;
    margin-top: 12px;
  }
  .srm-whatsapp-btn,
  .srm-add-to-cart {
    min-height: 44px; /* iOS/Android touch target size */
    min-width: 44px;
  }
}

/* Loading state for Ajax filtering */
.srm-loading {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}
.srm-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid rgba(198, 177, 155, 0.3);
  border-top: 4px solid var(--srm-accent-color, #c6b19b);
  border-radius: 50%;
  animation: srm-spin 1s linear infinite;
  z-index: 10;
}
.srm-loading.srm-grid::before {
  top: 20%;
}

/* Mobile-optimized loading: prevent interactions during loading */
.srm-loading-mobile {
  pointer-events: none;
  position: relative;
}

@keyframes srm-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.srm-grid .srm-item {
  border: none; /* Remove default border */
  border-radius: var(--srm-item-border-radius, 12px); /* Match wrapper radius */
  overflow: hidden;
  background: #3a3a3a; /* Darker background for cards */
  display: flex;
  flex-direction: column;
  box-shadow: var(
    --srm-item-shadow,
    0 4px 16px rgba(0, 0, 0, 0.2)
  ); /* Adjusted shadow */
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.srm-grid .srm-item:hover {
  box-shadow: var(
    --srm-item-hover-shadow,
    0 8px 24px rgba(0, 0, 0, 0.3)
  ); /* Adjusted hover shadow */
  transform: translateY(-2px);
}
.srm-grid .srm-item img {
  width: 100%;
  height: 160px; /* Keep image height consistent */
  object-fit: cover;
}
.srm-grid .srm-item .srm-content {
  padding: var(--srm-item-padding, 16px);
  flex: 1;
}
.srm-grid .srm-item .srm-title-price {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 10px;
}
@media (max-width: 480px) {
  .srm-grid .srm-item .srm-title-price {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
.srm-grid .srm-item .srm-title {
  font-weight: var(--srm-title-font-weight, 600);
  font-size: var(--srm-title-font-size, 18px);
  color: var(--srm-title-color); /* Use variable for title color */
  flex: 1;
  margin: 0;
}
.srm-grid .srm-item .srm-excerpt {
  color: var(--srm-excerpt-color); /* Use variable for excerpt color */
  margin-top: 6px; /* Add some space below title */
}
.srm-price {
  font-weight: var(--srm-price-font-weight, 700);
  font-size: var(--srm-price-font-size, 16px);
  color: var(--srm-price-color); /* Use variable for price color */
}
.srm-old-price {
  text-decoration: line-through;
  opacity: 0.6;
  margin-right: 6px;
}
.srm-new-price {
  color: var(--srm-price-color, #2d2d2d);
  font-weight: 800;
}
.srm-discount-badge {
  background: var(--srm-accent-color, #c6b19b);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}
.srm-badges {
  display: flex;
  gap: 6px;
}
.srm-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}
.srm-badge.special {
  background: #ffefc2;
  color: #8a5a00;
}
.srm-badge.oos {
  background: #ffe6e6;
  color: #a30000;
}
.srm-variants {
  margin-top: 6px;
}
.srm-variant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.srm-variant-label {
  font-weight: 600;
}
.srm-variant-price {
  margin-left: auto;
}
.srm-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.srm-whatsapp-right {
  margin-left: auto;
}

/* Add to Cart Button */
.srm-add-to-cart-btn,
.srm-add-to-cart {
  background: #fe0000c4;
  color: #eead13;
  border: none;
  border-radius: 50%;
  width: 31px;
  height: 31px;
  padding: 2px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(254, 0, 0, 0.2);
  position: relative;
  z-index: 10;
}

.srm-add-to-cart-btn:hover,
.srm-add-to-cart:hover {
  background: #d10000c4;
  transform: scale(1.1);
  color: #ffcc00;
  box-shadow: 0 4px 8px rgba(254, 0, 0, 0.3);
}

.srm-add-to-cart-btn:active,
.srm-add-to-cart:active {
  transform: scale(0.95);
}

/* Size variations - overridden by user's exact spec */
.srm-add-to-cart-btn.srm-size-small,
.srm-add-to-cart.srm-size-small {
  width: 31px;
  height: 31px;
  font-size: 14px;
}

.srm-add-to-cart-btn.srm-size-medium,
.srm-add-to-cart.srm-size-medium {
  width: 31px;
  height: 31px;
}

.srm-add-to-cart-btn.srm-size-large,
.srm-add-to-cart.srm-size-large {
  width: 36px;
  height: 36px;
  font-size: 16px;
}
.srm-whatsapp-btn {
  display: inline-block;
  background: #25d366;
  color: #fff !important;
  border-radius: 4px;
  text-decoration: none;
  position: relative;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.srm-whatsapp-btn:hover {
  background: #128c7e;
  transform: scale(1.05);
}
.srm-whatsapp-btn i {
  font-size: 14px;
}
/* WhatsApp button sizes */
.srm-whatsapp-btn.srm-size-small {
  padding: 4px 8px;
  font-size: 12px;
}
.srm-whatsapp-btn.srm-size-small i {
  font-size: 12px;
}
.srm-whatsapp-btn.srm-size-medium {
  padding: 6px 12px;
  font-size: 14px;
}
.srm-whatsapp-btn.srm-size-medium i {
  font-size: 14px;
}
.srm-whatsapp-btn.srm-size-large {
  padding: 8px 16px;
  font-size: 16px;
}
.srm-whatsapp-btn.srm-size-large i {
  font-size: 16px;
}
/* WhatsApp button styles */
.srm-whatsapp-btn.srm-style-text i {
  display: none;
}
.srm-whatsapp-btn.srm-style-icon {
  min-width: 32px;
  text-align: center;
}
.srm-whatsapp-btn.srm-style-icon:not(:empty) {
  min-width: auto;
}
.srm-whatsapp-btn::after {
  content: "Order now";
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out;
  white-space: nowrap;
}
.srm-whatsapp-btn:hover::after {
  opacity: 1;
}
.srm-list .srm-item {
  flex-direction: row;
  gap: 14px;
  align-items: center;
  border-radius: var(--srm-item-border-radius, 8px);
  box-shadow: var(--srm-item-shadow, 0 2px 8px rgba(0, 0, 0, 0.1));
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  padding: var(--srm-item-padding, 16px);
  margin-bottom: var(--srm-item-gap, 20px);
}
.srm-list .srm-item:hover {
  box-shadow: var(--srm-item-hover-shadow, 0 4px 16px rgba(0, 0, 0, 0.15));
  transform: translateY(-2px);
}
.srm-list .srm-item img {
  width: var(--srm-list-image-width, 120px);
  height: var(--srm-list-image-height, 80px);
  object-fit: cover;
  border-radius: 4px;
}
.srm-minimal .srm-item {
  border: none;
  border-bottom: 1px dashed #e1e1e1;
  border-radius: 0;
  padding: var(--srm-item-padding, 16px) 0;
  margin-bottom: var(--srm-item-gap, 20px);
  transition: background-color 0.3s ease;
}
.srm-minimal .srm-item:hover {
  background-color: #f9f9f9;
}
.srm-minimal .srm-item img {
  display: none;
}
.srm-minimal .srm-content {
  padding: 0;
}
.srm-minimal .srm-title {
  font-weight: var(--srm-title-font-weight, 600);
  font-size: var(--srm-title-font-size, 18px);
}
.srm-minimal .srm-excerpt {
  font-size: var(--srm-excerpt-font-size, 14px);
  color: var(--srm-excerpt-color, #666666);
}
.srm-cat-title {
  font-size: 1.1rem;
  margin: 18px 0 8px;
  font-weight: 700;
}

/* Floating Cart Button */
.srm-floating-cart-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 70px;
  height: 70px;
  background: #fe0000;
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 999;
  transition: all 0.3s ease;
  display: none; /* Hidden by default, shown when cart enabled */
}

.srm-floating-cart-btn:hover {
  background: #fe0000;
  transform: scale(1.1);
}

.srm-floating-cart-btn.active {
  background: #fbb615;
}

.srm-cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4757;
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid white;
}

/* Cart Sidebar */
.srm-cart-sidebar {
  position: fixed;
  bottom: 100px;
  left: 20px;
  width: 400px;
  max-height: 70vh;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 32px rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  border: 1px solid #f0f0f0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  overflow: hidden;
  transform: translatex(-106%) scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.srm-cart-sidebar.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.srm-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.srm-cart-header h3 {
  margin: 0;
  color: var(--srm-title-color, #7a5232);
  font-size: 18px;
  font-weight: 600;
}

.srm-cart-clear {
  background: var(--srm-accent-color, #c6b19b);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.srm-cart-clear:hover {
  background: #b5a08b;
}

.srm-cart-items {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.srm-cart-empty {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px 20px;
}

.srm-cart-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fafafa;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  position: relative;
}

.srm-cart-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.srm-cart-item:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--srm-accent-color, #c6b19b),
    #a08c70
  );
  border-radius: 12px 0 0 12px;
}

.srm-cart-item-info {
  flex: 1;
  min-width: 0;
}

.srm-cart-item-name {
  font-weight: 700;
  color: var(--srm-title-color, #7a5232);
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.srm-cart-item-variant {
  font-size: 13px;
  color: #888;
  background: #e8f4fd;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 500;
}

.srm-cart-item-price {
  font-weight: 700;
  color: var(--srm-price-color, #2d2d2d);
  font-size: 16px;
  display: block;
}

.srm-cart-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.srm-cart-item-quantity {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 20px;
  padding: 4px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.srm-cart-item-quantity button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--srm-accent-color, #c6b19b);
  transition: all 0.15s ease;
}

.srm-cart-item-quantity button:hover {
  background: rgba(198, 177, 155, 0.1);
  color: #a08c70;
  transform: scale(1.1);
}

.srm-cart-item-quantity button:active {
  transform: scale(0.95);
}

.srm-cart-item-quantity span {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  color: #333;
  padding: 0 8px;
}

.srm-cart-remove {
  background: #ffeaea;
  border: 1px solid #ffcccc;
  color: #ff4757;
  cursor: pointer;
  font-size: 18px;
  padding: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(255, 71, 87, 0.2);
}

.srm-cart-remove:hover {
  background: #ff4757;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.srm-cart-remove:active {
  transform: scale(0.95);
}

.srm-cart-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  background: #f8f9fa;
}

.srm-cart-total {
  display: block;
  font-weight: 700;
  font-size: 16px;
  color: var(--srm-price-color, #2d2d2d);
  margin-bottom: 15px;
}

.srm-cart-whatsapp-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: #25d366;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  transition: background 0.15s ease;
}

.srm-cart-whatsapp-btn:hover {
  background: #1da851;
}
