@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4ad1;
  --secondary: #00b894;
  --dark-bg: #0a0f1c;
  --card-bg: #111827;
  --text-light: #f3f4f6;
  --text-muted: #9ca3af;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--dark-bg);
  color: var(--text-light);
  line-height: 1.6;
  transition: background 0.3s;
}

.light-theme {
  --dark-bg: #f9fafb;
  --card-bg: #ffffff;
  --text-light: #1f2937;
  --text-muted: #4b5563;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: rgba(10, 15, 28, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.light-theme .site-header {
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0;
}
.branding {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  font-size: 36px;
  color: var(--primary);
}
.branding h1 {
  font-size: 1.6rem;
  font-weight: 700;
}
.branding h1 span {
  color: var(--primary);
}
.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.main-nav ul {
  display: flex;
  gap: 12px;
  list-style: none;
}
.main-nav a {
  color: var(--text-light);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 40px;
  transition: var(--transition);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--primary);
  color: white;
}
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.search-wrapper {
  position: relative;
}
.search-wrapper i {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
#search {
  padding: 10px 36px 10px 16px;
  border-radius: 40px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: inherit;
  width: 200px;
  transition: var(--transition);
}
#search:focus {
  width: 260px;
  outline: none;
  border-color: var(--primary);
}
.light-theme #search {
  background: #fff;
  border-color: #ddd;
}
#theme-toggle, .cart-icon-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 1.2rem;
  transition: var(--transition);
}
#theme-toggle:hover, .cart-icon-btn:hover {
  background: var(--primary);
  transform: scale(1.05);
}
.cart-icon-btn {
  position: relative;
}
.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent);
  color: black;
  font-size: 0.7rem;
  font-weight: bold;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hero */
.hero {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 40px 0;
  flex-wrap: wrap;
}
.hero-content {
  flex: 1;
}
.hero-content h2 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.highlight {
  color: var(--primary);
  border-bottom: 3px solid var(--accent);
  display: inline-block;
  animation: glow 1.5s ease-in-out infinite alternate;
}
.btn-hero {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 12px 28px;
  border-radius: 40px;
  margin-top: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
}
.btn-hero:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(108,92,231,0.3);
}
.hero-image {
  flex: 1;
  text-align: center;
}
.hero-image img {
  max-width: 100%;
  border-radius: 30px;
  filter: drop-shadow(0 20px 25px rgba(0,0,0,0.3));
  transition: transform 0.4s;
}
.hero-image img:hover {
  transform: scale(1.02);
}

/* Products Grid */
.products-section {
  margin: 48px 0;
}
.products-section h2 {
  text-align: center;
  margin-bottom: 32px;
  font-size: 2rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}
.card {
  background: var(--card-bg);
  border-radius: 24px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }
.card:nth-child(11) { animation-delay: 0.55s; }
.card:nth-child(12) { animation-delay: 0.6s; }
.card:nth-child(13) { animation-delay: 0.65s; }
.card:nth-child(14) { animation-delay: 0.7s; }

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 30px -10px rgba(0,0,0,0.3);
}
.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.card-img.loaded {
  animation: none;
  background: none;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.card:hover .card-img {
  transform: scale(1.03);
}
.card-content {
  padding: 18px;
}
.card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}
.desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}
.btn-add {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 40px;
  cursor: pointer;
  font-weight: bold;
  transition: var(--transition);
}
.btn-add:hover {
  background: #0e9f6e;
  transform: scale(1.02);
}
.btn-add:active {
  animation: pulse 0.2s ease;
}
.contact-section {
  text-align: center;
  background: rgba(108,92,231,0.1);
  padding: 32px;
  border-radius: 48px;
  margin: 40px 0;
  animation: fadeInUp 0.6s ease-out;
}

/* Side Cart */
.cart-sidebar {
  position: fixed;
  top: 0;
  left: -400px;
  width: 380px;
  height: 100%;
  background: var(--card-bg);
  box-shadow: -5px 0 30px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: left 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.cart-sidebar.open {
  left: 0;
}
.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  display: none;
}
.cart-overlay.active {
  display: block;
}
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.close-cart {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-muted);
}
.cart-items {
  flex: 1;
  overflow-y: auto;
}
.cart-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  animation: fadeInUp 0.3s ease-out;
}
.cart-item-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 12px;
}
.cart-item-details {
  flex: 1;
}
.cart-item-title {
  font-weight: bold;
}
.cart-item-price {
  font-size: 0.9rem;
  color: var(--accent);
}
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.qty-btn {
  background: var(--primary);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  cursor: pointer;
  color: white;
  transition: 0.1s;
}
.qty-btn:active {
  transform: scale(0.9);
}
.remove-item {
  background: var(--danger);
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 0.7rem;
}
.cart-footer {
  margin-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
}
.cart-total {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 16px;
}
.btn-checkout {
  background: #25D366;
  color: white;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}
.btn-checkout:hover {
  background: #128C7E;
  transform: scale(1.02);
}
.btn-checkout:active {
  animation: pulse 0.2s ease;
}
.empty-cart-msg {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

/* Product detail page gallery */
.product-detail-page {
  padding: 30px 0;
  animation: fadeInUp 0.5s ease-out;
}
.product-page {
  background: var(--card-bg);
  border-radius: 32px;
  padding: 28px;
}
.gallery {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.gallery img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: 0.2s;
}
.gallery img:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}
.main-product-img {
  width: 100%;
  max-width: 400px;
  border-radius: 24px;
  transition: transform 0.3s;
}
.main-product-img:hover {
  transform: scale(1.01);
}
.back-to-home {
  display: inline-block;
  margin-top: 20px;
  color: var(--primary);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 40px;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shakeCart {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.cart-icon-btn.shake {
  animation: shakeCart 0.4s ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes glow {
  from { text-shadow: 0 0 2px var(--primary); }
  to { text-shadow: 0 0 12px var(--primary); }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-msg {
  animation: slideInRight 0.3s ease-out forwards;
}

#theme-toggle {
  transition: transform 0.2s, background 0.3s;
}
#theme-toggle:hover {
  transform: rotate(15deg);
}

/* Responsive */
@media (max-width: 768px) {
  .cart-sidebar {
    width: 100%;
    left: -100%;
  }
  .header-flex {
    flex-direction: column;
  }
  .hero-content h2 {
    font-size: 1.8rem;
  }
}