/* --- Global Styles & Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth; /* Enables smooth scrolling for anchor links */
}

body {
  font-family: "Cairo", sans-serif;
  background-color: #0a0a1a; /* Dark futuristic background */
  color: #e0e0e0; /* Light text color */
  line-height: 1.6;
  direction: rtl; /* Right-to-left layout */
  overflow-x: hidden; /* Prevent horizontal scroll */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  text-decoration: none;
  color: #00bcd4; /* Cyan accent color */
  transition: color 0.3s ease;
}

a:hover {
  color: #ffffff;
}

button {
  font-family: "Cairo", sans-serif;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important; /* Utility class to hide elements */
}

/* --- Page Loader --- */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(
    10,
    10,
    26,
    0.95
  ); /* Same as body bg but slightly opaque */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

/* --- Spinner --- */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-left-color: #00bcd4; /* Accent color */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.loading-indicator .spinner {
  /* Spinner inside item popup */
  margin: 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Image loading placeholder/spinner */
.img-container {
  position: relative;
  background-color: #2a2a3a; /* Placeholder background */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* Keep spinner contained */
}

.img-container .spinner {
  position: absolute;
  width: 25px; /* Smaller spinner */
  height: 25px;
  border-width: 3px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.img-container.loaded .spinner {
  opacity: 0;
}

.img-container img {
  opacity: 0;
  transition: opacity 0.5s ease;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure image covers the container */
}

.img-container.loaded img {
  opacity: 1;
}

/* --- Navbar --- */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: transparent; /* Start transparent */
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
  padding: 10px 0;
}

#navbar.scrolled {
  background-color: rgba(
    10,
    10,
    26,
    0.85
  ); /* Semi-transparent dark blue on scroll */
  backdrop-filter: blur(10px); /* Futuristic blur effect */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1300px; /* Slightly wider for nav */
  margin: 0 auto;
  padding: 0 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px; /* Fixed height */
}

.nav-left,
.nav-center,
.nav-right {
  display: flex;
  align-items: center;
}

.nav-left {
  flex: 1;
  justify-content: flex-start;
}

.nav-center {
  flex: 1;
  justify-content: center;
}

.nav-right {
  flex: 1;
  justify-content: flex-end;
}

.logo {
  height: 50px; /* Adjust logo size */
  width: auto;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.1);
}

.restaurant-title {
  font-size: 1.8em;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 1px;
}

.icon-button {
  font-size: 1.6em;
  color: #e0e0e0;
  position: relative;
  padding: 5px;
  transition: color 0.3s ease, transform 0.3s ease;
}
.icon-button:hover {
  color: #00bcd4; /* Accent color */
  transform: scale(1.1);
}

.badge {
  position: absolute;
  top: -5px;
  right: -10px;
  background-color: #ff4081; /* Contrasting pink/red */
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 0.6em;
  font-weight: bold;
  line-height: 1;
  min-width: 18px; /* Ensure minimum size */
  text-align: center;
}

/* --- Header Section --- */
#header {
  height: 100vh; /* Full viewport height */
  position: relative;
  display: flex;
  align-items: flex-end; /* Align content to bottom */
  justify-content: center;
  text-align: center;
  overflow: hidden; /* Hide video overflow */
  padding-bottom: 5vh; /* Space at the bottom */
}

#header-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: -2; /* Behind overlay and content */
}

.header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 26, 0.3),
    rgba(10, 10, 26, 0.8)
  ); /* Gradient overlay */
  z-index: -1;
}

.header-content {
  position: relative; /* Ensure content is above overlay */
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 90%; /* Limit width of content */
}

.menu-button {
  display: inline-block;
  background-color: #00bcd4; /* Accent color */
  color: #0a0a1a; /* Dark text */
  padding: 15px 40px;
  font-size: 1.2em;
  font-weight: 700;
  border-radius: 50px; /* Pill shape */
  text-align: center;
  margin-bottom: 30px;
  width: 90%; /* 90% width */
  max-width: 400px; /* Max width for button */
  box-shadow: 0 5px 15px rgba(0, 188, 212, 0.4);
  transition: background-color 0.3s ease, transform 0.3s ease,
    box-shadow 0.3s ease;
}

.menu-button:hover {
  background-color: #ffffff;
  color: #0a0a1a;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 188, 212, 0.6);
}

.social-icons {
  display: flex;
  gap: 25px; /* Space between icons */
}

.social-icons a {
  color: #e0e0e0;
  font-size: 1.8em;
  transition: color 0.3s ease, transform 0.3s ease;
}

.social-icons a:hover {
  color: #00bcd4; /* Accent color on hover */
  transform: scale(1.2) rotate(5deg); /* Slight rotation effect */
}

/* --- Food Section (Classes & Items) --- */
.food-section {
  padding: 80px 0;
  background-color: #0f0f24; /* Slightly different dark shade */
}

.food-section h2 {
  text-align: center;
  font-size: 2.5em;
  margin-bottom: 50px;
  color: #ffffff;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

/* Underline effect for heading */
.food-section h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background-color: #00bcd4; /* Accent color */
  border-radius: 2px;
}

