* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Arial', sans-serif;
}

body {
  background-color: #f5f5f5;
  padding-top: 280px; /* Increased padding to prevent content from being hidden */
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background-color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}

#logo-img {
  width: 150px;
  height: 150px;
  border-radius: 40%;
  object-fit: contain;
  margin: 10px 0;
}

.header-icons {
  display: flex;
  align-items: center;
  min-width: 60px;
}

.header-icons.left {
  justify-content: center;
  margin-right: 40px;
  padding-left: 20px;
}

.header-icons.right {
  justify-content: center;
  margin-left: 40px;
  padding-right: 20px;
}

.cart-icon, .order-history-icon {
  font-size: 24px;
  cursor: pointer;
  color: #ff7700;
  margin: 0 10px;
  position: relative;
}

#cart-count, #order-history-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #008f39;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.category-nav {
  display: flex;
  justify-content: space-around;
  padding: 10px 20px;
  background-color: #ff7700;
  margin: 10px 20px;
  border-radius: 30px;
  width: calc(100% - 40px);
  position: fixed;
  top: 210px; /* Increased top position to avoid header overlap */
  left: 0;
  z-index: 99;
}

.category-btn {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 20px;
  transition: background-color 0.3s;
}

.category-btn.active {
  background-color: #f86707;
  font-weight: bold;
}

#menu-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px;
}

.menu-item {
  background-color: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.menu-item:hover {
  transform: translateY(-5px);
}

.item-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #f0f0f0;
  transform: translateZ(0);
  will-change: transform;
}

@media (max-width: 768px) {
  .item-image {
    height: 150px;
    width: 100%;
  }
}

.item-details {
  padding: 15px;
}

.item-name {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 5px;
}

.item-description {
  color: #666;
  font-size: 14px;
  margin-bottom: 10px;
}

.item-price {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 15px;
  color: #333;
}

.add-to-cart-btn {
  background-color: #008f39;
  color: white;
  border: none;
  padding: 10px 0;
  width: 100%;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
}

.add-to-cart-btn:hover {
  background-color: #006428;
}

#cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 350px;
  height: 100%;
  background-color: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s;
}

#cart-sidebar.hidden {
  transform: translateX(100%);
}

#cart-items {
  margin: 20px 0;
}

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

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: bold;
}

.cart-item-price {
  color: #666;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
}

.quantity-btn {
  background-color: #eee;
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
}

.quantity-number {
  margin: 0 10px;
}

#item-options-container {
  margin: 20px 0;
}

.option-row {
  display: flex;
  align-items: center;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.option-row input[type="radio"] {
  margin-right: 10px;
}

.option-price {
  margin-left: auto;
  font-weight: bold;
}

#add-with-options-btn {
  width: 100%;
  margin-top: 20px;
}

.cart-item-remove {
  color: #ff0000;
  cursor: pointer;
  margin-left: 10px;
}

.cart-summary {
  margin: 20px 0;
}

.subtotal, .tax, .total {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.total {
  font-weight: bold;
  font-size: 18px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
}

.order-notes {
  margin: 20px 0;
}

.order-notes label {
  display: block;
  margin-bottom: 5px;
}

#order-notes-input {
  width: 100%;
  height: 80px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  resize: none;
}

#checkout-btn {
  width: 100%;
  padding: 15px;
  background-color: #008f39;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
}

#checkout-btn:hover {
  background-color: #006428;
}

#close-cart-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

.modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

#map {
  height: 200px;
  width: 100%;
  margin: 10px 0;
  border-radius: 5px;
  background-color: #eee;
  z-index: 0; /* Ensures the map doesn't overlay other elements */
  position: relative;
}

/* Fix for Leaflet controls */
.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  z-index: 999;
}

/* Location message styles */
.location-message {
  margin: 5px 0;
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
}

.location-success {
  background-color: #e8f5e9;
  border: 1px solid #4caf50;
  color: #2e7d32;
}

.location-error {
  background-color: #ffebee;
  border: 1px solid #f44336;
  color: #c62828;
}

.location-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 15px;
  border-radius: 5px;
  z-index: 1000;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#place-order-btn {
  width: 100%;
  padding: 15px;
  background-color: #008f39;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
}

