/* Reset & basics */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  color: #fff;
  overflow-x: hidden;
  direction: rtl;
  text-align: right;
  font-size: 16px;
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
}

h1, h2, h3, p, a, li, input, textarea, button {
  color: #fff;
  font-weight: bold;
  text-shadow: 2px 2px 4px #000, 0 0 2px #fff;
}

/* Critical CSS برای محتوای قابل مشاهده */
#welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

#site-container { 
  display: none; 
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.hidden { 
  display: none !important; 
}

/* Canvas backgrounds */
#star-canvas, #lines-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#star-canvas { 
  background: rgba(0,0,0,0.6); 
  z-index: -2; 
}

#lines-canvas { 
  z-index: -1; 
}

/* Site container */
#site-container {
  max-width: 1200px;
  margin: 0 auto;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: none;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
}

/* 3D Cube Logo - بهبود یافته */
#logo-cube {
  width: 80px;
  height: 80px;
  position: relative;
  transform-style: preserve-3d;
  animation: spin 10s linear infinite !important;
  display: block !important;
  visibility: visible !important;
}

.cube-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: visible;
}

.cube-face img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

.cube-face.front  { transform: rotateY(0deg) translateZ(40px); }
.cube-face.back   { transform: rotateY(180deg) translateZ(40px); }
.cube-face.right  { transform: rotateY(90deg) translateZ(40px); }
.cube-face.left   { transform: rotateY(-90deg) translateZ(40px); }
.cube-face.top    { transform: rotateX(90deg) translateZ(40px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(40px); }

@keyframes spin {
  0%   { transform: rotateX(0) rotateY(0); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* Navbar */
nav {
  background: rgba(0,0,0,0.7);
  padding: 1rem 2rem;
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links li a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.nav-links li a:hover { 
  color: #f4b400; 
}

/* Hamburger Menu */
#menu-toggle {
  display: none;
  cursor: pointer;
  z-index: 1002;
}

#menu-toggle svg { 
  display: block; 
}

#menu-toggle .line { 
  fill: none; 
  stroke: #f4b400; 
  stroke-width: 8; 
  stroke-linecap: round; 
  transition: 0.3s; 
}

/* Hamburger active animation */
#menu-toggle.active .line1 { 
  transform: rotate(45deg) translate(15px, 15px); 
}

#menu-toggle.active .line2 { 
  opacity: 0; 
}

#menu-toggle.active .line3 { 
  transform: rotate(-45deg) translate(15px, -15px); 
}

/* Hero Section */
.hero {
  position: relative;
  height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
}

.hero-inner { 
  position: relative; 
  z-index: 1; 
}

.hero-text h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
}

.hero-text h2 {
  font-size: 1.5rem;
  text-shadow: 2px 2px 5px rgba(0,0,0,0.7);
}

/* Sections */
section {
  padding: 3rem 1rem;
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s ease;
  position: relative;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

h2 { 
  text-align: center; 
  margin-bottom: 2rem; 
  font-size: 2.2rem; 
  color: #f4b400;
}

/* Products Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.product-card {
  background: #111;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(158,140,62,0.5);
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.product-card:hover { 
  transform: scale(1.05); 
}

.product-card img { 
  width: 100%; 
  border-radius: 10px;
  height: 200px;
  object-fit: cover;
}

/* Lightbox */
#lightbox {
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0,0,0,0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: 0.3s;
  z-index: 2000;
}

#lightbox.visible { 
  visibility: visible; 
  opacity: 1; 
}

#lightbox img { 
  max-width: 90%; 
  max-height: 90%; 
  border-radius: 10px;
}

#lightbox .controls {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 2rem;
  transform: translateY(-50%);
}

#lightbox .controls span {
  font-size: 3rem;
  color: #f4b400;
  cursor: pointer;
  user-select: none;
}

/* About & Contact */
.about, .contact {
  background: #111;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 6px 12px rgba(0,0,0,0.5);
  font-size: 1.1rem;
  line-height: 1.8;
}

