/* =============================================================================
   VowsProfile - Matrimonial Biodata Generator App Stylesheet
   Modern, luxury dark & gold UI with responsive split-screen layout
   Scoped strictly under #generator-app and .editor-* to prevent CSS clashes
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Outfit:wght@300;400;500;600;700&family=Marcellus&display=swap');

:root {
  --app-bg: #12100e;
  --app-panel-bg: #181512;
  --app-card-bg: #201c18;
  --app-card-border: rgba(200, 148, 85, 0.22);
  --app-card-border-focus: rgba(200, 148, 85, 0.65);
  --app-gold: #c89455;
  --app-gold-bright: #e4b378;
  --app-gold-deep: #9f6733;
  --app-text: #eae0d5;
  --app-text-muted: #a69888;
  --app-input-bg: #14110f;
  --app-input-border: #382f27;
  --app-input-border-focus: #c89455;
  --app-radius: 8px;
  --app-radius-lg: 12px;
  --app-transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --preview-scale: 1;
}

/* Global resets for the generator shell */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  background: var(--app-bg);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--app-text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#generator-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--app-bg);
}

/* === TOP ACTION BAR === */
.app-header {
  height: 62px;
  min-height: 62px;
  background: linear-gradient(180deg, #1e1915 0%, #171310 100%);
  border-bottom: 1px solid var(--app-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c89455 0%, #7d4e22 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 2px 10px rgba(200, 148, 85, 0.35);
}

.brand-title {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: #fff;
  font-weight: 700;
}

.brand-title span {
  color: var(--app-gold-bright);
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(200, 148, 85, 0.15);
  color: var(--app-gold-bright);
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(200, 148, 85, 0.3);
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--app-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--app-transition);
  outline: none;
  user-select: none;
}

.btn-ghost {
  background: transparent;
  color: var(--app-text-muted);
  border-color: var(--app-card-border);
}

.btn-ghost:hover {
  background: rgba(200, 148, 85, 0.1);
  color: var(--app-text);
  border-color: var(--app-gold);
}

.btn-gold {
  background: linear-gradient(135deg, #d9a05e 0%, #b87b3b 100%);
  color: #1a0e05;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(200, 148, 85, 0.3);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #e4b378 0%, #c88844 100%);
  box-shadow: 0 6px 20px rgba(200, 148, 85, 0.45);
  transform: translateY(-1px);
}

.btn-gold:active {
  transform: translateY(0);
}

.btn-gold:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26, 14, 5, 0.25);
  border-top-color: #1a0e05;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Zoom controls in header */
.zoom-controls {
  display: flex;
  align-items: center;
  background: var(--app-card-bg);
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-radius);
  padding: 2px;
}

.zoom-btn {
  background: transparent;
  border: none;
  color: var(--app-text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: var(--app-transition);
}

.zoom-btn:hover {
  background: rgba(200, 148, 85, 0.15);
  color: var(--app-gold-bright);
}

.zoom-text {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0 8px;
  color: var(--app-text);
  min-width: 48px;
  text-align: center;
}

/* Mobile segmented control */
.mobile-view-tabs {
  display: none;
  background: var(--app-card-bg);
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-radius);
  padding: 3px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--app-text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--app-transition);
}

.tab-btn.active {
  background: var(--app-gold);
  color: #14110f;
  font-weight: 600;
}

/* === MAIN SPLIT LAYOUT === */
.app-body {
  display: flex;
  flex: 1;
  height: calc(100vh - 62px);
  overflow: hidden;
}

/* === LEFT EDITOR PANEL === */
.editor-panel {
  width: 500px;
  min-width: 440px;
  max-width: 560px;
  background: var(--app-panel-bg);
  border-right: 1px solid var(--app-card-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 80px 24px;
  scrollbar-width: thin;
  scrollbar-color: #4a3a2d var(--app-panel-bg);
}

.editor-panel::-webkit-scrollbar {
  width: 6px;
}

.editor-panel::-webkit-scrollbar-track {
  background: var(--app-panel-bg);
}

.editor-panel::-webkit-scrollbar-thumb {
  background: #4a3a2d;
  border-radius: 3px;
}

.editor-panel::-webkit-scrollbar-thumb:hover {
  background: var(--app-gold);
}

.editor-header {
  margin-bottom: 20px;
}

.editor-title {
  margin: 0 0 6px 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.editor-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--app-text-muted);
  line-height: 1.4;
}