#place-order-btn:hover {
  background-color: #006428;
}

#invoice-content {
  text-align: center;
}

#invoice-details {
  margin: 20px 0;
  text-align: left;
}

#invoice-items {
  margin: 20px 0;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 10px 0;
  text-align: left;
}

.invoice-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

#invoice-summary {
  margin: 20px 0;
  text-align: right;
}

.invoice-footer {
  margin-top: 30px;
}

.order-type-options {
  display: flex;
  gap: 20px;
  margin-top: 5px;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  margin-right: 8px;
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #008f39;
  border-radius: 50%;
  outline: none;
  position: relative;
}

.radio-label input[type="radio"]:checked::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background-color: #008f39;
  border-radius: 50%;
}

.radio-label span {
  font-size: 16px;
}

.error-message {
  color: #dc3545;
  font-size: 12px;
  margin-top: 5px;
  display: block;
}

.payment-info {
  margin: 20px 0;
  padding: 15px;
  border: 1px dashed #008f39;
  border-radius: 5px;
  background-color: #f9f9f9;
}

.payment-method {
  font-weight: bold;
  margin-bottom: 10px;
}

.payment-upload {
  margin: 15px 0;
}

.payment-upload label {
  display: block;
  margin-bottom: 10px;
}

.hidden-upload {
  display: none;
}

.upload-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #008f39;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.upload-btn:hover {
  background-color: #006428;
}

.payment-buttons {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  justify-content: center;
}



.payment-preview {
  margin-top: 15px;
  text-align: center;
  display: none;
}

.payment-preview img {
  max-width: 100%;
  max-height: 300px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

#print-invoice-btn, #payment-done-btn {
  padding: 10px 20px;
  background-color: #008f39;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin: 5px;
  display: inline-block;
}

#print-invoice-btn:hover, #payment-done-btn:hover {
  background-color: #006428;
}

.invoice-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  text-align: center;
}

.invoice-footer p {
  margin-bottom: 15px;
  font-weight: bold;
}

.invoice-footer .button-group {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Order History Styles */
#order-history-list {
  max-height: 400px;
  overflow-y: auto;
}

.order-history-item {
  padding: 15px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.order-history-item:hover {
  background-color: #f5f5f5;
}

.order-history-header {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin-bottom: 10px;
}

.order-history-details {
  color: #666;
  font-size: 0.9em;
}

#no-orders-message {
  text-align: center;
  color: #666;
  padding: 20px;
}

@media (max-width: 768px) {
  body {
    padding-top: 240px; /* Increased padding for mobile to prevent overlap */
  }
  
  .category-nav {
    flex-wrap: wrap;
    padding: 10px;
    margin: 10px;
    top: 170px; /* Increased position to avoid header overlap on mobile */
  }

  .category-btn {
    font-size: 14px;
    padding: 8px 12px;
    margin: 2px;
  }

  #menu-container {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px;
  }

  #cart-sidebar {
    width: 100%;
  }

  .item-image {
    height: 150px;
  }

  .item-details {
    padding: 10px;
  }

  .item-name {
    font-size: 16px;
  }

  header {
    padding: 10px;
  }

  #logo-img {
    width: 150px;
    height: 150px;
  }

  .modal-content {
    width: 95%;
    padding: 15px;
  }
}

/* In-app notification styling */
#app-notification {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #008f39;
  color: white;
  padding: 15px 30px;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  text-align: center;
  transition: top 0.5s ease;
  font-weight: bold;
  min-width: 280px;
}

#app-notification.show {
  top: 100px;
}

@media (max-width: 480px) {
  body {
    padding-top: 220px; /* Adjusted for smallest screens */
  }
  
  .category-nav {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 10px 15px;
    margin: 10px 5px;
    width: calc(100% - 10px);
    top: 160px; /* Adjusted specifically for smallest screens */
  }

  .category-btn {
    font-size: 12px;
    padding: 6px 10px;
  }

  #menu-container {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .item-image {
    height: 120px;
  }

  #logo-img {
    width: 120px;
    height: 120px;
  }

  .cart-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .cart-item-quantity {
    margin-top: 5px;
  }
}