.grid-container {
  display: grid;
  gap: 30px; /* Spacing between grid items */
  /* Responsive grid: 3 columns on large screens, 2 on medium, 1 on small */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-item-placeholder {
  /* For initial loading skeleton */
  background-color: #2a2a3a;
  border-radius: 15px;
  aspect-ratio: 1 / 1; /* Maintain square shape */
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Food Class Item Styling */
.food-class-item {
  position: relative;
  border-radius: 15px; /* Rounded corners */
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  aspect-ratio: 1 / 1; /* Maintain square shape */
  background-color: #1a1a2e; /* Base background */
}

.food-class-item .img-container {
  width: 100%;
  height: 100%;
}

.food-class-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cover the area */
  /* Opacity transition is handled by .img-container */
}

.food-class-item::before {
  /* Glossy overlay effect */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(0, 0, 0, 0) 20%,
    rgba(0, 0, 0, 0.6) 80%,
    rgba(0, 0, 0, 0.9) 100%
  );
  opacity: 0.8;
  transition: opacity 0.3s ease;
  z-index: 1; /* Above image */
}

.food-class-item:hover {
  transform: translateY(-10px) scale(1.03); /* Lift effect */
  box-shadow: 0 15px 30px rgba(0, 188, 212, 0.3);
}

.food-class-item:hover::before {
  opacity: 1;
}

.class-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px 15px;
  text-align: center;
  color: #ffffff;
  font-size: 1.4em;
  font-weight: 700;
  z-index: 2; /* Above overlay */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  transition: bottom 0.3s ease; /* Slide up slightly on hover */
}

.food-class-item:hover .class-title-overlay {
  bottom: 5px; /* Move title up slightly on hover */
}

/* --- Popups (Cart & Items) --- */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex; /* Use flex to center */
  align-items: center;
  justify-content: center;
  opacity: 0; /* Start hidden */
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.popup.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0s linear 0s;
}

.popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8); /* Darker overlay */
  backdrop-filter: blur(5px); /* Blur background */
}

.popup-dialog {
  position: relative; /* To contain absolute elements like close button */
  background: #1a1a2e; /* Dark popup background */
  border-radius: 20px; /* More rounded */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 600px; /* Max width for cart */
  max-height: 85vh; /* Limit height */
  display: flex;
  flex-direction: column; /* Stack header, content, footer */
  overflow: hidden; /* Prevent content spill */
  transform: scale(0.9); /* Start slightly smaller */
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Elastic transition */
}

.popup.active .popup-dialog {
  transform: scale(1);
}

/* Specific width for items popup */
.popup-dialog.items-dialog {
  max-width: 950px; /* Wider for item grid */
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  border-bottom: 1px solid #3a3a4e; /* Separator line */
  background-color: #2a2a3a; /* Slightly different header background */
}
/* Sticky header for items popup */
.popup-header-fixed {
  position: sticky;
  top: 0;
  z-index: 10; /* Ensure it stays above scrolling content */
  border-radius: 20px 20px 0 0; /* Match dialog rounding */
}

.popup-header h3 {
  font-size: 1.5em;
  color: #00bcd4; /* Accent color for title */
  margin: 0;
}
.popup-header h3 i {
  margin-left: 10px;
}

.close-button {
  font-size: 2.2em;
  color: #888;
  line-height: 1;
  padding: 0 5px;
  transition: color 0.3s ease, transform 0.3s ease;
}

.close-button:hover {
  color: #ff4081; /* Contrasting color on hover */
  transform: rotate(90deg);
}

.popup-content {
  padding: 25px;
  overflow-y: auto; /* Enable scrolling for content */
  flex-grow: 1; /* Allow content to take available space */
}
/* Specific padding for item grid */
.popup-content.items-grid {
  padding: 30px; /* More padding around items */
}

.loading-indicator {
  text-align: center;
  padding: 40px 0;
  color: #aaa;
}
.loading-indicator p {
  margin-top: 10px;
  font-size: 1.1em;
}

/* --- Cart Specific Styles --- */
.cart-content {
  min-height: 100px; /* Minimum height before scrolling */
}

.empty-cart-message {
  text-align: center;
  color: #aaa;
  padding: 30px 0;
  font-size: 1.1em;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px dashed #3a3a4e; /* Dashed separator */
}
.cart-item:last-child {
  border-bottom: none;
}

.cart-item-details {
  flex-grow: 1;
  margin-right: 15px; /* Space between details and price/controls */
}
.cart-item-details span {
  display: block;
}
.cart-item-title {
  font-weight: 700;
  color: #ffffff;
}
.cart-item-price-info {
  font-size: 0.9em;
  color: #aaa;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quantity-controls button {
  background-color: #3a3a4e;
  color: #e0e0e0;
  border-radius: 4px;
  width: 25px;
  height: 25px;
  font-size: 1.1em;
  line-height: 25px; /* Center text vertically */
  text-align: center;
  transition: background-color 0.2s ease;
}
.quantity-controls button:hover {
  background-color: #00bcd4;
  color: #1a1a2e;
}
.item-quantity {
  font-weight: bold;
  min-width: 20px; /* Ensure space for number */
  text-align: center;
}
.remove-item-button {
  color: #ff4081;
  font-size: 1.2em;
  margin-left: 10px;
}
.remove-item-button:hover {
  color: #ff79b0;
}

