/* Capweb Modern Evite Invitation Portal Styles */

:root {
  --color-primary: #1b4332;
  --color-primary-light: #2d6a4f;
  --color-accent: #40916c;
  --color-accent-light: #52b788;
  --color-cream: #faf8f5;
  --color-sand: #f3efe6;
  --color-border: #e6e2d8;
  --color-text-main: #1f2923;
  --color-text-muted: #5e6d62;
  --color-crimson: #8b111a;
  --color-crimson-dark: #63080e;
  --color-gold: #d4af37;
  --color-gold-light: #f7e7a9;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--color-cream);
}
::-webkit-scrollbar-thumb {
  background: #cbd5cb;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

::selection {
  background-color: rgba(212, 175, 55, 0.3);
  color: #63080e;
}

/* Glassmorphism */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.glass-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(230, 226, 216, 0.8);
  box-shadow: 0 10px 30px -5px rgba(27, 67, 50, 0.12), 0 4px 12px -2px rgba(27, 67, 50, 0.06);
}

.glass-dark {
  background: rgba(20, 42, 30, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

/* Falling Snowflakes Animation */
.snow-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.snowflake {
  position: absolute;
  top: -20px;
  color: rgba(255, 255, 255, 0.9);
  user-select: none;
  pointer-events: none;
  border-radius: 50%;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
  animation-name: fallDown, swaySnow;
  animation-iteration-count: infinite, infinite;
  animation-timing-function: linear, ease-in-out;
}

@keyframes fallDown {
  0% {
    top: -5%;
    opacity: 0.9;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    top: 105%;
    opacity: 0.2;
  }
}

@keyframes swaySnow {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(25px);
  }
}

/* ==========================================================================
   3D FESTIVE ENVELOPE & LETTER ANIMATION SYSTEM
   ========================================================================== */

.envelope-stage {
  perspective: 1600px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  height: 290px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transition: margin-top 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.envelope-stage.is-opened {
  margin-top: 72px;
}

.envelope-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 290px;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* Envelope Flipped State: Turns around 180 degrees */
.envelope-wrapper.is-flipped {
  transform: rotateY(180deg);
}

/* Faces: Back (initial view) & Front (flap/opening view) */
.envelope-side {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55), 0 0 25px rgba(212, 175, 55, 0.2);
}

/* 1. BACK OF ENVELOPE (INITIAL STATE) */
.envelope-side-back {
  background: linear-gradient(135deg, #87131b 0%, #aa1e28 45%, #6a0b12 100%);
  border: 2px solid #d4af37;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  z-index: 2;
}

/* Gold foil embossed border inside envelope back */
.envelope-side-back::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(212, 175, 55, 0.5);
  border-radius: 12px;
  pointer-events: none;
}

/* Decorative Christmas Watermark Background */
.envelope-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: radial-gradient(#ffd700 1.5px, transparent 1.5px), radial-gradient(#fff 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  pointer-events: none;
}

/* 2. FRONT OF ENVELOPE (FLAP SIDE) */
.envelope-side-front {
  transform: rotateY(180deg);
  background: #50080d;
  border-radius: 20px;
  border: 2px solid #d4af37;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

/* Inside pocket lining */
.envelope-inside-pocket {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1b4332 0%, #11291f 100%);
  border-radius: 18px;
  overflow: hidden;
  z-index: 1;
}

.envelope-inside-pocket::after {
  content: '❄';
  position: absolute;
  font-size: 80px;
  color: rgba(212, 175, 55, 0.12);
  top: 15%;
  right: 15%;
  pointer-events: none;
}

/* Top Flap (Triangular flap that hinges open) */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 145px;
  transform-origin: top center;
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  z-index: 15;
}

.envelope-flap-triangle {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #aa1e28 0%, #87131b 100%);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  border-top: 2px solid #d4af37;
  position: relative;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.4));
}

.envelope-wrapper.is-opened .envelope-flap {
  transform: rotateX(180deg);
  z-index: 2;
}

/* Wax Seal on Flap */
.wax-seal {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e63946, #9b111e 70%, #590d14 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.3), inset 0 -2px 3px rgba(0, 0, 0, 0.4);
  border: 1.5px solid #d4af37;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd700;
  font-size: 18px;
  transition: opacity 0.3s ease, transform 0.4s ease;
  z-index: 16;
}

.envelope-wrapper.is-opened .wax-seal {
  opacity: 0;
  transform: translateX(-50%) scale(0.6);
  pointer-events: none;
}

