* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Montserrat", sans-serif;
}

body {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: #0a1c14;
}

/* Improved Bokeh background effect using CSS */
.bokeh-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(ellipse at center, #1b4332 0%, #0a1c14 100%);
  overflow: hidden;
}

.bokeh-dot {
  position: absolute;
  border-radius: 50%;
  opacity: 0.4;
  filter: blur(8px);
  background: radial-gradient(circle at center, rgba(212, 175, 55, 0.7) 0%, rgba(212, 175, 55, 0) 70%);
  animation: float 20s infinite ease-in-out;
}

@keyframes float {
  0% {
    transform: translateY(0) translateX(0) scale(1) rotate(0deg);
    opacity: 0.4;
  }
  25% {
    transform: translateY(-25px) translateX(30px) scale(1.1) rotate(90deg);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-15px) translateX(-20px) scale(0.9) rotate(180deg);
    opacity: 0.8;
  }
  75% {
    transform: translateY(20px) translateX(-25px) scale(1.05) rotate(270deg);
    opacity: 0.5;
  }
  100% {
    transform: translateY(0) translateX(0) scale(1) rotate(360deg);
    opacity: 0.4;
  }
}

@keyframes drift {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  33% {
    transform: translateY(-30px) translateX(40px) rotate(120deg);
  }
  66% {
    transform: translateY(25px) translateX(-35px) rotate(240deg);
  }
  100% {
    transform: translateY(0) translateX(0) rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
}

@keyframes spiral {
  0% {
    transform: translateX(0) translateY(0) rotate(0deg) scale(1);
  }
  25% {
    transform: translateX(50px) translateY(-30px) rotate(90deg) scale(1.2);
  }
  50% {
    transform: translateX(0) translateY(-60px) rotate(180deg) scale(0.8);
  }
  75% {
    transform: translateX(-50px) translateY(-30px) rotate(270deg) scale(1.1);
  }
  100% {
    transform: translateX(0) translateY(0) rotate(360deg) scale(1);
  }
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
}

.card-container {
  width: 10cm;
  height: 16cm;
  position: relative;
  /* Gold border like in the image */
  background-color: #d4af37;
  border-radius: 2px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  background: linear-gradient(145deg, #e6c555 0%, #d4af37 40%, #b38728 100%);
  padding: 0.3cm;
  transform: translateY(-5px);
  transition: transform 0.3s ease;
}

.card {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.8s;
  transform-style: preserve-3d;
  transform-origin: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.card.flipped {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Dark forest green background for front card */
  background: #0f3a28;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  color: #f5f5f5;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Back card specific background with image and gradients */
.card-back {
  overflow: hidden; /* Ensure shadow stays within card bounds */
  /* Layer shadow behind main image by putting it last in the background stack */
  background: 
    /* Bottom fade gradient - image visible at top, fades to background at bottom 50% to cover text area */ linear-gradient(0deg, #0f3a28 0%, rgba(15, 58, 40, 0.8) 30%, rgba(15, 58, 40, 0.3) 45%, transparent 50%), /* Edge blending gradient for smoother alpha transitions */ radial-gradient(ellipse at center, transparent 60%, rgba(15, 58, 40, 0.1) 80%, rgba(15, 58, 40, 0.3) 95%),
    /* Main photo on top */ url("img/bgimagetransparent.png"), /* Shadow image offset behind */ url("img/bgimageshadow.png"), /* Fallback background color */ #0f3a28;
  background-size: cover, cover, cover, cover, cover;
  background-position: center, center, center, calc(50% - 4px) calc(50% - 4px), center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  position: relative;
}

/* Ensure front page is hidden when flipped */
.card.flipped .card-front {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}

/* Ensure back page is hidden when not flipped */
.card:not(.flipped) .card-back {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}

/* Ensure back page is visible when flipped */
.card.flipped .card-back {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

/* Ensure front page is visible when not flipped */
.card:not(.flipped) .card-front {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

.card-rsvp {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Regular background for RSVP card */
  background: #0f3a28;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  color: #f5f5f5;
  transform: translateZ(-1px);
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
  z-index: 2;
}

.card.show-rsvp .card-rsvp {
  transform: translateZ(0);
  opacity: 1;
  z-index: 10;
}

.card.show-rsvp .card-front,
.card.show-rsvp .card-back {
  opacity: 0;
  transform: translateZ(-1px);
  z-index: 1;
  pointer-events: none;
}

.inner-border {
  height: 100%;
  padding: 0.3cm;
  border: 1px solid rgba(212, 175, 55, 0.8);
  display: flex;
  flex-direction: column;
  transition: box-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.card-back {
  transform: rotateY(180deg);
}

.header {
  font-family: "Cormorant Garamond", serif;
  color: #d4af37;
  font-size: 0.8rem;
  text-align: center;
  padding-top: 1.2cm;
  letter-spacing: 1.2px;
  font-weight: 500;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subtitle {
  font-family: "Cormorant Garamond", serif;
  color: #d4af37;
  font-size: 1rem;
  text-align: center;
  padding-top: 0.4cm;
  letter-spacing: 1.2px;
  font-weight: 500;
  margin-bottom: 0.8cm;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.invitation-content {
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  position: relative;
}

.invitation-content h1 {
  color: #d4af37; /* Gold text like in the image */
  font-size: 1.2rem;
  margin-bottom: 0.15cm;
  font-weight: 500;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 2px;
  line-height: 1.2;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.invitation-content h2 {
  color: #d4af37; /* Gold text */
  font-size: 1.5rem;
  margin: 0.15cm 0;
  font-weight: 300;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 1px;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.date,
.time,
.venue,
.dress-code {
  color: #d4af37;
  font-size: 0.75rem;
  font-family: "Montserrat", sans-serif;
  margin: 0.15cm 0;
  letter-spacing: 1px;
  font-weight: 300;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.venue {
  max-width: 90%;
  line-height: 1.3;
}

.dress-code {
  margin-top: 0.5cm;
  margin-bottom: 0.8cm;
}

/* Photo placeholder commented out - using background image instead */
/* .photo-placeholder {
  width: 90%;
  height: 5.5cm;
  margin: 0.5cm auto;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(212, 175, 55, 0.3);
  overflow: hidden;
} */

/* Wedding photo styles commented out - using background image instead */
/* .wedding-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.1);
  transition: transform 2s ease-in-out;
}

.card-container:hover .wedding-photo {
  transform: scale(1);
} */

.placeholder-text {
  color: #d4af37;
  font-size: 1rem;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 1px;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.details-content {
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 1cm; /* Space from bottom */
}

.card-back h2 {
  color: #d4af37;
  font-size: 1.68rem;
  text-align: center;
  margin: 0 0 0.4cm 0;
  font-weight: 600;
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 1.5px;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.9), 1px 1px 3px rgba(0, 0, 0, 0.8), 0 0 8px rgba(15, 58, 40, 0.9), 0 0 12px rgba(244, 232, 124, 0.4), 0 0 25px rgba(244, 232, 124, 0.2);
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.decoration {
  width: 80%;
  height: 1px;
  background-color: rgba(212, 175, 55, 0.3);
  margin: 0.5cm 0;
  position: relative;
}

.decoration::before,
.decoration::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #d4af37;
  top: -2px;
}

.decoration::before {
  left: 0;
}

.decoration::after {
  right: 0;
}

.flip-btn,
.rsvp-btn {
  background-color: transparent;
  border: 1px solid #d4af37;
  color: #d4af37;
  padding: 8px 25px;
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  margin-top: 0.5cm;
  transition: all 0.3s ease, box-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 10;
}

.flip-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: rgba(212, 175, 55, 0.2);
  transition: all 0.3s ease;
  z-index: -1;
}

.flip-btn:hover {
  color: #fff;
  border-color: #d4af37;
  transform: translateY(-2px);
}

.flip-btn:hover::before {
  left: 0;
}

.rsvp-btn {
  background-color: rgba(212, 175, 55, 0.9);
  color: #0f3a28;
  margin-bottom: 0.3cm;
}

.rsvp-btn:hover {
  background-color: #d4af37;
  transform: translateY(-2px);
}

.additional-info,
.rsvp-info {
  color: #d4af37;
  font-size: 0.75rem;
  margin: 0.2cm 0;
  font-family: "Montserrat", sans-serif;
  letter-spacing: 1px;
  font-weight: 500;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RSVP Form Styles */
.rsvp-header {
  text-align: center;
  padding: 0.8cm 0 0.4cm 0;
}

.rsvp-header h2 {
  font-family: "Cormorant Garamond", serif;
  color: #d4af37;
  font-size: 1.4rem;
  letter-spacing: 1.2px;
  font-weight: 500;
  margin-bottom: 0.2cm;
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rsvp-subtitle {
  color: #d4af37;
  font-size: 0.7rem;
  font-family: "Montserrat", sans-serif;
  letter-spacing: 1px;
  font-weight: 300;
  opacity: 0.8;
}

.form-container {
  flex-grow: 1;
  padding: 0.3cm 0.1cm;
  overflow-y: auto;
  position: relative;
}

.custom-rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 0.6cm;
  height: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.2cm;
}

.form-label {
  color: #d4af37;
  font-family: "Montserrat", sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  margin-bottom: 0.1cm;
}

.required {
  color: #d4af37;
  margin-left: 2px;
}

.form-input,
.form-textarea {
  background: rgba(15, 58, 40, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 3px;
  color: #f5f5f5;
  font-family: "Montserrat", sans-serif;
  font-size: 0.65rem;
  padding: 0.25cm;
  transition: all 0.3s ease;
  resize: vertical;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #d4af37;
  background: rgba(15, 58, 40, 0.5);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: rgba(245, 245, 245, 0.5);
  font-style: italic;
}

.form-textarea {
  min-height: 2rem;
  font-family: "Montserrat", sans-serif;
  line-height: 1.4;
}

/* Radio Button Styling */
.radio-group {
  display: flex;
  flex-direction: row;
  gap: 0.5cm;
  margin-top: 0.1cm;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.2cm;
  cursor: pointer;
  padding: 0.15cm 0;
  flex: 1;
  min-width: 140px;
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(212, 175, 55, 0.6);
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.radio-custom::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4af37;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.radio-text {
  color: #f5f5f5;
  font-family: "Montserrat", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
}

/* Checkbox Styling */
.checkbox-group {
  margin-top: 0.2cm;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.3cm;
  cursor: pointer;
  padding: 0.15cm 0;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(212, 175, 55, 0.6);
  border-radius: 3px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checkbox-custom::after {
  content: "✓";
  color: #d4af37;
  font-size: 12px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.checkbox-text {
  color: #f5f5f5;
  font-family: "Montserrat", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

/* Form Action Buttons */
.form-actions {
  display: flex;
  gap: 0.3cm;
  margin-top: 0.2cm; /* Reduced space from textarea */
  flex-wrap: wrap;
}

.submit-btn,
.clear-btn {
  flex: 1;
  min-width: 120px;
  padding: 0.25cm 0.4cm;
  border: 1px solid #d4af37;
  background: rgba(212, 175, 55, 0.9);
  color: #0f3a28;
  font-family: "Montserrat", sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.clear-btn {
  background: transparent;
  color: #d4af37;
}

.submit-btn:hover,
.clear-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.submit-btn:hover {
  background: #d4af37;
  color: #0f3a28;
}

.clear-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  color: #f5f5f5;
}

.submit-btn:active,
.clear-btn:active {
  transform: translateY(0);
}

/* Loading State */
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Form Responsiveness */
@media (max-width: 600px) {
  .form-container {
    padding: 0.2cm 0.05cm;
  }

  .custom-rsvp-form {
    gap: 0.4cm;
  }

  .form-label {
    font-size: 0.65rem;
  }

  .form-input,
  .form-textarea {
    font-size: 0.6rem;
    padding: 0.2cm;
  }

  .radio-group {
    flex-direction: column;
    gap: 0.3cm;
  }

  .radio-label {
    min-width: auto;
    gap: 0.3cm;
  }

  .radio-text,
  .checkbox-text {
    font-size: 0.6rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .submit-btn,
  .clear-btn {
    min-width: auto;
  }
}

.rsvp-actions {
  text-align: center;
  padding: 0.3cm 0;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  margin-top: 0.2cm;
}

.back-to-details-btn {
  background-color: transparent;
  border: 1px solid #d4af37;
  color: #d4af37;
  padding: 8px 25px;
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  transition: all 0.3s ease, box-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 10;
}

.back-to-details-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: rgba(212, 175, 55, 0.2);
  transition: all 0.3s ease;
  z-index: -1;
}

.back-to-details-btn:hover {
  color: #fff;
  border-color: #d4af37;
  transform: translateY(-2px);
}

.back-to-details-btn:hover::before {
  left: 0;
}

/* Golden Glow Effect */
.glow-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Mask to only show the border area, not the inner card */
  -webkit-mask: linear-gradient(black, black), linear-gradient(black, black);
  -webkit-mask-composite: xor;
  mask: linear-gradient(black, black), linear-gradient(black, black);
  mask-composite: subtract;
  -webkit-mask-size: 100% 100%, calc(100% - 0.6cm) calc(100% - 0.6cm);
  mask-size: 100% 100%, calc(100% - 0.6cm) calc(100% - 0.6cm);
  -webkit-mask-position: 0 0, 0.3cm 0.3cm;
  mask-position: 0 0, 0.3cm 0.3cm;
  -webkit-mask-repeat: no-repeat, no-repeat;
  mask-repeat: no-repeat, no-repeat;
}

.card-container:hover .glow-overlay {
  opacity: 1;
}

.glow-mask {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.4) 30%, rgba(255, 255, 255, 0.1) 60%, transparent 100%);
  filter: blur(10px);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 1.3s cubic-bezier(0.4, 0, 0.2, 1), filter 1.3s ease, transform 1.3s ease;
  mix-blend-mode: color-dodge;
}

/* Golden border glow effect */
.golden-border-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
  background: radial-gradient(circle 120px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(244, 232, 124, 0.6) 0%, rgba(244, 232, 124, 0.3) 40%, transparent 80%);
  filter: blur(8px);
  mix-blend-mode: color-dodge;
}

.glow-inner-border {
  position: absolute;
  top: 0.3cm;
  left: 0.3cm;
  right: 0.3cm;
  bottom: 0.3cm;
  border: 1px solid #f4e87c;
  border-radius: 1px;
  pointer-events: none;
  z-index: 7;
  opacity: 0;
  filter: blur(1px) brightness(1.5);
  transition: opacity 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(244, 232, 124, 0.4), inset 0 0 10px rgba(244, 232, 124, 0.2);
}

/* Enhanced golden text glow on hover */
.card-container:hover .header,
.card-container:hover .subtitle,
.card-container:hover h1,
.card-container:hover h2,
.card-container:hover .date,
.card-container:hover .time,
.card-container:hover .venue,
.card-container:hover .dress-code,
.card-container:hover .placeholder-text,
.card-container:hover .card-back h2,
.card-container:hover .additional-info,
.card-container:hover .rsvp-info,
.card-container:hover .rsvp-header h2,
.card-container:hover .rsvp-subtitle,
.card-container:hover .form-label {
  text-shadow: 0 0 10px rgba(244, 232, 124, 0.3), 0 0 20px rgba(244, 232, 124, 0.2), 0 0 30px rgba(244, 232, 124, 0.1);
  transition: text-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced button glow */
.card-container:hover .flip-btn,
.card-container:hover .rsvp-btn,
.card-container:hover .back-to-details-btn,
.card-container:hover .submit-btn,
.card-container:hover .clear-btn {
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3), inset 0 0 10px rgba(212, 175, 55, 0.1);
  transition: box-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced border glow */
.card-container:hover .inner-border {
  box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.2), 0 0 20px rgba(212, 175, 55, 0.1);
  transition: box-shadow 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .card-container {
    width: 90vw;
    height: clamp(500px, 90vh, 800px); /* Dynamic height based on viewport */
    min-height: 500px; /* Ensure minimum usable height */
  }

  /* Front page mobile adjustments */
  .card-front .inner-border {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center everything vertically */
    padding-top: clamp(1cm, 8vh, 1.5cm); /* Equal top/bottom padding */
    padding-bottom: clamp(1cm, 8vh, 1.5cm);
  }

  .card-front .header {
    font-size: clamp(0.6rem, 2.5vw, 0.7rem);
    padding-top: 0; /* Remove individual padding */
    letter-spacing: 1px;
  }

  .card-front .subtitle {
    font-size: clamp(0.8rem, 3vw, 0.9rem);
    padding-top: clamp(0.3cm, 2vh, 0.4cm);
    margin-bottom: clamp(0.8cm, 6vh, 1.2cm); /* More space below subtitle */
    letter-spacing: 1px;
  }

  /* Make invitation content more adaptive */
  .card-front .invitation-content {
    justify-content: flex-start;
    padding: 0;
    gap: clamp(0.8cm, 6vh, 1.2cm); /* Bigger gaps between sections */
    flex-grow: 0; /* Don't grow to fill space */
  }

  /* Group the names section */
  .card-front .names-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.1cm, 1vh, 0.15cm);
  }

  /* Group the details section */
  .card-front .details-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.15cm, 1.5vh, 0.2cm);
    margin-top: 0;
  }

  /* Button section */
  .card-front .button-section {
    margin-top: 0; /* Remove extra margin, let the gap handle it */
    padding-top: 0;
  }

  .card-front .names-section h1 {
    font-size: clamp(1.1rem, 5vw, 1.3rem); /* Bigger names */
    margin: 0;
    letter-spacing: 1.5px;
  }

  .card-front .names-section h2 {
    font-size: clamp(1.3rem, 6vw, 1.5rem); /* Bigger ampersand */
    margin: 0;
  }

  .card-front .details-section .date,
  .card-front .details-section .time,
  .card-front .details-section .venue,
  .card-front .details-section .dress-code {
    font-size: clamp(0.65rem, 3.5vw, 0.75rem); /* Slightly bigger details */
    margin: 0;
    letter-spacing: 0.8px;
  }

  .card-front .button-section .flip-btn {
    padding: 8px 25px; /* Bigger button */
    font-size: clamp(0.6rem, 2.5vw, 0.65rem);
    margin: 0;
    letter-spacing: 1.2px;
  }

  /* Back page (details) mobile adjustments */
  .card-back .inner-border {
    padding: clamp(0.3cm, 2vh, 0.4cm) clamp(0.2cm, 2vh, 0.25cm);
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: flex-end; /* Push content to bottom */
  }

  .card-back h2 {
    font-size: clamp(1.2rem, 4.8vw, 1.32rem);
    margin: 0 0 clamp(0.3cm, 2vh, 0.4cm) 0;
    letter-spacing: 1.2px;
    flex-shrink: 0;
  }

  .photo-placeholder {
    height: clamp(3cm, 25vh, 4.5cm);
    margin: 0 auto clamp(0.3cm, 2vh, 0.4cm) auto;
    flex-shrink: 0;
  }

  .decoration {
    margin: 0 0 clamp(0.3cm, 2vh, 0.4cm) 0;
    flex-shrink: 0;
  }

  .details-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.3cm, 2vh, 0.4cm);
    /* Position content in bottom 35% of card */
    height: 35vh;
    max-height: 35%;
    justify-content: flex-start;
    flex-shrink: 0;
  }

  /* Group the ceremony info together */
  .card-back .info-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.1cm, 1vh, 0.15cm);
    margin: 0;
  }

  .additional-info,
  .rsvp-info {
    font-size: clamp(0.6rem, 3vw, 0.65rem);
    margin: 0;
    letter-spacing: 0.8px;
  }

  .rsvp-info {
    margin: clamp(0.2cm, 1.5vh, 0.3cm) 0; /* Reduced space around RSVP info */
  }

  /* Group buttons side by side */
  .card-back .button-group {
    display: flex;
    flex-direction: row; /* Changed to row for side-by-side layout */
    align-items: center;
    gap: clamp(0.3cm, 2vh, 0.4cm);
    margin: 0;
    padding-bottom: clamp(0.3cm, 2vh, 0.4cm);
    flex-wrap: wrap; /* Allow wrapping on very small screens */
    justify-content: center;
  }

  .card-back .rsvp-btn,
  .card-back .flip-btn {
    padding: 8px 25px;
    font-size: clamp(0.6rem, 2.5vw, 0.65rem);
    margin: 0;
    letter-spacing: 1.2px;
    min-width: 0; /* Allow buttons to shrink on small screens */
    flex: 1;
    max-width: 45%; /* Ensure buttons don't get too wide side by side */
  }

  /* Adjust background image positioning on mobile to show more of right person's face */
  .card-back {
    background-position: center, /* Bottom fade gradient */ center, /* Edge blending gradient */ calc(50% - 5%) center, /* Main photo - shift 5% left to show more of right person */ calc(50% - 5% - 4px) calc(50% - 4px), /* Shadow image - maintain offset */ center; /* Fallback background */
  }

  /* RSVP form mobile adjustments */
  .card-rsvp .inner-border {
    padding: clamp(0.5cm, 4vh, 0.8cm) clamp(0.2cm, 2vh, 0.25cm); /* Less vertical padding */
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .rsvp-header {
    padding: 0 0 clamp(0.3cm, 2vh, 0.4cm) 0; /* Less bottom padding */
    flex-shrink: 0;
  }

  .rsvp-header h2 {
    font-size: clamp(1.1rem, 4.5vw, 1.2rem); /* Bigger title */
    letter-spacing: 1px;
    margin-bottom: clamp(0.1cm, 1vh, 0.15cm);
  }

  .rsvp-subtitle {
    font-size: clamp(0.65rem, 3vw, 0.7rem); /* Bigger subtitle */
  }

  .form-container {
    padding: 0;
    flex-grow: 1;
    min-height: 0; /* Allow shrinking */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  .custom-rsvp-form {
    gap: clamp(0.3cm, 2.5vh, 0.5cm); /* Tighter space between form groups */
    height: 100%;
    justify-content: flex-start;
    padding: 0 clamp(0.1cm, 1vw, 0.2cm);
  }

  .form-group {
    gap: clamp(0.2cm, 1.5vh, 0.25cm);
  }

  .form-label {
    font-size: clamp(0.7rem, 3.5vw, 0.75rem); /* Much bigger labels */
    margin-bottom: 0;
    font-weight: 500;
  }

  .form-input,
  .form-textarea {
    font-size: clamp(0.7rem, 3.5vw, 0.8rem); /* Bigger input text */
    padding: clamp(0.3cm, 2vh, 0.4cm);
    border-radius: 4px;
    -webkit-appearance: none; /* Remove iOS default styling */
    appearance: none;
  }

  /* Ensure proper touch targets for mobile */
  .form-input,
  .form-textarea,
  .radio-label,
  .checkbox-label {
    min-height: 44px; /* iOS recommended touch target */
  }

  .form-textarea {
    min-height: clamp(2rem, 8vh, 3rem);
    resize: vertical;
  }

  .radio-group {
    flex-direction: row; /* Side by side */
    gap: clamp(0.5cm, 3vw, 0.8cm);
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .radio-label {
    min-width: auto;
    flex: 1;
    gap: 0.2cm;
    padding: clamp(0.15cm, 1vh, 0.2cm) clamp(0.1cm, 1vw, 0.15cm);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }

  .radio-custom,
  .checkbox-custom {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .radio-text,
  .checkbox-text {
    font-size: clamp(0.55rem, 2.5vw, 0.65rem); /* Slightly smaller to fit better */
    white-space: nowrap; /* Prevent text wrapping */
  }

  .form-actions {
    flex-direction: column;
    gap: clamp(0.2cm, 1.5vh, 0.3cm); /* Reduced gap between buttons */
    margin-top: clamp(0.2cm, 1.5vh, 0.3cm); /* Even less space from textarea */
    flex-shrink: 0;
    padding-bottom: clamp(0.2cm, 1.5vh, 0.3cm); /* Less bottom padding */
  }

  .submit-btn,
  .clear-btn {
    min-width: auto;
    padding: clamp(0.35cm, 2.5vh, 0.45cm) 0.5cm;
    font-size: clamp(0.65rem, 3vw, 0.7rem); /* Bigger button text */
    min-height: 44px; /* Touch target */
  }

  .rsvp-actions {
    padding: clamp(0.3cm, 2vh, 0.4cm) 0;
    margin-top: 0;
    flex-shrink: 0;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
  }

  .back-to-details-btn {
    padding: 6px 20px;
    font-size: 0.6rem;
    letter-spacing: 1.2px;
  }

  /* Reduce inner border padding for all cards */
  .inner-border {
    padding: clamp(0.2cm, 2vh, 0.25cm);
  }

  /* Ensure RSVP card stays within bounds on mobile */
  .card-rsvp {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }
}

/* Additional responsiveness for very tall phones */
@media (max-width: 600px) and (min-height: 800px) {
  .card-container {
    height: clamp(600px, 85vh, 900px); /* Allow more height on tall phones */
  }

  .card-front .invitation-content {
    gap: clamp(1cm, 8vh, 1.5cm); /* More generous spacing on tall phones */
  }

  .photo-placeholder {
    height: clamp(4cm, 30vh, 6cm) !important; /* Larger photo on tall phones */
  }
}

/* Adjustments for very short phones */
@media (max-width: 600px) and (max-height: 650px) {
  .card-container {
    height: 95vh; /* Use almost full height on short phones */
    min-height: 450px;
  }

  .card-front .inner-border {
    padding-top: clamp(0.5cm, 5vh, 0.8cm); /* Smaller equal padding for short phones */
    padding-bottom: clamp(0.5cm, 5vh, 0.8cm);
  }

  .card-front .subtitle {
    margin-bottom: clamp(0.3cm, 3vh, 0.5cm);
  }

  .photo-placeholder {
    height: 2.5cm !important; /* Smaller photo on short phones */
  }

  .card-front .invitation-content {
    gap: clamp(0.5cm, 4vh, 0.7cm); /* Tighter spacing on short phones */
  }
}

/* Custom Scrollbar Styling */
.form-container::-webkit-scrollbar {
  width: 8px;
}

.form-container::-webkit-scrollbar-track {
  background: rgba(15, 58, 40, 0.3);
  border-radius: 4px;
}

.form-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #d4af37 0%, #b38728 100%);
  border-radius: 4px;
  border: 1px solid rgba(15, 58, 40, 0.2);
}

.form-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #e6c555 0%, #d4af37 100%);
  box-shadow: 0 0 4px rgba(212, 175, 55, 0.3);
}

.form-container::-webkit-scrollbar-corner {
  background: rgba(15, 58, 40, 0.3);
}

/* Firefox scrollbar styling */
.form-container {
  scrollbar-width: thin;
  scrollbar-color: #d4af37 rgba(15, 58, 40, 0.3);
}