.popup-footer {
  padding: 20px 25px;
  border-top: 1px solid #3a3a4e;
  background-color: #2a2a3a; /* Footer background */
  border-radius: 0 0 20px 20px; /* Match dialog rounding */
}

.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
}
#cart-total-price {
  color: #00bcd4; /* Accent color for total price */
  margin-right: 10px;
}

.whatsapp-button {
  background-color: #25d366; /* WhatsApp green */
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 700;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.whatsapp-button i {
  margin-left: 8px;
}

.whatsapp-button:hover:not(:disabled) {
  background-color: #128c7e; /* Darker WhatsApp green */
  transform: scale(1.05);
}
.whatsapp-button:disabled {
  background-color: #555;
  cursor: not-allowed;
  opacity: 0.7;
}

/* --- Food Item Card (Inside Item Popup) --- */
.food-item-card {
  height: 400px;
  position: relative;
  background-color: #2a2a3a; /* Card background */
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column; /* Stack image, content */
}

.food-item-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 188, 212, 0.2);
}

.food-item-card .img-container {
  /*  height: 220px;Fixed height for item images */
  width: 100%;
  border-bottom: 3px solid #00bcd4; /* Accent border */
}

.item-info {
  padding: 15px;
  flex-grow: 1; /* Take remaining space */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Push button to bottom */
}

.item-title-overlay {
  font-size: 1.2em;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px; /* Space below title */
  text-align: center;
}

.item-price {
  position: absolute;
  top: 10px;
  left: 10px; /* Changed to left for RTL */
  background-color: rgba(0, 188, 212, 0.85); /* Accent color background */
  color: #1a1a2e; /* Dark text on accent */
  padding: 5px 12px;
  border-radius: 20px; /* Pill shape */
  font-size: 0.95em;
  font-weight: bold;
  z-index: 2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.add-to-cart-button {
  background-color: #ff4081; /* Contrasting button color */
  color: white;
  padding: 8px 15px;
  border-radius: 6px;
  text-align: center;
  font-weight: 700;
  margin-top: 15px; /* Space above button */
  transition: background-color 0.3s ease, transform 0.2s ease;
  width: 100%; /* Full width */
}

.add-to-cart-button i {
  margin-left: 8px;
}

.add-to-cart-button:hover {
  background-color: #f50057; /* Darker pink/red */
  transform: scale(1.02);
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
  .nav-container {
    padding: 0 15px;
  }
  .restaurant-title {
    font-size: 1.5em;
  }
  .logo {
    height: 45px;
  }
  /* Grid already handles responsiveness */
}

@media (max-width: 768px) {
  .nav-container {
    height: 55px;
  }
  .logo {
    height: 40px;
  }
  .restaurant-title {
    display: none; /* Hide title on smaller screens if needed */
  }
  .nav-center {
    flex: 2; /* Give logo more space */
  }
  .nav-left,
  .nav-right {
    flex: 1;
  }
  .menu-button {
    font-size: 1.1em;
    padding: 12px 30px;
  }
  .social-icons a {
    font-size: 1.6em;
  }
  .food-section h2 {
    font-size: 2em;
  }
  .popup-dialog {
    max-width: 95%; /* Allow wider popups */
    max-height: 90vh;
  }
  .popup-content {
    padding: 15px;
  }
  .popup-content.items-grid {
    padding: 20px;
  }
  .cart-footer {
    flex-direction: column;
    gap: 15px;
    align-items: stretch; /* Make items full width */
  }
  .cart-total {
    text-align: center;
  }
  .whatsapp-button {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  #navbar {
    padding: 5px 0;
  }
  .nav-container {
    padding: 0 10px;
    height: 50px;
  }
  .logo {
    height: 35px;
  }
  .icon-button {
    font-size: 1.4em;
  }
  .badge {
    font-size: 0.55em;
    min-width: 16px;
    top: -4px;
    right: -8px;
  }
  .header-content {
    padding-bottom: 8vh;
  }
  .menu-button {
    width: 95%;
    font-size: 1em;
    padding: 10px 20px;
  }
  .social-icons {
    gap: 20px;
  }
  .social-icons a {
    font-size: 1.5em;
  }
  .food-section {
    padding: 60px 0;
  }
  .food-section h2 {
    font-size: 1.8em;
    margin-bottom: 40px;
  }
  .grid-container {
    gap: 20px;
  }
  .food-class-item .class-title-overlay {
    font-size: 1.2em;
    padding: 15px 10px;
  }
  .popup-header h3 {
    font-size: 1.3em;
  }
  .close-button {
    font-size: 2em;
  }

  .item-title-overlay {
    font-size: 1.1em;
  }
  .item-price {
    font-size: 0.9em;
    padding: 4px 10px;
  }
  .add-to-cart-button {
    padding: 8px 12px;
    font-size: 0.9em;
  }
}
