/*==========================================================
  1. Variables
==========================================================*/
:root {
  /* Theme colors */
  --bg-dark: #0f1724;
  --panel-bg: #16161a;
  --card-bg: #1e293b;
  --surface: #f9f9f9;
  --text-light: #e6eef7;
  --text-dark: #222222;
  --muted: #94a3b8;
  --accent-primary: #06b6d4;
  --accent-secondary: #7c3aed;
  --danger: #ff6b6b;
  --primary: #007bff;
  --success: #28a745;
  --glass: rgba(255,255,255,0.04);

  /* Sizes & spacing */
  --radius: 12px;
  --gap: 20px;
  --max-width: 1200px;
  --touch: 48px;

  /* Typography & effects */
  --transition: 200ms ease;
  --shadow-md: 0 8px 30px rgba(2,6,23,0.6);
}

/*==========================================================
  2. Reset & Base
==========================================================*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.4;
  direction: rtl;
  background: linear-gradient(180deg, #071026 0%, #071a2b 60%);
  color: var(--text-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/*==========================================================
  3. Navigation
==========================================================*/
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-bottom: 1px solid rgba(255,255,255,0.03);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

nav h1 {
  margin: 0;
  font-size: 18px;
  color: var(--accent-primary);
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: var(--touch);
  padding: 8px 10px;
  color: var(--text-light);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

nav a:hover {
  background: var(--glass);
  color: var(--accent-primary);
}

/* Hamburger toggle (إن طبقت) */
.nav-toggle {
  display: none;
}

/*==========================================================
  4. Slider / Banners
==========================================================*/
.slider {
  width: 100%;
  overflow: hidden;
  padding: 14px 16px;
}

.slider .slides {
  display: flex;
  gap: 12px;
  align-items: center;
}

.slider img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

/*==========================================================
  5. Container Wrapper
==========================================================*/
.container {
  max-width: var(--max-width);
  margin: 18px auto;
  padding: 0 12px;
}

/*==========================================================
  6. Categories Section
==========================================================*/
.categories {
  padding: 10px 0 24px;
  text-align: center;
}

.categories h2 {
  margin: 0 0 14px;
  font-size: 20px;
  color: var(--accent-primary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.category-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.005));
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  transition: transform .22s ease, box-shadow .22s ease;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(2,6,23,0.38);
}

.category-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
}

.category-card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--accent-primary);
}

.category-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/*==========================================================
  7. Products Grid
==========================================================*/
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.product-box {
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.005));
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.product-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(2,6,23,0.38);
}

.product-box .main-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.product-box .thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.product-box .thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.04);
  transition: transform .12s ease, border-color .12s ease;
}

.product-box .thumbs img:hover {
  transform: scale(1.06);
  border-color: var(--accent-primary);
}

.product-box h3 {
  margin: 0;
  font-size: 16px;
  color: var(--accent-primary);
}

.product-box p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.price {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.old-price {
  text-decoration: line-through;
  color: #8b8b8b;
}

.new-price {
  color: var(--danger);
  font-weight: 700;
}

/*==========================================================
  8. Buttons & Helpers
==========================================================*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #0069d9;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #218838;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  background: var(--glass);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/*==========================================================
  9. Cart Layout (RTL)
==========================================================*/
.cart {
  width: 100%;
  max-width: var(--max-width);
  margin: 22px auto;
  padding: 18px;
  background-color: var(--surface);
  color: var(--text-dark);
}

.cart nav {
  background: linear-gradient(90deg, var(--primary), #0069d9);
  color: #fff;
  padding: 14px 12px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.cart nav h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.cart nav ul {
  margin: 10px auto 0;
  display: inline-flex;
  gap: 18px;
  padding: 0;
  list-style: none;
}

.cart nav a {
  color: #fff;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  transition: background var(--transition);
}

.cart nav a:hover {
  background: rgba(255,255,255,0.06);
}

.cart .inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.cart-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(13,38,76,0.06);
  align-items: center;
}

.cart-item img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.04);
}

.cart-item .info {
  flex: 1;
  min-width: 0;
}

.cart-item .info h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item .meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.cart-item .actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 160px;
  text-align: right;
}

.summary {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 6px 18px rgba(13,38,76,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary .total {
  font-size: 18px;
  font-weight: 800;
}

/*==========================================================
 10. Contact Section
==========================================================*/
.contact-section {
  background-color: #fff8ec;
  border: 1px solid #e6d3b3;
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 500px;
  margin: 2rem auto;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.contact-section h2 {
  margin-bottom: 1rem;
  color: #4a2e00;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-links a {
  background-color: #d88c3f;
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.75rem;
  border-radius: 50px;
  transition: background-color 0.3s ease;
}

.contact-links a:hover {
  background-color: #b86f2d;
}

/*==========================================================
 11. Responsive Adjustments
==========================================================*/
@media (max-width: 980px) {
  .slider img {
    height: auto;
    aspect-ratio: 16/9;
  }
  .category-card img,
  .product-box .main-img {
    height: auto;
    aspect-ratio: 4/3;
  }
  nav {
    padding: 12px 14px;
  }
}

@media (max-width: 720px) {
  nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }
  .nav-toggle {
    display: block;
  }
  nav ul {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .category-grid,
  .product-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .product-box .thumbs img {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 900px) {
  .cart .inner {
    grid-template-columns: 1fr 340px;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .cart {
    padding: 12px;
  }
  .cart-item {
    flex-direction: row;
    gap: 12px;
    padding: 12px;
  }
  .cart-item img {
    width: 96px;
    height: 96px;
  }
  .cart-item .actions {
    flex-direction: row-reverse;
    justify-content: flex-start;
    width: auto;
  }
}
@media (max-width: 620px) {
  /* كي يصبح المربع ملء الشاشة أفقياً ورأسيّاً */
  .product-details,
  .product-container {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    min-height: 100vh !important;
    box-sizing: border-box;
  }

  /* إذا أردت إزالة الظل والإطارات لتحصل على مساحة أكبر */
  .product-container {
    box-shadow: none;
    border-radius: 0;
  }

  /* تأكد أن المحتوى يفيض عند الحاجة */
  .product-container {
    overflow-y: auto;
  }
}