/* ========================================================
   أنماط وتنسيقات الموقع - تهنئة المهندس نبراس 🌹 (النسخة الفاخرة)
   ======================================================== */

:root {
  --bg-dark: #07060e;
  --bg-gradient: radial-gradient(circle at 50% 30%, #1a103c 0%, #0c081e 50%, #05040a 100%);
  --rose-red: #e60039;
  --rose-deep: #800020;
  --gold-primary: #ffd700;
  --gold-light: #fff2a3;
  --gold-dark: #b8860b;
  --gold-gradient: linear-gradient(135deg, #fff3b0 0%, #ffd700 45%, #d4af37 70%, #aa7c11 100%);
  --card-bg: rgba(18, 14, 38, 0.96);
  --card-border: rgba(255, 215, 0, 0.45);
  --font-arabic: 'Cairo', 'Amiri', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-kufi: 'Reem Kufi', cursive;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  background: var(--bg-gradient);
  font-family: var(--font-arabic);
  color: #ffffff;
  user-select: none;
}

/* خلفيات الكانفاس للنجوم والكونفيتي */
#particles-canvas,
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

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

#confetti-canvas {
  z-index: 200;
}

/* الحاوية الرئيسية */
.main-container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

/* مسرح المشهد (الوردة والبطاقة) */
.scene-stage {
  position: relative;
  width: 100%;
  max-width: 950px;
  height: 740px;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1500px;
}

/* ========================================================
   حاوية الوردة والرسوم المتحركة المحسنة فائقة الجمال
   ======================================================== */
.rose-container {
  position: absolute;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 20;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 1.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 1.2s ease,
              filter 1.2s ease;
}

/* حالة انزياح الوردة بهدوء لتستقر تحت البطاقة كقاعدة زهرية ساحرة */
.rose-container.settled {
  transform: translateY(135px) scale(0.82);
  filter: drop-shadow(0 0 30px rgba(255, 30, 80, 0.4));
}

.rose-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: roseGentleSway 7s ease-in-out infinite alternate;
  transform-origin: 250px 820px;
}

@keyframes roseGentleSway {
  0% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1deg); }
  100% { transform: rotate(-0.8deg); }
}

/* رسم ساق الوردة من الأسفل للأعلى بانسيابية */
.stem-path {
  stroke-dasharray: 880;
  stroke-dashoffset: 880;
  transition: stroke-dashoffset 2.6s cubic-bezier(0.35, 0, 0.25, 1);
}

.stem-path.grow {
  stroke-dashoffset: 0;
}

