/* ================================
   VARIABLES & RESET
   ================================ */
:root {
  --bg-primary: #121212;
  --bg-secondary: #0a0a0a;
  --bg-card: #1c1c1c;
  --gold: #FFD700;
  --gold-light: #FFEB3B;
  --gold-glow: rgba(255, 215, 0, 0.3);
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: rgba(255, 215, 0, 0.1);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --radius-md: 20px;
  --radius-lg: 32px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

[dir="rtl"] body {
  font-family: 'Cairo', sans-serif;
}

h1,
h2,
h3 {
  font-family: 'Playfair Display', serif;
  line-height: 1.2;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3 {
  font-family: 'Cairo', sans-serif;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ================================
   LAYOUT
   ================================ */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 2rem 1.5rem 8rem;
  width: min(100%, 1200px);
  margin: 0 auto;
  text-align: center;
  /* Ensure header titles are centered */
}

/* ================================
   COMPONENTS
   ================================ */

/* Top Bar Refined for Absolute Centering */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.top-bar-content {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.top-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

/* Empty left spacer for top-bar grid balance in LTR */
.top-bar-content::before {
  content: "";
  display: block;
}

.desktop-nav {
  display: none;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover {
  color: var(--gold);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: var(--transition);
}

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

@media (min-width: 1024px) {
  .desktop-nav {
    display: flex;
  }
  
  .top-bar-content {
    grid-template-columns: 1fr auto 1fr;
  }
}

.logo {
  height: 52px;
  cursor: pointer;
  transition: var(--transition);
}

.logo:hover {
  transform: scale(1.05);
}

/* Filter Chips */
.filters {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 1rem 0 2rem;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
  transition: var(--transition);
}

.filter-chip.active {
  background: var(--gold);
  color: black;
  border-color: var(--gold);
  box-shadow: 0 4px 15px var(--gold-glow);
}

/* ================================
   COMPONENTS
   ================================ */

/* Top Bar Refinement */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.top-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.icon-btn {
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 0.95rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: black;
}

.btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-3px);
  box-shadow: 0 10px 20px var(--gold-glow);
}

.btn-secondary {
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: translateY(-3px);
}

.btn-whatsapp {
  background: #25D366;
  color: white;
}

.btn-whatsapp:hover {
  background: #128C7E;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(37, 211, 102, 0.2);
}

.btn-call {
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  border: 1px solid var(--border-color);
}

.btn-call:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: translateY(-3px);
}

/* Product Card Fixes */
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

.product-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.product-actions .btn {
  flex: 1;
  padding: 0.6rem 0.5rem;
  font-size: 0.85rem;
}

/* New Hero Section with Background */
.hero-section {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  overflow: hidden;
  padding: 2rem;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.hero-content h1 {
  font-size: clamp(3rem, 10vw, 5rem);
  margin-bottom: 1rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.hero-content p {
  font-size: 1.25rem;
  color: #fff;
  opacity: 0.9;
  margin-bottom: 2.5rem;
}

/* Stats Section */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: -4rem auto 4rem;
  position: relative;
  z-index: 10;
  width: min(100%, 1000px);
  padding: 0 1rem;
}

.stat-item {
  background: rgba(28, 28, 28, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 24px;
  text-align: center;
  transition: var(--transition);
}

.stat-item:hover {
  transform: translateY(-5px);
  border-color: var(--gold);
  background: rgba(28, 28, 28, 0.9);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  display: block;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-top: -2rem;
  }
}

/* Center Centered Grids */
.category-grid.centered {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  justify-content: center;
  justify-items: center;
  /* Center cards within their cells */
  max-width: 1200px;
  margin: 0 auto;
  gap: 2rem;
}

/* Grids */
.product-grid,
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  justify-content: center;
  /* Center items when they don't fill the row */
}

@media (max-width: 600px) {

  .product-grid,
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Features Section (Why Us) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.feature-icon {
  font-size: 2rem;
  flex-shrink: 0;
  background: rgba(255, 215, 0, 0.1);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--gold);
}

.feature-info h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--gold);
}

.feature-info p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Glassmorphism Branch Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 2rem;
  transition: var(--transition);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--gold-glow);
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

/* Footer CTA */
.footer-cta {
  text-align: center;
  padding: 5rem 1.5rem;
  background: linear-gradient(to bottom, transparent, rgba(255, 215, 0, 0.05));
  border-radius: var(--radius-lg);
  margin-top: 5rem;
  border-top: 1px solid var(--border-color);
}

.footer-cta h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.footer-cta p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Refined Category Cards */
.category-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content,
.stat-item,
.product-card,
.feature-card {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat-item:nth-child(1) {
  animation-delay: 0.1s;
}

.stat-item:nth-child(2) {
  animation-delay: 0.2s;
}

.stat-item:nth-child(3) {
  animation-delay: 0.3s;
}

.stat-item:nth-child(4) {
  animation-delay: 0.4s;
}

/* RTL Fixes for Stats */
[dir="rtl"] .stat-value {
  direction: ltr;
}

/* ================================
   MOBILE NAVIGATION (FLOATING)
   ================================ */
.bottom-nav {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 500px);
  background: rgba(28, 28, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  display: flex;
  justify-content: space-around;
  padding: 0.8rem 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px var(--gold-glow);
  z-index: 2000;
  transition: var(--transition);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  transition: var(--transition);
  padding: 0.5rem;
  border-radius: 16px;
  min-width: 60px;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--gold);
}

.nav-item.active svg {
  transform: translateY(-5px);
  filter: drop-shadow(0 0 8px var(--gold));
}

.nav-item:hover {
  color: var(--text-primary);
}

/* Desktop: Hide Mobile Nav */
@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

/* Mobile Adjustments for Main Content Padding */
@media (max-width: 1023px) {
  .app-container {
    padding-bottom: 8rem;
  }
}