@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-primary: #0a0f1c;
  --bg-secondary: #0f1629;
  --card-bg: rgba(15, 22, 41, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-1: #10b981; /* Emerald */
  --accent-2: #6366f1; /* Indigo */
  --accent-glow: rgba(16, 185, 129, 0.25);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --container: min(1200px, calc(100% - 40px));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Cairo', sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.08), transparent 25%);
  color: var(--text-main);
  line-height: 1.6;
  direction: rtl; /* Setting Arabic Right-to-Left completely */
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: var(--container);
  margin-inline: auto;
}

/* Typography */
h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 700;
  color: #ffffff;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); }

/* Buttons & Elements */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
  z-index: -1;
  transition: opacity 0.5s ease;
  opacity: 0;
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 25px rgba(16, 185, 129, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent-1);
  color: var(--accent-1);
}

.btn-outline:hover {
  background: rgba(16, 185, 129, 0.1);
  transform: translateY(-2px);
}

/* Glassmorphism Classes */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

.glass-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Header */
.site-header {
  position: fixed;
  top: 0; width: 100%;
  z-index: 100;
  padding: 15px 0;
  transition: background 0.3s ease;
}

.site-header.scrolled {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 0 20px var(--accent-glow);
}

.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-links a {
  font-weight: 600;
  color: #cbd5e1;
  position: relative;
}

.nav-links a:hover {
  color: white;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; right: 0;
  width: 0%; height: 2px;
  background: var(--accent-1);
  transition: var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Hero Section */
.hero {
  padding: 160px 0 100px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
}

.hero-content .pill {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-1);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
  animation: slideDown 0.8s ease-out forwards;
}

.hero-title {
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ffffff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeUp 1s ease-out forwards;
}

.hero-desc {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 40px;
  animation: fadeUp 1.2s ease-out forwards;
  max-width: 90%;
}

.hero-actions {
  display: flex;
  gap: 16px;
  animation: fadeUp 1.4s ease-out forwards;
}

.hero-visual {
  position: relative;
  perspective: 1000px;
  overflow: visible;
}

.hero-image {
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  transform: rotateY(-15deg) rotateX(5deg);
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 2px solid rgba(255,255,255,0.05);
}

.hero-visual:hover .hero-image {
  transform: rotateY(0deg) rotateX(0deg);
}

.floating-badge {
  position: absolute;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: float 6s ease-in-out infinite;
  max-width: min(260px, calc(100% - 24px));
  color: #e2e8f0;
  font-weight: 700;
  z-index: 3;
}

.floating-badge.b-1 { top: -14px; inset-inline-end: 14px; }
.floating-badge.b-2 { bottom: 14px; inset-inline-start: 14px; animation-delay: 2s; }
.floating-badge.b-3 { top: 42%; inset-inline-start: 14px; animation-delay: 4s; }

/* Dashboard Shell for Admin & Restaurant Panels */
.dashboard-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--card-border);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  transition: var(--transition);
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-1);
}

.dashboard-main {
  padding: 40px;
  overflow-y: auto;
  height: 100vh;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.dashboard-user {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  padding: 8px 24px 8px 8px;
  border-radius: 50px;
  border: 1px solid var(--card-border);
}

.dashboard-user img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-icon {
  width: 48px; height: 48px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-1);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.stat-card h3 {
  font-size: 2rem;
  margin: 0;
}

.stat-card p {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Tables */
.table-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.table-header {
  padding: 24px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 16px 24px;
  text-align: right;
  border-bottom: 1px solid var(--card-border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-1);
}

.badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* Menu Page */
.menu-header {
  position: relative;
  height: 40vh;
  min-height: 350px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 40px;
  background-size: cover;
  background-position: center;
}

.menu-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-primary) 5%, rgba(10, 15, 28, 0.6) 50%, rgba(10, 15, 28, 0.2) 100%);
}

.menu-brand-info {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
}

.menu-logo {
  width: 100px; height: 100px;
  border-radius: var(--radius-sm);
  border: 4px solid var(--bg-primary);
  box-shadow: var(--glass-shadow);
  object-fit: cover;
}

.menu-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  margin-top: -20px;
  position: relative;
  z-index: 20;
}

.menu-sidebar {
  position: sticky;
  top: 100px;
  height: max-content;
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-btn {
  width: 100%;
  text-align: right;
  padding: 14px 20px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.category-btn:hover, .category-btn.active {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.category-btn.active {
  border-right: 4px solid var(--accent-1);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.product-card {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.1);
}

.product-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--card-border);
}

.product-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-info h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.product-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  flex-grow: 1;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-1);
}

.add-btn {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-1);
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.add-btn:hover {
  background: var(--accent-1);
  color: white;
  transform: scale(1.1);
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
  .hero-grid, .menu-layout {
    grid-template-columns: 1fr;
  }

  .floating-badge {
    padding: 12px 14px;
    font-size: 0.9rem;
    max-width: calc(100% - 16px);
  }

  .floating-badge.b-3 {
    display: none;
  }
  
  .dashboard-shell {
    grid-template-columns: 80px 1fr;
  }
  
  .sidebar span {
    display: none;
  }
  
  .menu-sidebar {
    position: relative;
    top: 0;
    margin-bottom: 24px;
    z-index: 100;
  }
  
  .category-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }
  
  .category-btn {
    text-align: center;
    white-space: nowrap;
    border-right: none;
    border-bottom: 4px solid transparent;
  }
  
  .category-btn.active {
    border-bottom: 4px solid var(--accent-1);
  }
}

@media (max-width: 768px) {
  .hero { text-align: center; padding-top: 120px; }
  .hero-actions { justify-content: center; }
  .floating-badge {
    display: none;
  }
  
  .dashboard-shell {
    grid-template-columns: 1fr;
  }
  
  .sidebar { display: none; }
  .nav-links { display: none; }
}

/* Add Item Modal (Super Admin / Restaurant Setup) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1; pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 500px;
  padding: 30px;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.form-group label {
  display: block; margin-bottom: 8px;
  font-weight: 600; color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: white; font-family: inherit;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-1);
}