/* الشوك الطبيعي */
.thorn {
  opacity: 0;
  transform-origin: center;
  transform: scale(0);
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thorn.show {
  opacity: 1;
  transform: scale(1);
}

/* أوراق الشجر الواقعية وتمايلها الطبيعي */
.leaf-group {
  opacity: 0;
  transform: scale(0);
  transform-origin: 0 0;
  transition: all 1.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.leaf-left.show {
  opacity: 1;
  transform: scale(1) rotate(-8deg);
  animation: leafLeftSway 5s ease-in-out infinite alternate 1.5s;
}

.leaf-right.show {
  opacity: 1;
  transform: scale(1) rotate(6deg);
  animation: leafRightSway 5.5s ease-in-out infinite alternate 1.8s;
}

@keyframes leafLeftSway {
  0% { transform: scale(1) rotate(-8deg); }
  100% { transform: scale(1) rotate(-2deg); }
}

@keyframes leafRightSway {
  0% { transform: scale(1) rotate(6deg); }
  100% { transform: scale(1) rotate(12deg); }
}

/* سبلات الكأس الخضراء (Sepals) */
.calyx-group {
  opacity: 0;
  transform: scale(0.2);
  transform-origin: 0 0;
  transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.calyx-group.show {
  opacity: 1;
  transform: scale(1);
}

/* تفتح بتلات الوردة المخملية */
.blossom-group {
  opacity: 0;
  transform: scale(0.08) rotate(-12deg);
  transform-origin: 0 0;
  transition: transform 2.3s cubic-bezier(0.34, 1.25, 0.64, 1),
              opacity 1.5s ease;
}

.blossom-group.bloom {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.petal {
  transform-origin: 0 0;
  transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1);
}

.layer-outer .petal {
  animation: petalBreathe 4.5s ease-in-out infinite alternate;
}

@keyframes petalBreathe {
  0% { transform: scale(1); }
  100% { transform: scale(1.025) rotate(0.6deg); }
}

/* هالة الوردة المشعة */
.rose-aura {
  transition: opacity 2s ease;
}

.rose-aura.glow {
  opacity: 0.85;
  animation: auraPulse 3s ease-in-out infinite alternate;
}

@keyframes auraPulse {
  0% { opacity: 0.6; transform: scale(0.96); }
  100% { opacity: 0.95; transform: scale(1.06); }
}

/* النص الترحيبي أسفل الوردة */
.intro-caption {
  margin-top: 10px;
  font-size: 1.15rem;
  color: #ffb3c1;
  text-shadow: 0 0 12px rgba(255, 100, 130, 0.7);
  opacity: 0;
  transform: translateY(15px);
  transition: all 1s ease;
}

.intro-caption.show {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================================
   بطاقة المعايدة الفاخرة النقية (تظهر من خلف الوردة)
   ======================================================== */
.card-wrapper {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -40%) scale(0.4);
  opacity: 0;
  visibility: hidden;
  z-index: 50;
  width: 90%;
  max-width: 480px;
  transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 1.2s ease,
              visibility 0.3s;
}

/* حالة ظهور البطاقة وانبثاقها */
.card-wrapper.emerge {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -55%) scale(1);
  z-index: 60;
  animation: cardHoverFloat 4.5s ease-in-out infinite alternate 1.6s;
}

@keyframes cardHoverFloat {
  0% { transform: translate(-50%, -55%) scale(1); }
  100% { transform: translate(-50%, -58%) scale(1.015); }
}

/* الصندوق ثلاثي الأبعاد والتقليب السلس */
.card-3d-box {
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: 1fr;
  width: 100%;
  border-radius: 26px;
  perspective: 1600px;
  cursor: pointer;
  position: relative;
}

.card-face {
  grid-area: 1 / 1 / 2 / 2;
  width: 100%;
  border-radius: 26px;
  background: var(--card-bg);
  border: 1.8px solid var(--card-border);
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.8),
              0 0 40px rgba(255, 215, 0, 0.22),
              inset 0 0 25px rgba(255, 215, 0, 0.06);
  backdrop-filter: blur(25px);
  backface-visibility: hidden;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.5s ease;
  overflow: hidden;
}

/* الغلاف الخارجي للبطاقة */
.card-front {
  position: relative;
  padding: 3.5rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 480px;
  background: radial-gradient(circle at 50% 30%, #221850 0%, #120e2e 60%, #0a071c 100%);
  transform: rotateY(0deg);
  opacity: 1;
  z-index: 2;
}

/* الزوايا الذهبية الزخرفية */
.gold-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--gold-primary);
  border-style: solid;
  opacity: 0.8;
  pointer-events: none;
}

.top-left {
  top: 15px;
  left: 15px;
  border-width: 2.5px 0 0 2.5px;
  border-top-left-radius: 12px;
}

.top-right {
  top: 15px;
  right: 15px;
  border-width: 2.5px 2.5px 0 0;
  border-top-right-radius: 12px;
}

.bottom-left {
  bottom: 15px;
  left: 15px;
  border-width: 0 0 2.5px 2.5px;
  border-bottom-left-radius: 12px;
}

.bottom-right {
  bottom: 15px;
  right: 15px;
  border-width: 0 2.5px 2.5px 0;
  border-bottom-right-radius: 12px;
}

/* الختم الشمعي الفاخر */
.wax-seal {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 1.8rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seal-inner {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #e60039 0%, #a00025 65%, #660017 100%);
  border: 3px double #ffd700;
  box-shadow: 0 0 25px rgba(230, 0, 57, 0.7),
              0 8px 20px rgba(0, 0, 0, 0.5),
              inset 0 2px 6px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  z-index: 2;
  animation: sealGlowPulse 2.5s infinite alternate;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wax-seal:hover .seal-inner {
  transform: scale(1.08) rotate(12deg);
}

@keyframes sealGlowPulse {
  0% { box-shadow: 0 0 15px rgba(230, 0, 57, 0.6), 0 5px 15px rgba(0,0,0,0.4); }
  100% { box-shadow: 0 0 35px rgba(255, 215, 0, 0.8), 0 0 22px rgba(230, 0, 57, 0.9); }
}

.front-title {
  font-family: var(--font-kufi);
  font-size: 1.9rem;
  letter-spacing: 1px;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.6rem;
}

.front-subtitle {
  font-size: 1.3rem;
  color: #ffccd5;
  margin-bottom: 2.2rem;
  font-weight: 600;
}

/* التلميح التفاعلي لفتح البطاقة */
.tap-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.6rem;
  border-radius: 30px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.5);
  color: #fff3b0;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.25);
  animation: tapPulse 1.8s infinite;
}

