/* Global Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', 'Hind Vadodara', sans-serif;
  background: #1a1614;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout styling */
.app-container {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Styles */
.sidebar {
  width: 400px;
  min-width: 360px;
  flex-shrink: 0;
  background: #231d18;
  color: #e6dfd8;
  padding: 20px 18px;
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  border-right: 1px solid #3d352e;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 20;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #50443b;
  border-radius: 4px;
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #e5b375;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.sidebar-header p {
  font-size: 13px;
  color: #a89f91;
  line-height: 1.4;
}

.form-section {
  background: #2e2823;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #443b33;
}

.form-section h3 {
  font-size: 14px;
  color: #deb479;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  font-weight: 600;
  border-bottom: 1px dashed #4e433b;
  padding-bottom: 6px;
}

.field {
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 12px;
  color: #c5bbb0;
  margin-bottom: 5px;
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  background: #1e1916;
  border: 1px solid #4d4137;
  border-radius: 6px;
  color: #fff;
  font-family: 'Hind Vadodara', 'Poppins', sans-serif;
  font-size: 13px;
  transition: all 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #d19a4e;
  box-shadow: 0 0 0 2px rgba(209, 154, 78, 0.25);
}

.photo-upload-box {
  background: linear-gradient(135deg, #372a1e 0%, #2b221b 100%);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #634b2e;
}

.upload-btn-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #c48b3b, #a56f26);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(196, 139, 59, 0.3);
}

.upload-btn-label:hover {
  background: linear-gradient(135deg, #d39844, #b87d2d);
  transform: translateY(-1px);
}

#photoUpload {
  display: none;
}

.photo-controls {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #4a3d2e;
  font-size: 12px;
}

.photo-controls label {
  color: #d1b897;
  display: block;
  margin-bottom: 4px;
}

.photo-controls input[type="range"] {
  width: 100%;
  accent-color: #d19a4e;
  margin-bottom: 10px;
}

.pos-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  position: sticky;
  bottom: 0;
  background: #25201c;
  padding-top: 10px;
  border-top: 1px solid #3d352e;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #32db79, #2bb966);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.45);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #2ae26d, #149c8c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.btn-secondary {
  background: #3e352d;
  color: #e5b375;
  border: 1px solid #615041;
}

.btn-secondary:hover {
  background: #4d4239;
  color: #fff;
}

