@import url('animations.css');

:root {
  /* Brand Colors - Purple Theme (El Aseel) */
  --color-primary: #6a1b9a;
  /* Deep Purple (Logo & Buttons) */
  --color-primary-dark: #4a148c;
  /* Darker Purple */
  --color-accent: #d4af37;
  /* Gold Accent (Headers/Highlights) */

  --color-secondary: #fdfbf7;
  /* Creamy White Background (Neutral) */
  --color-secondary-light: #ffffff;
  /* Pure White */

  --color-text-main: #333333;
  /* Dark Grey Text (Readable) */
  --color-text-muted: #666666;
  /* Muted Text */

  --color-white: #ffffff;
  --color-black: #000000;

  --color-success: #2e7d32;
  --color-danger: #c62828;

  /* Fonts */
  --font-family-base: 'Cairo', sans-serif;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 3rem;

  /* Borders */
  --border-radius-sm: 4px;
  --border-radius-md: 15px;
  /* Softer, rounder */
  --border-radius-lg: 25px;

  /* Shadows */
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-base);
  background-color: var(--color-secondary);
  color: var(--color-text-main);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(212, 175, 55, 0.05) 0%, transparent 20%);
  background-attachment: fixed;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-main);
  /* Default to dark text */
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

/* Utilities */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.text-center {
  text-align: center;
}

.text-purple {
  color: var(--color-primary);
}

.text-gold {
  color: var(--color-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius-lg);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 4px 10px rgba(106, 27, 154, 0.3);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
  /* Text turns gold on hover */
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(106, 27, 154, 0.4);
}

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

.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Header & Navbar */
.topbar {
  background-color: rgba(255, 255, 255, 0.95);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 2px solid #eee;
  padding: var(--spacing-md) 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.topbar.scrolled {
  background-color: rgba(255, 255, 255, 0.98);
  padding: var(--spacing-sm) 0;
  box-shadow: var(--shadow-md);
}


.topbar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.brand__icon {
  font-size: 2rem;
  color: var(--color-primary);
}

.brand__info {
  display: flex;
  flex-direction: column;
}

.brand__name {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--color-primary);
  /* Keep LOGO Purple */
  margin: 0;
  line-height: 1.1;
}

.brand__slogan {
  font-size: 0.9rem;
  color: var(--color-accent);
  /* Slogan Gold */
  font-weight: 500;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Search Bar */
.search-form {
  position: relative;
}

.search-input {
  background: #f5f5f5;
  /* Very light purple */
  border: 1px solid #ddd;
  color: var(--color-text-main);
  padding: var(--spacing-sm) var(--spacing-md);
  padding-left: 2.5rem;
  border-radius: var(--border-radius-lg);
  font-family: inherit;
  width: 250px;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: #b39ddb;
}

.search-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
  width: 300px;
}

/* Footer */
.footer {
  background-color: #222;
  /* Return to Dark Footer for stability */
  color: #fff;
  padding: var(--spacing-xl) 0 var(--spacing-lg);
  margin-top: var(--spacing-xl);
  border-top: 5px solid var(--color-primary);
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-xl);
}

.footer__title {
  color: var(--color-accent);
  /* Gold Headers in Footer */
  font-size: 1.4rem;
  margin-bottom: var(--spacing-md);
  border-bottom: 2px solid #444;
  display: inline-block;
  padding-bottom: var(--spacing-xs);
}

.footer__links li {
  margin-bottom: var(--spacing-sm);
}

.footer__links a {
  color: #eee;
}

.footer__links a:hover {
  color: var(--color-accent);
  padding-right: 10px;
}

.footer__bottom {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid #333;
  color: #888;
  font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .topbar__inner {
    flex-direction: column;
    align-items: center;
  }

  .search-input {
    width: 100%;
  }

  .search-input:focus {
    width: 100%;
  }
}

/* WhatsApp Button */
.whatsapp-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #25d366;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
  z-index: 2000;
  transition: transform 0.3s ease;
}

.whatsapp-btn:hover {
  transform: scale(1.1) rotate(10deg);
  background-color: #128c7e;
  color: white;
}

/* AJAX Search Results Dropdown */
.search-results-dropdown {
  position: absolute;
  top: 120%;
  /* Space below input */
  right: 0;
  width: 320px;
  background: #ffffff;
  border: 1px solid #eee;
  border-radius: var(--border-radius-md);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 5px;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.2s;
  color: var(--color-text-main);
  text-decoration: none;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f9f9f9;
  /* Light Purple Hover */
}

.search-result-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  margin-left: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-weight: bold;
  font-size: 1rem;
  color: var(--color-text-main);
  margin-bottom: 2px;
}

.search-result-price {
  font-size: 0.9rem;
  color: var(--color-accent);
  font-weight: 700;
}

.search-result-badge {
  font-size: 0.75rem;
  background: var(--color-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}

.no-results {
  padding: 20px;
  text-align: center;
  color: var(--color-text-muted);
}

/* Grid Layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--spacing-lg);
}

.cats-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Enhanced Card Styles */
.product-card,
.cat-card {
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.27),
    box-shadow 0.4s ease;
  background-color: var(--color-secondary-light);
  /* White */
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: block;
  text-decoration: none;
}

/* Product Card Specifics */
.product-card__image-wrapper {
  height: 200px;
  background: #f0f0f0;
  position: relative;
  overflow: hidden;
}

.product-card__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.product-card__body {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100% - 200px);
  /* Ensure it fills remaining space */
}

.product-card__title {
  color: var(--color-text-main);
  /* Dark Grey */
  margin: 0 0 5px;
  font-size: 1rem;
  font-weight: 700;
}

.product-card__price {
  color: var(--color-accent);
  /* GOLD Price */
  font-weight: 900;
  font-size: 1.1rem;
}

/* Category Card Specifics */
.cat-card__media {
  position: relative;
  height: 250px;
  overflow: hidden;
}

.cat-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.cat-card__media .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.cat-card__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-md);
  pointer-events: none;
}

.cat-card__title {
  color: var(--color-white);
  /* White text on dark overlay */
  margin: 0;
  font-size: 1.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.cat-card .btn-text {
  color: var(--color-accent);
  /* Gold arrow/text */
  font-size: 0.9rem;
  font-weight: bold;
}

/* Hover Effects */
.product-card:hover,
.cat-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 15px 30px rgba(106, 27, 154, 0.2);
  /* Soft Purple shadow */
  z-index: 10;
}

.cat-card:hover .cat-card__media img,
.product-card:hover .product-card__image-wrapper img {
  transform: scale(1.1);
}