@keyframes tapPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.25);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 32px rgba(255, 215, 0, 0.65);
  }
}

/* ========================================================
   الوجه الداخلي للبطاقة (المحتوى النقي الفاخر بعد الفتح)
   ======================================================== */
.card-inside {
  padding: 2.4rem 1.8rem;
  opacity: 0;
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 25%, #1d1445 0%, #100b2e 60%, #09061a 100%);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}

.inside-border {
  border: 1.5px solid rgba(255, 215, 0, 0.35);
  border-radius: 20px;
  padding: 2.2rem 1.5rem;
  background: rgba(14, 10, 31, 0.65);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6),
              0 0 20px rgba(255, 215, 0, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.greeting-subtitle {
  font-size: 1.05rem;
  color: #ffccd5;
  text-align: center;
  margin-bottom: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* عنوان التهنئة الرئيسي بتصميم ملكي */
.main-greeting {
  text-align: center;
  line-height: 1.35;
  margin-bottom: 1.4rem;
}

.greeting-line {
  display: block;
}

.line-1 {
  font-family: 'Amiri', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.line-engineer {
  font-family: var(--font-kufi);
  font-size: 1.6rem;
  color: #70d6ff;
  letter-spacing: 0.5px;
  margin-top: 0.3rem;
  text-shadow: 0 0 18px rgba(112, 214, 255, 0.65);
}

.line-name {
  font-family: 'Amiri', serif;
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-top: 0.1rem;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 215, 0, 0.85));
  animation: goldenShine 3s ease-in-out infinite alternate;
}

@keyframes goldenShine {
  0% { filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.6)); }
  100% { filter: drop-shadow(0 0 38px rgba(255, 225, 80, 0.95)) brightness(1.15); }
}

/* الفاصل الزخرفي الهندسي */
.divider-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin: 1.1rem 0;
}

.divider-line .line {
  height: 1.5px;
  width: 50px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
}

.divider-line .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--gold-primary);
}

.badge-icon {
  font-size: 1.4rem;
  color: var(--gold-primary);
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

/* نص التمنيات الدافئ المريح للعين */
.wishes-text {
  text-align: center;
  font-size: 1.15rem;
  line-height: 1.95;
  color: #f1f2f6;
  margin-top: 0.6rem;
  padding: 0 0.8rem;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
}

/* ========================================================
   حالة فتح البطاقة (عند النقر)
   ======================================================== */
.card-3d-box.is-opened .card-front {
  transform: rotateY(-180deg);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.card-3d-box.is-opened .card-inside {
  transform: rotateY(0deg);
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

/* ========================================================
   التوافق مع الشاشات الصغيرة (الهواتف والأجهزة اللوحية)
   ======================================================== */
@media (max-width: 600px) {
  .scene-stage {
    height: 660px;
  }

  .rose-container {
    max-width: 380px;
    height: 620px;
  }

  .rose-container.settled {
    transform: translateY(115px) scale(0.76);
  }

  .card-wrapper {
    max-width: 94%;
    top: 46%;
  }

  .line-1 {
    font-size: 1.8rem;
  }

  .line-engineer {
    font-size: 1.35rem;
  }

  .line-name {
    font-size: 2.8rem;
  }

  .wishes-text {
    font-size: 1rem;
    line-height: 1.8;
  }

  .card-front {
    padding: 2.6rem 1.4rem;
    min-height: 420px;
  }

  .card-inside {
    padding: 1.8rem 1.2rem;
    min-height: 420px;
  }

  .wax-seal {
    width: 76px;
    height: 76px;
  }

  .seal-inner {
    width: 68px;
    height: 68px;
    font-size: 1.8rem;
  }
}
