/* ===== ریست ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: sans-serif;
}
body {
  background: #f0f2f5;
  color: #333;
  line-height: 1.5;
  direction: rtl;
}
html {
  scroll-behavior: smooth;
}

/* ===== هدر ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #222;
  color: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  direction: ltr;
}
.logo {
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.4s, color 0.4s;
}

/* ===== منو ===== */
.menu {
  display: flex;
  gap: 25px;
  list-style: none;
  align-items: center;
  direction: rtl;
}
.menu li a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 10px 15px;
  border-radius: 5px;
  transition: all 0.3s;
}
.menu li a:hover {
  background: #ff3f3f;
}

/* dropdown دسکتاپ */
@media (min-width: 769px) {
  .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #222;
    min-width: 180px;
    display: none;
    flex-direction: column;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden;
    text-align: right;
  }
  .dropdown:hover .dropdown-menu {
    display: flex;
  }
}

/* ===== همبرگر موبایل ===== */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}
.hamburger span {
  width: 25px;
  height: 3px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s;
}
@media (max-width: 768px) {
  nav { flex-direction: row; }
  .menu {
    position: absolute;
    top: 65px;
    right: -250px;
    background: #222;
    flex-direction: column;
    width: 200px;
    padding: 15px;
    gap: 15px;
    border-radius: 8px 0 0 8px;
    transition: right 0.3s ease;
  }
  .menu.show { right: 0; }
  .hamburger { display: flex; }
  .dropdown:hover .dropdown-menu { display: none; }
  .dropdown-menu {
    position: relative;
    top: 0;
    background: #333;
    text-align: right;
    flex-direction: column;
  }
}

/* ===== سبد خرید ===== */
#cart-button {
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
}
#cart-count {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  background: #ff3f3f;
  color: white;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: bold;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: transform 0.3s;
}
#cart-count:hover { transform: scale(1.2); }

#cart-panel {
  position: fixed;
  top: 60px;
  right: -350px;
  width: 350px;
  height: 400px;
  background: white;
  box-shadow: -2px 2px 15px rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 10px 0 0 10px;
  transition: right 0.3s ease-in-out;
  overflow-y: auto;
  z-index: 1000;
  text-align: right;
}
#cart-panel.show { right: 0; }
#cart-panel h3 { margin-bottom: 10px; border-bottom: 2px solid #eee; padding-bottom: 5px; }

#cart-items .cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: #fafafa;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.cart-item .remove-item {
  width: 24px;
  height: 24px;
  background: #f5f5f5;
  color: #ff3f3f;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
}
.cart-item .remove-item:hover { color: #ff3f3f; }

#clear-cart {
  width: 100%;
  padding: 10px;
  margin-top: 15px;
  background: #111;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
}
#clear-cart:hover { background: #ff3f3f; }
#cart-total { font-weight: bold; margin-top: 15px; text-align: center; }

#close-cart {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  background: #ff3f3f;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Arial, sans-serif;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}
#close-cart:hover { background: #e53935; }