/* Front Pocket Body (Bottom and Side Folded flaps) */
.envelope-pocket-front {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 175px;
  background: linear-gradient(0deg, #87131b 0%, #a21c25 100%);
  clip-path: polygon(0 35%, 50% 0%, 100% 35%, 100% 100%, 0 100%);
  border-radius: 0 0 18px 18px;
  z-index: 10;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.25);
  border-bottom: 2px solid #d4af37;
}

/* 3. THE LETTER (CHRISTMAS PARTY INVITATION) */
.envelope-letter {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 16px;
  background: #fdfaf3;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  padding: 14px 14px;
  z-index: 5;
  opacity: 0;
  border: 2px solid #d4af37;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.9s cubic-bezier(0.34, 1.25, 0.64, 1), opacity 0.35s ease, box-shadow 0.8s ease;
  pointer-events: none;
}

/* Letter emerged and overlaying envelope */
.envelope-wrapper.is-opened .envelope-letter {
  transform: translateY(-70px) translateZ(50px) scale(1.03);
  opacity: 1;
  z-index: 25;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.65), 0 0 25px rgba(212, 175, 55, 0.35);
  pointer-events: auto;
  transition: transform 0.9s cubic-bezier(0.34, 1.25, 0.64, 1) 0.45s, opacity 0.35s ease 0.4s, box-shadow 0.8s ease 0.45s;
}

/* Ornate Border Inside Letter */
.letter-inner-frame {
  border: 1px solid rgba(184, 134, 11, 0.45);
  border-radius: 12px;
  padding: 14px 12px;
  position: relative;
  background: rgba(255, 255, 255, 0.6);
}

.letter-corner-ornament {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #b8860b;
}

.letter-corner-tl { top: 4px; left: 4px; border-right: none; border-bottom: none; }
.letter-corner-tr { top: 4px; right: 4px; border-left: none; border-bottom: none; }
.letter-corner-bl { bottom: 4px; left: 4px; border-right: none; border-top: none; }
.letter-corner-br { bottom: 4px; right: 4px; border-left: none; border-top: none; }

/* Open Invitation Trigger Button */
#btn-open-invitation {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.4);
}

#btn-open-invitation:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 25px rgba(212, 175, 55, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.6);
}

#btn-open-invitation:active {
  transform: translateY(1px) scale(0.98);
}

/* 4. ACTIONS CONTAINER BELOW THE LETTER */
#invitation-actions-container {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease, max-height 0.7s ease, margin-top 0.7s ease;
  pointer-events: none;
  position: relative;
  z-index: 30;
  margin-top: 0;
}

#invitation-actions-container.is-visible {
  opacity: 1;
  max-height: 320px;
  overflow: visible;
  transform: translateY(0);
  pointer-events: auto;
  margin-top: 24px;
}

/* Glow on "Merry Christmas" Text */
.holiday-glow-text {
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.2);
}

/* Accept & Reject Buttons */
#btn-accept-invite {
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
  border: 1.5px solid #52b788;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(27, 67, 50, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-accept-invite:hover {
  background: linear-gradient(135deg, #2d6a4f 0%, #40916c 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(45, 106, 79, 0.45), 0 0 15px rgba(82, 183, 136, 0.3);
}

#btn-accept-invite:active {
  transform: translateY(1px) scale(0.98);
}

#btn-reject-invite {
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid #dc2626;
  color: #991b1b;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.15);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-reject-invite:hover {
  background: #fef2f2;
  border-color: #b91c1c;
  color: #7f1d1d;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.25);
}

#btn-reject-invite:active {
  transform: translateY(1px) scale(0.98);
}

/* ==========================================================================
   MODAL & POP-UP STYLING
   ========================================================================== */

#modal-overlay {
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), backdrop-filter 0.3s ease;
}

#modal-content {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#modal-overlay.active #modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Provider Button Hover & Active States */
.provider-btn {
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.provider-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(27, 67, 50, 0.15);
}

.provider-btn:active {
  transform: translateY(0px) scale(0.98);
}

/* Focus Management for Accessibility */
button:focus-visible, 
a:focus-visible, 
input:focus-visible {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

/* Confetti Celebration Animation */
.confetti-piece {
  position: absolute;
  width: 9px;
  height: 15px;
  opacity: 0.95;
  border-radius: 2px;
  animation: confettiFall 3s ease-in-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(500px) rotate(720deg);
    opacity: 0;
  }
}