/* Accordion sections */
.form-section {
  background: var(--app-card-bg);
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: var(--app-transition);
}

.form-section:focus-within {
  border-color: var(--app-card-border-focus);
  box-shadow: 0 0 15px rgba(200, 148, 85, 0.1);
}

.section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  user-select: none;
  transition: var(--app-transition);
}

.section-summary:hover {
  background: rgba(200, 148, 85, 0.06);
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(200, 148, 85, 0.12);
  border: 1px solid rgba(200, 148, 85, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.section-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.chevron-icon {
  width: 18px;
  height: 18px;
  stroke: var(--app-text-muted);
  transition: transform 0.25s ease;
}

details[open] .chevron-icon {
  transform: rotate(180deg);
}

.section-content {
  padding: 16px 18px 20px 18px;
  border-top: 1px solid rgba(200, 148, 85, 0.12);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--app-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .optional {
  font-size: 0.7rem;
  opacity: 0.7;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--app-input-bg);
  border: 1px solid var(--app-input-border);
  border-radius: var(--app-radius);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  transition: var(--app-transition);
  outline: none;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: var(--app-input-border-focus);
  box-shadow: 0 0 0 2px rgba(200, 148, 85, 0.2);
}

.form-input::placeholder {
  color: #554a3e;
}

select.form-input {
  cursor: pointer;
  color: var(--app-text);
}

select.form-input option {
  background: #1c1815;
  color: #fff;
}

textarea.form-input {
  resize: vertical;
  min-height: 64px;
  line-height: 1.4;
}

/* Checkbox and toggle controls */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 4px;
  user-select: none;
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--app-gold);
  width: 17px;
  height: 17px;
  cursor: pointer;
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.conditional-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 14px;
  border-left: 2px solid rgba(200, 148, 85, 0.25);
  margin-top: 4px;
  margin-bottom: 8px;
  transition: var(--app-transition);
}

.conditional-fields.is-hidden {
  display: none !important;
}

/* Photo Upload Slots */
.photos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.photo-uploader {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.photo-dropzone {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--app-input-bg);
  border: 2px dashed rgba(200, 148, 85, 0.35);
  border-radius: var(--app-radius);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--app-transition);
}

.photo-dropzone:hover {
  border-color: var(--app-gold);
  background: rgba(200, 148, 85, 0.05);
}

.photo-dropzone.has-image {
  border-style: solid;
  border-color: var(--app-gold);
}

.photo-dropzone img.preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dropzone-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #fff;
  font-size: 0.72rem;
  gap: 4px;
  padding: 6px;
  text-align: center;
}

.photo-dropzone:hover .dropzone-overlay {
  opacity: 1;
}

.dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--app-text-muted);
  padding: 10px;
  text-align: center;
}

.dropzone-empty svg {
  width: 24px;
  height: 24px;
  stroke: var(--app-gold);
}

.dropzone-empty span {
  font-size: 0.72rem;
  line-height: 1.2;
}

.photo-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--app-text-muted);
}

.hidden-file-input {
  display: none;
}