/* موبایل سبد خرید */
@media (max-width: 768px) {
  #cart-items .cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  #cart-items .cart-item h3,
  #cart-items .cart-item p {
    margin: 0;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ===== محصولات ===== */
.products {
  padding: 20px;
}
.products h2 { text-align: center; margin-bottom: 20px; font-size: 2rem; }
.filters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filters input,
.filters select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: white;
  outline: none;
  width: 150px;
  transition: all 0.3s;
  text-align: right;
}
.filters input:focus,
.filters select:focus {
  border-color: #ff3f3f;
  box-shadow: 0 0 8px #ff3f3f;
}
.filters input::placeholder,
.filters select::placeholder { color: #555; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.product-card {
  background: white;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
}
.product-card h3 { margin: 10px 0; font-size: 1.2rem; }
.product-card p { font-size: 0.9rem; margin-bottom: 5px; }
.product-card .price { font-weight: bold; color: #e53935; margin-bottom: 10px; }
.product-card button {
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  background: #111;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
}
.product-card button:hover { background: #ff3f3f; }

.view-all-container { text-align: center; margin-top: 30px; }
#pay-link {
  display: inline-block;
  width: 100%;
  text-align: center;
  background-color: #e63946;
  color: #fff;
  font-size: 16px;
  padding: 8px 20px;
  border-radius: 8px;
  margin-top: 5px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}
.view-all-btn:hover,
#pay-link:hover {
  background-color: #b41d2d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ===== فرم تماس با ما ===== */
.contact {
  background: #111;
  color: #fff;
  padding: 50px 20px;
  text-align: center;
}
.contact h2 { font-size: 2rem; margin-bottom: 10px; color: #e63946; }
.contact-intro { margin-bottom: 30px; font-size: 1rem; color: #ccc; }

.contact-container {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  align-items: flex-start;
}

#contact-form {
  flex: 1 1 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
}
#contact-form input,
#contact-form textarea,
#contact-form button {
  width: 100%;
  padding: 12px 15px;
  border-radius: 8px;
  border: 2px solid #555;
  outline: none;
  font-size: 1rem;
  transition: all 0.3s ease-in-out;
  background: #222;
  color: #fff;
}
#contact-form input:focus,
#contact-form textarea:focus {
  border-color: #e63946;
  box-shadow: 0 0 10px #ff3f3f;
}
#contact-form input::placeholder,
#contact-form textarea::placeholder { color: #ccc; }
#contact-form button {
  background: linear-gradient(135deg,#e63946,#ff3f3f);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}
#contact-form button:hover {
  background: linear-gradient(135deg,#b41d2d,#ff1f1f);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 15px rgba(230,57,70,0.4);
}

.contact-info {
  flex: 1 1 250px;
  text-align: right;
  font-size: 0.95rem;
  color: #ccc;
}
.contact-info p { margin-bottom: 15px; }
.contact-info strong { color: #e63946; }

/* پیام‌های خطا */
.error-message {
  color: red;
  font-size: 0.9rem;
  margin-top: 5px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.error-message.show { opacity: 1; }

.success-message {
  position: absolute;
  top: 62%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color:white;
  color: #155724;
  padding:15px 27px;
  width: 55%;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.success-message.show { opacity: 1; }

/* ===== فوتر ===== */
.footer {
  background: #111;
  color: #ccc;
  padding: 40px 20px 20px;
  margin-top: 50px;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.footer-section {
  flex: 1 1 45%;
}
.footer-section h3 {
  color: #e63946;
  margin-bottom: 15px;
  font-size: 1.2rem;
}
.social-links{
  display: flex;
  gap: 20px;
  margin-top: 20px;
}
.social-links a {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 55px; 
  height: 55px;
  font-size: 24px; 
  color: #ccc;
  border: 2px solid #ccc;
  border-radius: 50%;
  transition: all 0.3s ease;
  text-decoration: none;
}
.social-links a .fa-whatsapp { padding-left: 2px; }
.social-links a:hover {
  background: #e63946;
  color: #fff;
  border-color: #e63946;
}
.social-links a::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 115%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #222;
  color: #fff;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.social-links a::before {
  content: "";
  position: absolute;
  top: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.social-links a:hover::after,
.social-links a:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.footer hr {
  border: 0;
  border-top: 1px solid #444;
  margin: 20px 0;
}
.footer-bottom {
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
  margin-bottom: 10px;
}
.footer-bottom strong { color: #e63946; }
.footer-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
  margin-bottom: -5px;
  flex-shrink: 0;
}

/* ===== واکنشگرایی ===== */
@media (max-width: 1024px) { 
  .product-grid { grid-template-columns: repeat(2,1fr); } 
}
@media (max-width: 768px) {
  .product-grid { grid-template-columns: 1fr; }
  .contact-container {
    flex-direction: column;
    text-align: center;
    align-items: center;
    justify-content: center;
  }
  .contact-info { text-align: center; }
  #contact-form input,
  #contact-form textarea,
  #contact-form button { font-size: 0.9rem; padding: 10px; }
  .success-message { width: 70%; }

  .footer-top { flex-direction: column; text-align: center; }
  .footer .social-links { justify-content: center; text-align: center; }
  .footer-bottom { flex-direction: column; }
}