/* Preview Area */
.preview-area {
  flex: 1;
  background: radial-gradient(circle at center, #2e2620 0%, #151210 100%);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

.preview-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: #c9bdae;
  font-size: 14px;
  font-weight: 500;
}

.badge {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.card-wrapper {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  max-width: 100%;
}

/* THE INVITATION CARD (Exact replica of traditional Gujarati design) */
.invitation-card {
  width: 650px;
  height: 920px;
  background: radial-gradient(ellipse at 50% 36%, #fffef8 0%, #fbf1de 32%, #ebd2a7 68%, #d5a567 100%);
  color: #3b1902;
  position: relative;
  overflow: hidden;
  padding: 16px;
  box-sizing: border-box;
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
  user-select: none;
}

/* Subtle Damask watermark in background */
.card-bg-damask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.10;
  pointer-events: none;
  background-image: radial-gradient(#6e4010 1.5px, transparent 1.5px),
    radial-gradient(#6e4010 1.5px, #ecd9bd 1.5px);
  background-size: 26px 26px;
  background-position: 0 0, 13px 13px;
}

/* Large corner watermark flourishes */
.bg-watermark {
  position: absolute;
  width: 210px;
  height: 210px;
  pointer-events: none;
  opacity: 0.12;
  z-index: 0;
}

.bg-watermark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: sepia(1) saturate(1.8) hue-rotate(-15deg);
}

.bg-watermark-tl {
  top: 10px;
  left: 10px;
}

.bg-watermark-tr {
  top: 10px;
  right: 10px;
  transform: scaleX(-1);
}

.bg-watermark-bl {
  bottom: 10px;
  left: 10px;
  transform: scaleY(-1);
}

.bg-watermark-br {
  bottom: 10px;
  right: 10px;
  transform: scale(-1, -1);
}

/* Outer Border Frame (Slim, Elegant & Clean) */
.card-outer-border {
  width: 100%;
  height: 100%;
  border: 2.5px solid #7c4113;
  box-sizing: border-box;
  padding: 3px;
  position: relative;
  background: transparent;
  box-shadow: inset 0 0 0 2px #f4e8d3,
              inset 0 0 0 3.5px #92531e;
}

/* Inner Border Container (Distributes vertical space evenly so no empty gaps remain) */
.card-inner-border {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 24px 28px 20px 28px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  z-index: 2;
}

/* Connecting double runners between corner flourishes */
.runner {
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.runner-top {
  top: 19px;
  left: 80px;
  right: 80px;
  height: 4px;
  border-top: 1px solid #b36e26;
  border-bottom: 1px solid #b36e26;
}

.runner-bottom {
  bottom: 19px;
  left: 80px;
  right: 80px;
  height: 4px;
  border-top: 1px solid #b36e26;
  border-bottom: 1px solid #b36e26;
}

.runner-left {
  left: 19px;
  top: 80px;
  bottom: 80px;
  width: 4px;
  border-left: 1px solid #b36e26;
  border-right: 1px solid #b36e26;
}

.runner-right {
  right: 19px;
  top: 80px;
  bottom: 80px;
  width: 4px;
  border-left: 1px solid #b36e26;
  border-right: 1px solid #b36e26;
}

/* Corner Filigrees (Authentic Royal Flourish) */
.corner-ornament {
  position: absolute;
  width: 72px;
  height: 72px;
  pointer-events: none;
  z-index: 5;
}

.corner-ornament img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.corner-tl {
  top: 13px;
  left: 13px;
}

.corner-tr {
  top: 13px;
  right: 13px;
  transform: scaleX(-1);
}

.corner-bl {
  bottom: 13px;
  left: 13px;
  transform: scaleY(-1);
}

.corner-br {
  bottom: 13px;
  right: 13px;
  transform: scale(-1, -1);
}

/* Top Header */
/* Top Header */
.card-header {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.header-title-img {
  max-width: 355px;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.header-title {
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
  font-size: 34px;
  font-weight: 700;
  color: #381803;
  letter-spacing: 1.5px;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
}

/* Photo & Ritual Decor Section */
.photo-decor-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0;
  width: 100%;
  position: relative;
  gap: 0px;
}

/* Side Decor with images/img_side.png */
.side-img-wrapper {
  width: 95px;
  height: 125px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
  margin-bottom: 12px;
}

.side-decor-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
}

.side-decor-img.flipped {
  transform: scaleX(-1);
}

.side-left {
  margin-right: -44px;
}

.side-right {
  margin-left: -44px;
}

/* Center Frame Container */
.frame-container {
  position: relative;
  width: 236px;
  height: 237.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

/* The photo sits inside transparent mask container */
.photo-oval-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent !important;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-oval-mask:active {
  cursor: grabbing;
}

.clipped-photo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

/* Overlay image with ornate golden border and roses at bottom */
.frame-overlay-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 6px 12px rgba(60, 25, 5, 0.25));
}

/* Person Name Section */
.person-name-section {
  margin: 0;
}

.person-name {
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
  font-size: 29px;
  font-weight: 800;
  color: #351402;
  letter-spacing: 0.8px;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
}

.gold-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 0;
  width: 300px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #a56722, #a56722, transparent);
  position: relative;
}

.divider-diamond {
  width: 7px;
  height: 7px;
  background: #904f14;
  transform: rotate(45deg);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

/* Invitation Text Block */
.invitation-text-block {
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
  font-size: 17px;
  line-height: 1.68;
  color: #371d05;
  font-weight: 600;
  margin: 0;
  max-width: 565px;
}

.invitation-text-block p {
  margin-bottom: 3px;
}

.msg-lead {
  font-size: 17px;
  font-weight: 600;
}

.msg-strong {
  font-size: 20px;
  font-weight: 800;
  color: #2b0f00;
}

.msg-closing {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 700;
}

/* Info Sections */
.info-section {
  margin: 0;
  font-size: 17px;
  line-height: 1.62;
  color: #371d05;
  font-weight: 600;
  max-width: 550px;
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
}

.section-badge {
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
  font-size: 22.5px;
  font-weight: 800;
  color: #301000;
  margin-bottom: 5px;
  letter-spacing: 1px;
}

.highlight-line {
  font-weight: 800;
  color: #220b00;
}

.underline {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  font-weight: 800;
}

.nimantrak-list p,
.venue-address p {
  font-family: 'Noto Serif Gujarati', 'Rasa', serif;
  font-size: 17.5px;
  font-weight: 700;
  color: #301301;
  margin-bottom: 3px;
  line-height: 1.55;
}

.venue-section {
  margin-bottom: 0;
}

/* Bottom decorative flourish bar */
.card-bottom-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 320px;
  margin: 0;
}

.flourish-side-line {
  flex: 1;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #b36e26, #b36e26, transparent);
}

.flourish-center-ornament {
  color: #945318;
  font-size: 16px;
  line-height: 1;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #3d352e;
    max-height: 450px;
  }

  .preview-area {
    padding: 20px 10px;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

/* Print Specific Rules for High Quality Full Bleed Export */
@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
  }

  .sidebar,
  .preview-header-bar {
    display: none !important;
  }

  .app-container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .preview-area {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  .card-wrapper {
    box-shadow: none !important;
    width: 100% !important;
    height: 100% !important;
  }

  .invitation-card {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 18px !important;
    page-break-after: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}