/* Sibling card / repeated items */
.repeatable-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(200, 148, 85, 0.15);
  border-radius: var(--app-radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Notification toast */
.toast-message {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #251e18;
  color: #fff;
  border: 1px solid var(--app-gold);
  border-radius: var(--app-radius);
  padding: 12px 20px;
  font-size: 0.88rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-message.show {
  transform: translateY(0);
  opacity: 1;
}

/* === RIGHT PREVIEW PANEL === */
.preview-panel {
  flex: 1;
  background: radial-gradient(circle at 50% 30%, #1c1815 0%, #100e0c 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.preview-toolbar {
  height: 48px;
  min-height: 48px;
  background: rgba(20, 17, 14, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(200, 148, 85, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

.preview-status {
  font-size: 0.8rem;
  color: var(--app-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.preview-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 20px 60px 20px;
  scrollbar-width: thin;
  scrollbar-color: #4a3a2d transparent;
}

.preview-viewport::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.preview-viewport::-webkit-scrollbar-thumb {
  background: #382d24;
  border-radius: 4px;
}

.preview-stage {
  position: relative;
  flex-shrink: 0;
  margin: 0 auto;
}

/* Biodata parchment sheet inside generator */
#biodata-preview.page {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  margin: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(200, 148, 85, 0.25);
  flex-shrink: 0;
}

/* Floating bottom zoom bar */
.floating-zoom {
  position: absolute;
  bottom: 20px;
  right: 24px;
  background: rgba(28, 24, 20, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--app-card-border);
  border-radius: 30px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
  .app-header {
    padding: 0 16px;
  }
  
  .brand-badge {
    display: none;
  }

  .zoom-controls {
    display: none;
  }

  .mobile-view-tabs {
    display: flex;
  }

  .app-body {
    position: relative;
  }

  .editor-panel {
    width: 100%;
    max-width: 100%;
    display: flex;
    z-index: 5;
  }

  .preview-panel {
    display: none;
    width: 100%;
    z-index: 5;
  }

  .app-body.show-preview .editor-panel {
    display: none;
  }

  .app-body.show-preview .preview-panel {
    display: flex;
  }
}
/* ===================================================================
   VowsProfile - Additional styles for dynamic features
   Append these to existing app.css
   =================================================================== */

/* === SAVE PROGRESS INDICATOR === */
.save-indicator {
  font-size: 0.75rem;
  color: #34d399;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.save-indicator.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.btn-save {
  position: relative;
}

/* === A4 OVERFLOW WARNING BANNER === */
.overflow-warning {
  background: rgba(220, 120, 30, 0.15);
  border: 1px solid rgba(220, 120, 30, 0.45);
  border-radius: 6px;
  color: #f5a623;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 16px;
  margin: 0 16px;
  text-align: center;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.overflow-warning.is-visible {
  opacity: 1;
  max-height: 60px;
  padding: 8px 16px;
  margin: 6px 16px;
}

/* === DYNAMIC ENTRY ADD/REMOVE BUTTONS === */
.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  background: rgba(200, 148, 85, 0.08);
  border: 1.5px dashed rgba(200, 148, 85, 0.35);
  border-radius: var(--app-radius);
  color: var(--app-gold);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--app-transition);
  margin-top: 6px;
}

.btn-add:hover {
  background: rgba(200, 148, 85, 0.14);
  border-color: var(--app-gold);
}

.btn-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(220, 50, 50, 0.15);
  border: 1px solid rgba(220, 50, 50, 0.35);
  color: #e05858;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--app-transition);
  flex-shrink: 0;
  line-height: 1;
}

.btn-remove:hover {
  background: rgba(220, 50, 50, 0.3);
  border-color: #e05858;
}

.btn-remove-phone {
  margin-top: 22px;
  align-self: flex-end;
}

/* === REPEATABLE ENTRY CARDS === */
.repeatable-entry {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(200, 148, 85, 0.15);
  border-radius: var(--app-radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.entry-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--app-gold);
  text-transform: uppercase;
}

/* Phone entry row */
.phone-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* === PHOTO UPLOAD GRID (Updated) === */
.photo-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.photo-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.btn-remove-photo {
  background: rgba(220, 50, 50, 0.15);
  border: 1px solid rgba(220, 50, 50, 0.35);
  border-radius: var(--app-radius);
  color: #e05858;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: var(--app-transition);
}

.btn-remove-photo:hover {
  background: rgba(220, 50, 50, 0.3);
}

/* === EDITOR HEADER ACTIONS ROW === */
.editor-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-xs {
  font-size: 0.75rem !important;
  padding: 5px 10px !important;
}

/* Visually hidden (accessible) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* PDF spinner animation */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === DOWNLOAD DROPDOWN === */
.download-dropdown {
  position: relative;
}

.download-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: #1e1a16;
  border: 1px solid var(--app-card-border);
  border-radius: var(--app-radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(200, 148, 85, 0.15);
  z-index: 100;
  padding: 4px;
  animation: dropdown-in 0.15s ease-out;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.download-dropdown.open .download-menu {
  display: block;
}

.download-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--app-text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.download-option:hover {
  background: rgba(200, 148, 85, 0.15);
}

.dl-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.dl-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--app-gold);
  background: rgba(200, 148, 85, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}