.about ol {
  padding-right: 1.5rem;
}

.about li {
  margin-bottom: 1rem;
  text-align: justify;
}

/* Contact form */
.contact form {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact form input, 
.contact form textarea {
  font-size: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #444;
  background: #222;
  color: #fff;
  width: 100%;
}

.contact form textarea { 
  min-height: 120px; 
  resize: vertical;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Footer */
footer {
  padding: 2rem 1rem;
  text-align: right;
  background: #111;
  color: #fff;
  border-top: 1px solid #f4b400;
}

footer .social-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

footer .social-links a {
  font-size: 1rem;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
}

footer .social-links a img {
  width: 24px; 
  height: 24px;
  margin-left: 0.5rem;
}

footer .contact-info { 
  text-align: right; 
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

footer iframe { 
  border-radius: 8px; 
  margin-top: 1rem; 
  width: 100%;
}

/* WhatsApp Button */
.whatsapp-button {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  text-align: center;
}

.whatsapp-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Menu Label */
.menu-label {
  display: none;
  font-weight: bold;
  font-size: 1rem;
  margin-right: 8px;
  color: #f5c518;
}

/* Info Box */
#info-box {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  background: linear-gradient(135deg, #222, #444);
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  box-shadow: 0 0 15px rgba(0,0,0,0.4);
  z-index: 999;
  text-align: center;
  line-height: 1.5;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Welcome Screen */
#welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

#welcome-screen h1 {
  font-family: "IranNastaliq", "B Nazanin", serif;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  color: #FFD700;
  text-shadow: 2px 2px 8px rgba(255, 215, 0, 0.8);
  line-height: 1.6;
}

#welcome-screen button {
  background: #333131;
  border: none;
  padding: 12px 30px;
  font-size: 1.2rem;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease;
}

#welcome-screen button:hover {
  background: #e14d2a;
}

/* Floating Action Button */
.fab-container {
  position: fixed;
  bottom: 20px;
  left: 0;
  transform: translateX(-80%);
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 0.3;
  z-index: 1000;
}

.fab-container.show {
  transform: translateX(10px);
  opacity: 1;
}

.fab-main {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 0;
}

.fab-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.fab-sub {
  background-color: #444;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 20px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.fab-container.open .fab-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.seo-hidden {
  display: none !important;
}

/* دیوار محصولات */
#divar-products > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

#divar-products > div > a {
  display: block;
  background: #fff;
  color: #000;
  text-align: center;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  flex: 1 1 calc(25% - 10px);
  box-sizing: border-box;
  min-width: 150px;
  text-decoration: none;
}

/* سایت‌های خارجی */
#external-sites a:hover {
  transform: scale(1.05);
}

#external-sites a:hover div {
  border-color: #f4b400;
  box-shadow: 0 4px 12px rgba(244, 180, 0, 0.3);
}

