/* Container for Polaroid Page */
.polaroid-section {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 20;
  position: relative;
  width: 100%;
  max-width: 420px;
  animation: cardIn .7s cubic-bezier(.34, 1.56, .64, 1) both;
}

/* إعداد المشهد للـ 3D */
.polaroid-scene {
  width: 280px;
  height: 340px;
  perspective: 1000px; /* لعمق الـ 3D */
  margin: 30px auto;
  cursor: pointer;
}

/* الكارت نفسه وحركته */
.polaroid-card {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* حركة Smooth Bounce */
  transform-style: preserve-3d;
}

.polaroid-card.is-flipped {
  transform: rotateY(180deg);
}

/* الوجوه (الأمامي والخلفي) */
.polaroid-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: #fcfcfc; /* لون ورق البولارويد */
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* الوجه الخلفي معكوس من البداية */
.polaroid-back {
  transform: rotateY(180deg);
  justify-content: center;
  align-items: center;
  text-align: center;
  background: #fdfbf7;
}

/* منطقة الصورة الأمامية */
.polaroid-photo {
  flex-grow: 1;
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #feada6 100%);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.4), inset 0 2px 10px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
}

/* Cinematic Texture/Noise Layer */
.polaroid-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.08;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Subtle Ambient Glow */
.polaroid-photo::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  animation: ambientGlow 8s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes ambientGlow {
  0% { transform: translate3d(-10%, -10%, 0); }
  100% { transform: translate3d(10%, 10%, 0); }
}

.hint-text {
  color: #fff;
  font-weight: bold;
  font-size: 0.9rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

/* نصوص البولارويد (خط اليد) */
.polaroid-caption {
  margin-top: 15px;
  text-align: center;
  font-family: 'Tajawal', sans-serif;
  color: #4a4a4a;
  font-size: 0.95rem;
  line-height: 1.4;
}

.polaroid-caption p {
  margin: 5px 0;
}

/* ستايل زر الهينت */
.hint-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  margin-bottom: 5px;
}
.hint-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}
.hint-btn:active {
  transform: translateY(1px);
}

/* حاوية الهينتات */
.hint-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  transition: all 0.3s ease;
}

.hint-line {
  margin: 0;
  font-size: 0.9rem;
  color: #333;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease, height 0.5s ease;
  height: auto;
}

.hint-line.hidden {
  opacity: 0;
  height: 0;
  margin: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.polaroid-caption .sub-text {
  font-size: 0.8rem;
  color: #888;
  margin: 5px 0 15px 0;
  font-weight: normal;
}

/* تنسيق حقل الإدخال والزر */
.polaroid-back input {
  width: 90%;
  padding: 10px;
  margin: 15px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  font-family: 'Tajawal', sans-serif;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  box-sizing: border-box;
}

.polaroid-back input:focus {
  border-color: #ff9a9e;
  box-shadow: 0 0 8px rgba(255, 154, 158, 0.4);
}

.polaroid-back button {
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  border: none;
  padding: 10px 25px;
  border-radius: 20px;
  color: #4a4a4a;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 154, 158, 0.3);
  transition: transform 0.2s;
  font-family: 'Tajawal', sans-serif;
}

.polaroid-back button:active {
  transform: scale(0.95);
}

.hidden-msg {
  display: none;
  color: #28a745;
  margin-top: 15px;
  font-weight: bold;
}

/* Override: charisma-success when revealed */
p.charisma-success:not(.hidden-msg) {
  display: block;
}