/* Responsive Design - موبایل */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  header {
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
  }
  
  .nav-links {
    flex-direction: column;
    gap: 1rem;
    font-size: 1.2rem;
  }
  
  .hero-text h1 { 
    font-size: 2rem; 
  }
  
  .hero-text h2 { 
    font-size: 1.2rem; 
  }

  nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    height: 100vh;
    flex-direction: column;
    background: rgba(0,0,0,0.95);
    padding-top: 5rem;
    gap: 2rem;
    transition: right 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
  }
  
  nav.open { 
    right: 0; 
  }

  #menu-toggle { 
    display: block; 
    position: relative;
    z-index: 1002;
  }
  
  #site-container { 
    max-width: 100%; 
  }
  
  .menu-label {
    display: inline-block;
    font-size: 0.9rem;
  }

  #logo-cube {
    width: 60px;
    height: 60px;
    margin-right: auto;
  }
  
  #info-box {
    font-size: 0.8rem;
    padding: 0.6rem 1rem;
    left: auto;
    right: 1rem;
    bottom: 1rem;
  }
  
  .product-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .contact form input,
  .contact form textarea {
    font-size: 16px;
    padding: 0.8rem;
  }
  
  footer {
    padding: 1.5rem 1rem;
  }
  
  footer .social-links {
    align-items: center;
    text-align: center;
  }
  
  footer .contact-info {
    text-align: center;
    font-size: 0.9rem;
  }
  
  /* دیوار محصولات در موبایل */
  #divar-products > div > a {
    flex: 0 0 calc(50% - 10px) !important;
    max-width: calc(50% - 10px) !important;
    min-width: 140px;
  }
  
  #divar-products h2 {
    font-size: 1.8rem;
  }
  
  /* بهبود تایپوگرافی در موبایل */
  h2 {
    font-size: 1.8rem;
  }
  
  section {
    padding: 2rem 1rem;
  }
  
  .about, .contact {
    padding: 1.5rem;
    font-size: 1rem;
  }

  /* سایت‌های خارجی در موبایل */
  #external-sites div {
    width: 130px !important;
    padding: 1rem !important;
  }
  
  #external-sites img {
    width: 80px !important;
    height: 25px !important;
  }
}

@media (max-width: 480px) {
  .hero-text h1 {
    font-size: 1.6rem;
  }
  
  .hero-text h2 {
    font-size: 1rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  #divar-products > div > a {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  #info-box {
    position: relative;
    margin: 1rem auto;
    width: 90%;
    right: auto;
    left: auto;
    bottom: auto;
  }
  
  .fab-container {
    bottom: 10px;
    left: 10px;
  }
}

/* بهبود عملکرد تاچ در موبایل */
@media (hover: none) and (pointer: coarse) {
  .product-card:hover {
    transform: none;
  }
  
  .nav-links li a:hover {
    color: #fff;
  }
  
  .whatsapp-button:hover {
    transform: none;
  }
}

/* جلوگیریش از انیمیشن برای کاهش motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  #logo-cube {
    animation: none;
  }
}
/* کانتینر دکمه شناور */
.fab-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 9999;
}

/* دکمه اصلی */
.fab-main {
  background: #25D366;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
}

.fab-main:hover {
  transform: scale(1.1);
}

/* دکمه‌های فرعی */
.fab-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.fab-container.open .fab-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fab-sub {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 20px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}

.fab-sub:hover {
  transform: scale(1.1);
}
/* استایل سیستم قرعه‌کشی */
.raffle-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  font-family: Arial, sans-serif;
}

.raffle-content {
  background: #1a1a1a;
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  border: 2px solid #f4b400;
  margin: 1rem;
  box-sizing: border-box;
}

.raffle-content h2 {
  color: #f4b400;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.raffle-content p {
  color: #fff;
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-size: 1rem;
}

.raffle-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.raffle-form input {
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #fff;
  font-family: Arial;
  font-size: 16px;
  box-sizing: border-box;
  width: 100%;
}

.form-buttons {
  display: flex;
  gap: 0.5rem;
}

.submit-btn {
  flex: 1;
  padding: 0.75rem;
  background: #f4b400;
  color: #000;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-family: Arial;
  font-size: 16px;
}

.close-btn {
  padding: 0.75rem 1rem;
  background: #555;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: Arial;
  font-size: 16px;
}

.success-message {
  display: none;
  color: #25D366;
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(37, 211, 102, 0.1);
  border-radius: 6px;
}

.success-message p {
  margin: 0;
  font-size: 1rem;
}

/* استایل محتوای اصلی */
.content {
  padding: 2rem;
  text-align: center;
  font-family: Arial, sans-serif;
}

/* رسپانسیو برای موبایل */
@media (max-width: 768px) {
  .raffle-content {
      padding: 1.5rem;
      margin: 0.5rem;
  }
  
  .form-buttons {
      flex-direction: column;
  }
  
  .raffle-content h2 {
      font-size: 1.3rem;
  }
}
