/* Menggunakan font modern ala iOS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Fallback warna jika config-colors.php belum di-load (di-override oleh index.php) */
:root {
    --fu-primary: #b53052;
    --fu-primary-dark: #8a2d3b;
    --fu-primary-light: #cd5e5e;
    --fu-bg-start: #8a2d3b;
    --fu-bg-end: #b53052;
    --fu-container-bg: #fffcf4;
    --fu-text-dark: #1c1c1e;
    --fu-text-gray: #6e6e73;
    --fu-text-muted: #8e8e93;
    --fu-text-secondary: #3a3a3c;
    --fu-link: #007aff;
    --fu-danger: #dc3545;
    --fu-secondary-start: #6c757d;
    --fu-secondary-end: #8a9095;
    --fu-placeholder: #888;
}

/* iOS 8pt spacing scale */
:root {
    --ios-space-xs: 0.25rem;   /* 4pt */
    --ios-space-sm: 0.5rem;    /* 8pt */
    --ios-space-md: 0.75rem;   /* 12pt */
    --ios-space-lg: 1rem;      /* 16pt */
    --ios-space-xl: 1.25rem;   /* 20pt */
    --ios-space-2xl: 1.5rem;   /* 24pt */
}

body {
  background: linear-gradient(135deg, var(--fu-bg-start), var(--fu-bg-end));
  min-height: calc(var(--vh, 1vh) * 100);
  background-attachment: fixed;         /* tambahkan */
  background-repeat: no-repeat;         /* tambahkan */
  background-size: 100% 100%;           /* tambahkan */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  touch-action: pan-x pan-y;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


.waktu-kecil {
    height: 38px !important;
    padding: 8px 12px;
    line-height: 1.2;
    text-align: left;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 400;
}

/* Grid subtema terkunci: non-interaktif, jelas bahwa tema tidak bisa diubah */
#subtema-wrapper.locked-grid {
  pointer-events: none;
  opacity: .85;
  filter: grayscale(0.25);
}
#subtema-wrapper.locked-grid .subtema-item {
  cursor: default;
  transition: none;
}
#subtema-wrapper.locked-grid .subtema-item:hover {
  transform: none;
}
#subtema-wrapper.locked-grid .subtema-item.selected {
  border-width: 2px;
  border-color: var(--fu-link);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--fu-link) 25%, transparent);
}
#subtema-wrapper.locked-grid .subtema-item button {
  cursor: default;
  opacity: 0.7;
}

  #lanjut-button-container { position: relative; z-index: 5; }
  #subtema-container { position: relative; z-index: 1; }
  /* jaga-jaga kalau ada class yang mematikan pointer — kompatibel iOS/Android lama & baru */
  #lanjut-button-container .btn,
  #submitBtn,
  button.btn-primary[type="submit"] {
    pointer-events: auto !important;
    cursor: pointer;
    min-height: 48px;
    min-width: 48px;
    padding: 12px 24px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  /* iOS/WebKit: pastikan Lanjut selalu punya kontras (disabled tetap terbaca, bukan hantu putih) */
  #lanjut-button-container .btn.btn-primary {
    color: #fff;
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--fu-primary);
    background-image: linear-gradient(135deg, var(--fu-primary), var(--fu-primary-light));
  }
  #lanjut-button-container .btn.btn-primary[disabled],
  #lanjut-button-container .btn.btn-primary[aria-disabled="true"] {
    color: #fff;
    background-color: #8e8e93;
    background-image: none;
    opacity: 1;
    filter: none;
  }
  /* iOS safe area tombol di bawah */
  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .d-flex.justify-content-between.px-3 .btn,
    #section-preview .d-flex.justify-content-between .btn {
      margin-bottom: env(safe-area-inset-bottom);
    }
  }

  /* Baris Kembali / Lanjut / navigasi: target sentuh konsisten di iOS & Android */
  @media (pointer: coarse), (max-width: 767.98px) {
    .d-flex.justify-content-between.px-3 .btn:not(.btn-link),
    #section-preview .d-flex.justify-content-between .btn:not(.btn-link) {
      min-height: 48px;
      min-width: 44px;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }
  }


/* Kalau kamu punya gradient/fade di area scroll, pastikan tidak menyerap klik */
.scroll-custom::after,
.preview-card::after { pointer-events: none; }


.input-with-clear {
  position: relative;
  display: block;
}
.input-with-clear > input,
.input-with-clear > select {
  width: 100%;
  padding-right: 2.5rem;              /* ruang untuk tombol × */
}

/* Tombol × umum (inputs & selects) */
.input-with-clear .date-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);        /* center default */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2rem;
  border: 0;
  background: transparent;
  line-height: 1;
  font-size: 20px;
  color: var(--fu-placeholder);
  cursor: pointer;
  padding: 0;
  z-index: 3;
}
.date-clear-btn.is-hidden { display: none; }
.input-with-clear .date-clear-btn:active { transform: translateY(-50%) scale(0.96); }

/* ➜ NUDGE KHUSUS UNTUK <select>: naikkan ~2px supaya sejajar teks */
.input-with-clear.is-select .date-clear-btn {
  transform: translateY(calc(-50% - 2px));  /* ubah -2px -> -1px kalau kebanyakan */
}
@media (pointer: coarse) {
  .input-with-clear .date-clear-btn { width: 2.5rem; font-size: 22px; }
}


.form-container {
    max-width: 700px;
    margin: 2rem auto;
    background: var(--fu-container-bg);
    padding: var(--ios-space-2xl);
    padding-left: calc(var(--ios-space-2xl) + env(safe-area-inset-left, 0));
    padding-right: calc(var(--ios-space-2xl) + env(safe-area-inset-right, 0));
    padding-bottom: calc(var(--ios-space-2xl) + env(safe-area-inset-bottom, 0));
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

h1 {
    color: var(--fu-primary);
    text-align: center;
    margin-bottom: var(--ios-space-2xl);
    font-weight: 600;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
}

/* Judul + chip "jenis acara" di index — skala responsif, tidak overflow di layar kecil */
.form-page-header {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.form-page-header .form-page-header__title {
    max-width: 100%;
    box-sizing: border-box;
    /* Spesifisitas > h1 global + media: tipografi seimbang 320px – desktop */
    font-size: clamp(1.15rem, 0.65vw + 1.02rem, 1.75rem);
    line-height: 1.18;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding-left: min(0.4rem, max(0px, env(safe-area-inset-left, 0px)));
    padding-right: min(0.4rem, max(0px, env(safe-area-inset-right, 0px)));
    hyphens: none;
    overflow-wrap: break-word;
}

/* Chip header: font, padding, indikator — proporsional; override ukuran di index (dimuat dulu) */
.ja-badge-top--header {
    max-width: min(100% - 0.35rem, 22.5rem);
    width: fit-content;
    min-width: 0;
    max-height: 100%;
    box-sizing: border-box;
    display: inline-flex;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.012em;
    font-size: clamp(0.69rem, 0.3vw + 0.64rem, 0.875rem);
    gap: clamp(0.3rem, 0.1vw + 0.2rem, 0.5rem);
    padding:
        clamp(0.3rem, 0.1vw + 0.2rem, 0.5rem)
        clamp(0.6rem, 0.2vw + 0.4rem, 0.7rem)
        clamp(0.3rem, 0.1vw + 0.2rem, 0.5rem)
        clamp(0.4rem, 0.1vw + 0.2rem, 0.5rem);
}

.ja-badge-top--header .ja-badge-top__text {
    min-width: 0;
    text-align: center;
}

.ja-badge-top--header .ja-badge-top__dot-wrap {
    width: clamp(1rem, 0.4vw + 0.9rem, 1.2rem);
    height: clamp(1rem, 0.4vw + 0.9rem, 1.2rem);
}

.ja-badge-top--header .ja-badge-top__dot {
    width: clamp(0.2rem, 0.1vw + 0.2rem, 0.3rem);
    height: clamp(0.2rem, 0.1vw + 0.2rem, 0.3rem);
}

/* Progress: jarak bawah/atas mengikuti header yang fluid */
.form-container > .progress {
    margin-top: clamp(0.1rem, 0.2vw + 0.1rem, 0.7rem);
    margin-bottom: clamp(1.05rem, 2.2vw, 1.5rem);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Layar sangat sempit: judul + chip tetap kebaca & tidak kelihatan sempit */
@media (max-width: 400px) {
    .form-page-header .form-page-header__title {
        font-size: clamp(1.1rem, 0.2vw + 0.85rem, 1.3rem);
    }
    .ja-badge-top--header {
        max-width: calc(100% - 0.15rem);
        min-width: 0;
    }
}

h2 {
    color: var(--fu-primary);
    margin-bottom: var(--ios-space-xl);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.3s ease;
}

h3 {
    color: var(--fu-primary);
    margin-bottom: 2rem;
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: #333;
    margin-bottom: var(--ios-space-md);
    font-size: 0.9rem;
    display: block;
}

input, select, textarea {
    width: 100%;
    padding: var(--ios-space-md) var(--ios-space-lg);
    border: 1px solid rgba(60,60,67,0.18);
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.2;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    box-sizing: border-box;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: var(--ios-space-lg);
    font-weight: 400;
}

/* Sentuh & layar sempit: min 16px pada field teks — kurangi zoom fokus iOS/Android + tap lebih stabil */
@media (pointer: coarse), (max-width: 767.98px) {
    input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="range"]):not(.waktu-kecil),
    select,
    textarea {
        font-size: 1rem;
        line-height: 1.25;
    }
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--fu-primary);
    box-shadow: 0 0 10px color-mix(in srgb, var(--fu-primary) 30%, transparent);
    background: #fff;
}

input::placeholder, textarea::placeholder {
    font-size: 0.8125rem;
    color: var(--fu-placeholder);
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: color 0.2s ease, opacity 0.2s ease;
}

input:focus::placeholder, textarea:focus::placeholder {
    color: var(--fu-text-muted);
}

input:not(:placeholder-shown)::placeholder, textarea:not(:placeholder-shown)::placeholder {
    opacity: 0;
}

/* Note/deskripsi di bawah kolom input — rapi & jelas */
.form-note {
    display: block;
    font-size: 0.6875rem;
    line-height: 1.35;
    color: var(--fu-text-gray);
    font-style: italic;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}
.form-note--warning {
    color: var(--fu-danger);
}
.form-note .btn-link {
    font-size: inherit;
}

/* Link/tombol inline di catatan: area tap ≥44px di perangkat sentuh (iOS/Android) */
@media (pointer: coarse), (max-width: 767.98px) {
    .form-note .btn-link,
    .form-note a.btn-link,
    .form-note button.btn-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        min-width: 2.75rem;
        padding: 0.4rem 0.65rem !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        vertical-align: middle;
    }
}

.form-group {
    margin-bottom: var(--ios-space-lg);
    transition: opacity 0.3s ease;
}

/* Jarak konsisten: Tempat Acara ↔ Link Google Maps (Acara 1 & acara tambahan) */
.rich-editor-container + input.form-control,
textarea.rich-editor-field + input.form-control {
    margin-top: var(--ios-space-md);
    margin-bottom: var(--ios-space-sm);
}

.btn-primary {
    color: #fff;
    /* Lapisan solid wajib: WebKit lama kadang gagal paint gradient+color-mix → teks putih di atas kartu putih */
    background-color: var(--fu-primary);
    background-image: linear-gradient(135deg, var(--fu-primary), var(--fu-primary-light));
    border: none;
    border-radius: 12px;
    padding: 0.85rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
    color: #fff;
    background-color: var(--fu-primary-dark);
    background-image: linear-gradient(135deg, var(--fu-primary-dark), var(--fu-primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(181, 48, 82, 0.35);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--fu-secondary-start), var(--fu-secondary-end));
    border: none;
    border-radius: 12px;
    padding: 0.85rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--fu-secondary-start), var(--fu-secondary-end));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Tombol "Tambah …" (Acara, Love Story, Rekening): outline mauve seragam, pill, ikon + — bukan CTA utama */
.btn.idb-btn-tambah {
    position: relative;
    z-index: 3;
    box-sizing: border-box;
    width: max-content;
    max-width: 100%;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.35rem;
    padding: 0.38rem 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    border-radius: 999px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
    /* teks + border + ikon satu warna mauve lembut (selaras --fu-primary) */
    --idb-tambah-fg: color-mix(in srgb, var(--fu-primary) 68%, #5c3d44);
    --idb-tambah-bd: color-mix(in srgb, var(--fu-primary) 42%, #d4b8bf);
    --idb-tambah-bg-hover: color-mix(in srgb, var(--fu-primary) 9%, var(--fu-container-bg));
    --bs-btn-color: var(--idb-tambah-fg);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--idb-tambah-bd);
    --bs-btn-hover-color: color-mix(in srgb, var(--fu-primary) 78%, #4a3038);
    --bs-btn-hover-bg: var(--idb-tambah-bg-hover);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--fu-primary) 52%, #caa9b2);
    --bs-btn-focus-shadow-rgb: 181, 48, 82;
    --bs-btn-active-color: color-mix(in srgb, var(--fu-primary) 82%, #3d282f);
    --bs-btn-active-bg: color-mix(in srgb, var(--fu-primary) 13%, var(--fu-container-bg));
    --bs-btn-active-border-color: color-mix(in srgb, var(--fu-primary) 58%, #bf9faa);
    color: var(--idb-tambah-fg) !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 1px solid var(--idb-tambah-bd) !important;
    box-shadow: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn.idb-btn-tambah:hover {
    transform: none;
    color: var(--bs-btn-hover-color) !important;
    background-color: var(--idb-tambah-bg-hover) !important;
    background-image: none !important;
    border-color: var(--bs-btn-hover-border-color) !important;
    box-shadow: none !important;
}

.btn.idb-btn-tambah:active {
    color: var(--bs-btn-active-color) !important;
    background-color: var(--bs-btn-active-bg) !important;
    background-image: none !important;
    border-color: var(--bs-btn-active-border-color) !important;
}

.btn.idb-btn-tambah:focus-visible {
    transform: none;
    outline: 2px solid color-mix(in srgb, var(--fu-primary) 38%, #c4a9b0);
    outline-offset: 2px;
    box-shadow: none !important;
}

.idb-btn-tambah__plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15em;
    font-weight: 500;
    line-height: 1;
    margin-inline-end: -0.05em;
    color: inherit;
}

#section-acara .form-group--add-event #add-event.idb-btn-tambah {
    align-self: flex-start;
}

/* Jarak kartu Love Story ↔ tombol tambah (hindari tap “nyasar” ke kartu) */
#section-love-story #add-love-story {
    margin-top: 0.75rem;
}

.form-group--add-event {
    max-width: 780px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.add-event-lock-hint {
    width: 100%;
    margin-top: 0.5rem;
    border-radius: 8px;
}

.add-event-lock-hint.is-inline {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    color: #64748b;
    padding: 0.15rem 0;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.45;
    animation: idbAddEventHintIn 0.2s ease-out;
}

.add-event-lock-hint.is-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: #57534e;
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    padding: 0.55rem 0.65rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    animation: idbAddEventHintIn 0.2s ease-out;
}

@keyframes idbAddEventHintIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.add-event-lock-hint .add-event-lock-hint-icon {
    display: none !important;
}

.add-event-lock-hint-close {
    margin-left: auto;
    width: 26px;
    height: 26px;
    min-width: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #b47986;
}

.add-event-lock-hint-close:hover {
    background: #f5dfe4;
}

#form-message {
    color: var(--fu-danger);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}


.btn-container {
    margin-top: var(--ios-space-2xl);
    display: flex;
    justify-content: space-between;
    gap: var(--ios-space-lg);
}

.btn-container .btn {
    flex: 1;
    padding: 0.85rem;
    font-size: 0.95rem;
    border-radius: 12px;
}

.is-invalid {
    border-color: var(--fu-danger);
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.2);
}

.progress {
    height: 5px;
    margin-top: var(--ios-space-md);
    margin-bottom: var(--ios-space-2xl);
    background-color: rgba(60,60,67,0.12);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(135deg, #b53052, #cd5e5e);
    transition: width 0.4s ease-in-out;
}

.card-form {
    background: rgba(255, 255, 255, 0.95);
    padding: var(--ios-space-lg);
    border-radius: 12px;
    border: none;
    margin-bottom: var(--ios-space-xl);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.card-form:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.card-form h4 {
    margin-bottom: var(--ios-space-lg);
    font-size: 1rem;
    font-weight: 600;
    color: var(--fu-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Kirim Hadiah: kartu bertingkat (selaras Wedding Gift), tanpa tombol tambah di form */
.kirim-hadiah-section .kirim-hadiah-block-title {
    margin-bottom: 0.35rem;
}
.kirim-hadiah-hint {
    line-height: 1.45;
    max-width: 42rem;
}
.kirim-hadiah-stack .kirim-hadiah-item {
    margin-bottom: var(--ios-space-lg);
    box-shadow: 0 4px 16px rgba(181, 48, 82, 0.07);
    border: 1px solid rgba(181, 48, 82, 0.14);
}
.kirim-hadiah-stack .kirim-hadiah-item:last-child {
    margin-bottom: 0;
}
.kirim-hadiah-stack .kirim-hadiah-item h4.kirim-hadiah-card-title {
    margin-bottom: var(--ios-space-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--fu-primary);
    display: block;
}

/* Penyesuaian untuk waktu dan zona waktu */
.row.g-2 {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    margin: 0 -0.5rem;
}

.col-7, .col-5 {
    padding: 0 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.col-7 input,
.col-5 select {
    height: 38px !important;
    padding: 8px 12px !important;
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-bottom: 1.2rem;
    font-weight: 400;
}

.col-7 label,
.col-5 label {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.2;
    font-weight: 500;
}

textarea {
    resize: vertical;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* Smooth scrolling untuk mobile */
html {
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    .form-container {
        margin: var(--ios-space-md);
        padding: var(--ios-space-lg);
        border-radius: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: var(--ios-space-xl);
        font-weight: 600;
    }

    h2 {
        font-size: 1.15rem;
        margin-bottom: var(--ios-space-lg);
        font-weight: 600;
    }

    h3 {
        font-size: 1.05rem;
        margin-bottom: var(--ios-space-lg);
        font-weight: 600;
    }

    input, select {
        font-size: 0.9rem;
        height: 36px;
        padding: 0.7rem;
        border-radius: 8px;
        margin-bottom: 1rem;
        font-weight: 400;
    }

    textarea {
        font-size: 0.9rem;
        padding: 0.7rem;
        margin-bottom: 1.2rem;
        font-weight: 400;
    }

    input::placeholder, textarea::placeholder {
        font-size: 0.75rem;
    }

    input:focus::placeholder, textarea:focus::placeholder {
        color: var(--fu-text-muted);
    }

    .btn-container {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-container .btn {
        width: 100%;
        padding: 0.8rem;
        font-size: 0.9rem;
        font-weight: 600;
    }

    .idb-btn-tambah {
        min-height: 2.5rem;
        padding: 0.42rem 1rem;
        font-size: 0.8125rem;
        border-radius: 999px;
    }

    .card-form {
        padding: 1.5rem;
        border-radius: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .col-7 input,
    .col-5 select {
        height: 36px !important;
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
        margin-bottom: 1rem;
        font-weight: 400;
    }

    .col-7 label,
    .col-5 label {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
        font-weight: 500;
    }

    .row.g-2 {
        margin: 0 -0.4rem;
    }
}

@media (max-width: 576px) {
    .form-container {
        padding: clamp(0.6rem, 2.2vw, 0.9rem) clamp(0.55rem, 2.5vw, 0.8rem);
        margin: clamp(0.2rem, 0.6vw, 0.35rem);
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
        font-weight: 600;
    }

    h2 {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
        font-weight: 600;
    }

    h3 {
        font-size: 1rem;
        margin-bottom: 1.2rem;
        font-weight: 600;
    }

    input, select {
        font-size: 0.85rem;
        height: 34px;
        padding: 0.6rem;
        border-radius: 8px;
        margin-bottom: 0.8rem;
        font-weight: 400;
    }

    textarea {
        font-size: 0.85rem;
        padding: 0.6rem;
        margin-bottom: 1rem;
        font-weight: 400;
    }

    input::placeholder, textarea::placeholder {
        font-size: 0.6875rem;
    }

    input:focus::placeholder, textarea:focus::placeholder {
        color: var(--fu-text-muted);
    }

    .btn-container .btn {
        font-size: 0.85rem;
        padding: 0.7rem;
        font-weight: 600;
    }

    .idb-btn-tambah {
        min-height: 2.5rem;
        padding: 0.4rem 0.95rem;
        font-size: 0.8125rem;
        border-radius: 999px;
    }

    .progress {
        height: 6px;
        margin-bottom: 1.5rem;
    }

    .col-7 input,
    .col-5 select {
        height: 34px !important;
        padding: 0.6rem !important;
        font-size: 0.85rem !important;
        margin-bottom: 0.8rem;
        font-weight: 400;
    }

    .col-7 label,
    .col-5 label {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }

    .row.g-2 {
        margin: 0 -0.3rem;
    }
}

/* Penyesuaian untuk Safari */
@supports (-webkit-overflow-scrolling: touch) {
    input, select, textarea {
        -webkit-appearance: none;
        text-align: left;
    }

    .row {
        display: flex;
        flex-wrap: wrap;
        margin-right: -0.5rem;
        margin-left: -0.5rem;
    }

    .col-7, .col-5 {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
    }
}

/* Preview section - pakai var dari config-colors.php */

/* ========== PREVIEW SECTION - iPhone-style & Responsive ========== */
#section-preview.form-section {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 var(--ios-space-md) var(--ios-space-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    color: var(--fu-text-dark);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
@supports (padding: max(0px, env(safe-area-inset-left))) {
    #section-preview.form-section {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Heading Preview - warna dari config, iOS spacing */
#section-preview.form-section h2,
#preview-data-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--fu-primary);
    text-shadow: none;
    margin-bottom: var(--ios-space-md);
    text-align: center;
}

/* Scroll info - rapi & responsif iOS */
#section-preview .scroll-info {
    font-size: 0.8125rem;
    color: var(--fu-text-gray);
    margin-bottom: var(--ios-space-md);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.scroll-info-icon {
    color: #22c55e !important;
    font-size: 0.9rem;
}

/* Container kartu - gaya grouped list iOS */
#section-preview .preview-card {
    background: transparent;
    padding: 0 var(--ios-space-xs);
    margin-bottom: var(--ios-space-sm);
}

/* Kartu dalam - inset group iOS, padding 16pt */
#section-preview .preview-card-inner {
    background: #fff;
    border: none;
    border-radius: 0 0 12px 12px;
    margin-top: -1px;
    padding: var(--ios-space-md) var(--ios-space-lg);
    margin-bottom: var(--ios-space-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    #section-preview .preview-card-inner {
        background: rgba(255,255,255,0.98);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
}

/* Header section - gaya grouped header iOS */
#section-preview .preview-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--fu-primary);
    background: linear-gradient(180deg, color-mix(in srgb, var(--fu-primary) 85%, black), var(--fu-primary));
    padding: var(--ios-space-md) var(--ios-space-lg);
    margin: 0 0 0 0;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

/* Sub-header: label subsection (bukan bar penuh, hindari "nyambung" dengan h4) */
#section-preview .preview-card h5 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fu-text-secondary);
    background: transparent;
    padding: 0.65rem 0 0.4rem 0.65rem;
    margin: 0 0 0.25rem 0;
    border: none;
    border-left: 3px solid var(--fu-primary);
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: -0.01em;
}
#section-preview .preview-card-inner > h5:first-child {
    padding-top: var(--ios-space-xs);
}

#section-preview .preview-card .tambahan h5 {
    border-left-color: var(--fu-text-muted);
    color: var(--fu-text-gray);
}

#section-preview .preview-card h4 i {
    color: inherit;
    opacity: 0.95;
}
#section-preview .preview-card h5 i {
    color: var(--fu-primary);
    opacity: 0.9;
}
#section-preview .preview-card .tambahan h5 i {
    color: var(--fu-text-muted);
}

/* Row data - label : value */
#section-preview .preview-card p,
#section-preview #preview-pilihan-tanpa-foto-container {
    font-size: 0.875rem;
    color: var(--fu-text-dark);
    margin: 0;
    padding: var(--ios-space-md) 0;
    min-height: 2.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ios-space-sm);
    border-bottom: 0.5px solid rgba(60,60,67,0.12);
    font-weight: 400;
    line-height: 1.4;
}

#section-preview .preview-card p,
#section-preview #preview-pilihan-tanpa-foto-container,
#section-preview .preview-card .tambahan p {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: left;
}

#section-preview #preview-pilihan-tanpa-foto-container {
    display: none;
}
#section-preview #preview-pilihan-tanpa-foto-container.show {
    display: flex;
}

#section-preview .preview-card p:last-child,
#section-preview #preview-pilihan-tanpa-foto-container:last-child,
#section-preview .preview-card .tambahan p:last-child {
    border-bottom: none;
}

/* Label (strong) */
#section-preview .preview-card p strong,
#section-preview #preview-pilihan-tanpa-foto-container strong {
    font-weight: 500;
    color: var(--fu-text-gray);
    flex-shrink: 0;
    min-width: 0;
    font-size: 0.875rem;
}
@media (min-width: 400px) {
    #section-preview .preview-card p strong,
    #section-preview #preview-pilihan-tanpa-foto-container strong {
        min-width: 5.5rem;
    }
}
@media (min-width: 600px) {
    #section-preview .preview-card p strong,
    #section-preview #preview-pilihan-tanpa-foto-container strong {
        min-width: 6.5rem;
    }
}

/* Value (span) */
#section-preview .preview-card p span,
#section-preview #preview-pilihan-tanpa-foto-container span,
#section-preview .preview-card .tambahan p span {
    color: var(--fu-text-dark);
    flex: 1;
    min-width: 0;
    text-align: right;
    font-weight: 400;
}
@media (max-width: 380px) {
    #section-preview .preview-card p span,
    #section-preview #preview-pilihan-tanpa-foto-container span {
        text-align: left;
        width: 100%;
    }
}

#section-preview .preview-card .tambahan p span {
    color: var(--fu-text-secondary);
}

#section-preview .preview-card p span.waktu {
    font-size: 0.8125rem;
}

/* Zona digabung di teks via formatPreviewPukul (index.php), bukan ::after */

#section-preview .preview-card p span a {
    color: var(--fu-link);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
#section-preview .preview-card p span a:hover,
#section-preview .preview-card p span a:active {
    text-decoration: underline;
}

/* Checkbox & tombol - safe area aware */
#section-preview .form-group .preview-checkbox {
    border: 0.5px solid rgba(60,60,67,0.2);
    border-radius: 12px;
    padding: var(--ios-space-md) var(--ios-space-lg);
    background: rgba(255,255,255,0.98);
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    #section-preview .form-group .preview-checkbox {
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
}

#section-preview .form-check-input {
    transform: scale(0.95);
    border-color: var(--fu-primary);
}

#section-preview .form-check-input:checked {
    background-color: var(--fu-primary);
    border-color: var(--fu-primary);
}

#section-preview .form-check-input:focus {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--fu-primary) 25%, transparent);
}

#section-preview label {
    font-size: 0.9375rem;
    color: var(--fu-text-dark);
    font-weight: 500;
}
label[for="agreement"] {
    min-height: 44px;
    padding: 8px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#section-preview .btn-container {
    display: flex;
    justify-content: space-between;
    gap: var(--ios-space-lg);
    max-width: 100%;
    margin: 1.25rem 0;
}

#section-preview .btn-container .btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 12px;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

/* Scroll area - responsive height (60vh fallback untuk device lama) */
.scroll-vertical {
    max-height: 60vh;
    max-height: min(60vh, calc(var(--vh, 1vh) * 60));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
}

/* Extra kecil (iPhone SE, mobile) */
@media (max-width: 480px) {
    .form-container { margin: var(--ios-space-sm); padding: var(--ios-space-md); }
    #section-preview.form-section { padding-left: var(--ios-space-md); padding-right: var(--ios-space-md); }
    #section-preview .preview-card-inner { padding: var(--ios-space-md) var(--ios-space-lg); }
    #section-preview .preview-card p,
    #section-preview #preview-pilihan-tanpa-foto-container {
        padding: var(--ios-space-sm) 0;
        gap: var(--ios-space-xs);
        min-height: 2rem;
    }
}
@media (max-width: 400px) {
    .form-container { margin: var(--ios-space-sm); padding: var(--ios-space-md); }
    #section-preview.form-section { padding-left: var(--ios-space-md); padding-right: var(--ios-space-md); }
    #section-preview .preview-card-inner { padding: var(--ios-space-md) var(--ios-space-md); }
}
@supports (padding: max(0px, env(safe-area-inset-left))) {
    @media (max-width: 400px) {
        .form-container { margin-left: max(0.3rem, env(safe-area-inset-left)); margin-right: max(0.3rem, env(safe-area-inset-right)); }
        #section-preview.form-section { padding-left: max(0.5rem, env(safe-area-inset-left)); padding-right: max(0.5rem, env(safe-area-inset-right)); }
    }
}
@media (max-width: 360px) {
    #section-preview .preview-card-inner { padding: var(--ios-space-md) var(--ios-space-sm); }
    #section-preview .preview-card h4,
    #section-preview .preview-card h5 { padding-left: var(--ios-space-md); padding-right: var(--ios-space-md); }
    #section-preview .preview-card p,
    #section-preview #preview-pilihan-tanpa-foto-container {
        font-size: 0.8125rem;
        padding: var(--ios-space-sm) 0;
        gap: var(--ios-space-xs);
    }
    #section-preview .btn-container { flex-direction: column; }
    #section-preview .btn-container .btn { min-height: 44px; }
}

/* Tablet / landscape */
@media (min-width: 768px) {
    #section-preview.form-section { max-width: 640px; }
    #section-preview.form-section h2 { font-size: 1.35rem; }
    #section-preview .btn-container .btn { font-size: 1rem; }
    #section-preview .preview-card-inner { padding: var(--ios-space-md) var(--ios-space-xl); }
    #section-preview .preview-card h4,
    #section-preview .preview-card h5 { padding-left: 1.25rem; padding-right: 1.25rem; }
    .scroll-vertical { max-height: 65vh; max-height: min(65vh, calc(var(--vh, 1vh) * 65)); }
}

/* Disable tap highlight pada elemen interaktif (iOS) */
#section-preview a, #section-preview button {
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    .form-container {
        margin: 0.35rem;
        padding: 0.85rem;
        border-radius: 1.5rem;
    }

    h1 {
        font-size: 1.6rem;
        margin-bottom: 2rem;
        font-weight: 600;
    }

    h2 {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
        font-weight: 600;
    }

    h3 {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
        font-weight: 600;
    }

    input, select {
        font-size: 0.9rem;
        height: 36px;
        padding: 0.7rem;
        border-radius: 8px;
        margin-bottom: 1rem;
        font-weight: 400;
    }

    textarea {
        font-size: 0.9rem;
        padding: 0.7rem;
        margin-bottom: 1.2rem;
        font-weight: 400;
    }

    input::placeholder, textarea::placeholder {
        font-size: 0.75rem;
    }

    input:focus::placeholder, textarea:focus::placeholder {
        color: var(--fu-text-muted);
    }

    .btn-container {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-container .btn {
        width: 100%;
        padding: 0.8rem;
        font-size: 0.9rem;
        font-weight: 600;
    }

    .idb-btn-tambah {
        min-height: 2.5rem;
        padding: 0.42rem 1rem;
        font-size: 0.8125rem;
        border-radius: 999px;
    }

    .card-form {
        padding: 1.5rem;
        border-radius: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .col-7 input,
    .col-5 select {
        height: 36px !important;
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
        margin-bottom: 1rem;
        font-weight: 400;
    }

    .col-7 label,
    .col-5 label {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
        font-weight: 500;
    }

    .row.g-2 {
        margin: 0 -0.4rem;
    }


    #section-preview .preview-card {
        padding: 0 0.15rem;
        margin-bottom: 1rem;
    }

    #section-preview .preview-card-inner {
        padding: 0.5rem 0.9rem;
        margin-bottom: 1rem;
    }

    #section-preview .preview-card h4 {
        font-size: 0.95rem;
        padding: 0.7rem;
        font-weight: 600;
    }

    #section-preview .preview-card h5 {
        font-size: 0.85rem;
        padding: 0.6rem;
        margin-top: 0.8rem;
        font-weight: 600;
    }

    #section-preview .preview-card p,
    #section-preview #preview-pilihan-tanpa-foto-container {
        font-size: 0.8rem;
        padding: 0.7rem 0;
        font-weight: 400;
    }

    #section-preview .preview-card p strong,
    #section-preview #preview-pilihan-tanpa-foto-container strong {
        min-width: 110px;
        font-weight: 600;
    }

    #section-preview .preview-card p span,
    #section-preview #preview-pilihan-tanpa-foto-container span {
        font-size: 0.8rem;
        font-weight: 400;
    }

    #section-preview .preview-card p span.waktu {
        font-size: 0.75rem;
    }

    #section-preview .preview-card p span a {
        font-size: 0.8rem;
        font-weight: 400;
    }
}

@media (max-width: 576px) {
    .form-container {
        padding: clamp(0.6rem, 2.2vw, 0.9rem) clamp(0.55rem, 2.5vw, 0.8rem);
        margin: clamp(0.2rem, 0.6vw, 0.35rem);
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
        font-weight: 600;
    }

    h2 {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
        font-weight: 600;
    }

    h3 {
        font-size: 1rem;
        margin-bottom: 1.2rem;
        font-weight: 600;
    }

    input, select {
        font-size: 0.85rem;
        height: 34px;
        padding: 0.6rem;
        border-radius: 8px;
        margin-bottom: 0.8rem;
        font-weight: 400;
    }

    textarea {
        font-size: 0.85rem;
        padding: 0.6rem;
        margin-bottom: 1rem;
        font-weight: 400;
    }

    input::placeholder, textarea::placeholder {
        font-size: 0.6875rem;
    }

    input:focus::placeholder, textarea:focus::placeholder {
        color: var(--fu-text-muted);
    }

    .btn-container .btn {
        font-size: 0.85rem;
        padding: 0.7rem;
        font-weight: 600;
    }

    .idb-btn-tambah {
        min-height: 2.5rem;
        padding: 0.4rem 0.95rem;
        font-size: 0.8125rem;
        border-radius: 999px;
    }

    .progress {
        height: 6px;
        margin-bottom: 1.5rem;
    }

    .col-7 input,
    .col-5 select {
        height: 34px !important;
        padding: 0.6rem !important;
        font-size: 0.85rem !important;
        margin-bottom: 0.8rem;
        font-weight: 400;
    }

    .col-7 label,
    .col-5 label {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }

    .row.g-2 {
        margin: 0 -0.3rem;
    }

    #section-preview .preview-card {
        padding: 0 0.1rem;
        margin-bottom: 1rem;
    }

    #section-preview .preview-card-inner {
        padding: 0.5rem 0.75rem;
        margin-bottom: 1rem;
    }

    #section-preview .preview-card h4 {
        font-size: 0.9rem;
        padding: 0.6rem;
        font-weight: 600;
    }

    #section-preview .preview-card h5 {
        font-size: 0.8rem;
        padding: 0.5rem 0 0.35rem 0.6rem;
        margin-top: 0.5rem;
        font-weight: 600;
    }

    #section-preview .preview-card p,
    #section-preview #preview-pilihan-tanpa-foto-container {
        font-size: 0.75rem;
        padding: 0.6rem 0;
        font-weight: 400;
    }
    
    #section-preview .preview-card p,
  #section-preview #preview-pilihan-tanpa-foto-container {
    flex-direction: column;
    align-items: flex-start;
  }

  #section-preview .preview-card p strong,
  #section-preview #preview-pilihan-tanpa-foto-container strong {
    margin-bottom: 0.4rem;
  }

  #section-preview .preview-card p span,
  #section-preview #preview-pilihan-tanpa-foto-container span {
    width: 100%;
  }

    #section-preview .preview-card p strong,
    #section-preview #preview-pilihan-tanpa-foto-container strong {
        min-width: 100px;
        font-weight: 600;
    }

    #section-preview .preview-card p span,
    #section-preview #preview-pilihan-tanpa-foto-container span {
        font-size: 0.75rem;
        font-weight: 400;
    }

    #section-preview .preview-card p span.waktu {
        font-size: 0.7rem;
    }

    #section-preview .preview-card p span a {
        font-size: 0.75rem;
        font-weight: 400;
    }
}


#preview-custom-animasi-container {
    display: none;
}
#preview-custom-animasi-container.show {
    display: block;
}

/* Gaya untuk tombol Lihat Tema di pratinjau */
#preview-tema-undangan-link {
    display: none; /* Tetap disembunyikan secara default */
    padding: var(--ios-space-sm) var(--ios-space-lg);
    background-color: var(--fu-primary);
    color: #fff; /* Teks putih untuk kontras */
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 16px; /* Sudut membulat untuk estetika iOS */
    transition: background-color 0.2s ease; /* Efek transisi halus */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Bayangan ringan */
}

#preview-tema-undangan-link:hover {
    background-color: var(--fu-primary-dark);
    text-decoration: none;
}

#section-preview .subtema-item-preview {
    display: block;
    margin-top: var(--ios-space-md);
    padding: var(--ios-space-md) var(--ios-space-lg);
    border: 0.5px solid rgba(60,60,67,0.12);
    border-radius: 12px;
    background: rgba(142,142,147,0.06);
}

#section-preview .subtema-item-preview:not(#preview-tema-undangan-container) {
    display: none;
}
#section-preview .subtema-item-preview.show {
    display: block;
}

#section-preview .subtema-item-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ios-space-md);
}
#section-preview .subtema-item-content img {
    max-width: 100px;
    height: auto;
    border-radius: 10px;
}
#section-preview .subtema-item-content p {
    margin: 0;
    font-size: 0.875rem;
    color: #1c1c1e;
}

/*Untuk Sub Tema gambar*/
        .subtema-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr); /* 4 kolom untuk desktop */
            gap: 20px;
            margin: 10px 10px 10px 10px;
        }

        .subtema-item {
            text-align: center;
            border: 1px solid #ddd;
            border-radius: 8px;
            padding: 10px;
            background: #fff;
            cursor: pointer;
            transition: transform 0.2s;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        @media (hover: hover) {
            .subtema-item:hover {
                transform: scale(1.05);
            }
        }

        .subtema-item img {
            width: 100%;
            height: auto;
            border-radius: 5px;
        }

        .subtema-item p {
            margin: var(--ios-space-sm) 0 0;
            font-size: 0.75rem;
            font-weight: 500;
        }

        .subtema-item.selected {
            border-color: var(--fu-link);
            background-color: color-mix(in srgb, var(--fu-link) 12%, white);
        }
        
        .subtema-item button {
            margin-top: var(--ios-space-sm);
            padding: 10px 14px;
            min-height: 44px;
            font-size: 0.75rem;
            font-weight: 500; /* Ketebalan font */
            color: #fff; /* Warna teks putih */
            background: linear-gradient(135deg, var(--fu-primary), var(--fu-primary-light));
            border: none; /* Tanpa border */
            border-radius: 30px; /* Sudut membulat */
            cursor: pointer; /* Kursor pointer saat hover */
            transition: background-color 0.2s ease, transform 0.2s ease; /* Efek transisi */
            width: 100%; /* Tombol memenuhi lebar subtema-item */
            box-sizing: border-box; /* Pastikan padding tidak melebihi lebar */
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }
        
        @media (hover: hover) {
            .subtema-item button:hover {
                background: linear-gradient(135deg, var(--fu-primary-dark), var(--fu-primary));
                transform: translateY(-1px); /* Efek sedikit naik saat hover */
            }
        }
        
        .subtema-item button:active {
            transform: translateY(0); /* Kembali ke posisi awal saat diklik */
        }
        
        /* Layar kecil: tetap besar area sentuh (jangan perkecil padding) */
        @media (max-width: 768px) {
            .subtema-item button {
                font-size: 0.8125rem;
                min-height: 48px;
                padding: 12px 14px;
            }
        }

        @media (max-width: 768px) {
            .subtema-grid {
                grid-template-columns: repeat(2, 1fr); /* 2 kolom untuk mobile */
                gap: 14px;
            }
        }
        
/* --- iOS/WebKit repaint hardening --- */
#app, .form-container { -webkit-transform: translateZ(0); transform: translateZ(0); }

.form-section {
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* layout saja: contain: paint memicu bug lapisan/repaint di Safari iOS lama (tombol “hilang”) */
  contain: layout;
}

/* Nonaktifkan transisi di iOS 17 bila perlu */
html.ios-reduce .form-section {
  transition: none !important;
  transform: none !important;
}

/* iOS: percepat konversi tap → click pada tombol */
button.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,.03);
}

/* === [OVERRIDE TERAKHIR] — Visibilitas .form-section === */
.form-section {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: layout;
  -webkit-transform: translateZ(0) translateY(8px);
}
.form-section.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  -webkit-transform: translateZ(0) translateY(0) !important;
}

/* Flatpickr: di atas kartu/form (transform/contain leluhur); appendTo body + z-index di JS/CSS */
.flatpickr-calendar.open {
  z-index: 12000 !important;
}

.form-control.fp-alt-input {
  touch-action: manipulation;
  cursor: pointer;
}

/* === Util aman untuk ANAK ELEMEN (JANGAN dipakai pada .form-section) === */
.hidden-child { display: none !important; }

/* === iOS/WebKit repaint stabil tambahan === */
@supports (-webkit-touch-callout: none) {
  body {
    background-attachment: scroll;
    background-size: cover;
    transform: translateZ(0);
  }
}

/* ========== Tap-safety untuk tombol hapus (iOS-friendly) ========== */
.btn-hapus-acara,
.btn-hapus-love-story,
.btn-hapus-rekening,
button[onclick*="removeEventField"],
button[onclick*="removeLoveStoryField"],
button[onclick*="removeAngpaoField"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
  position: relative;
  z-index: 2; /* pastikan di atas elemen overlay-tipis */
}

/* Jika dibungkus label, tetap bisa diklik */
label .btn-hapus-acara,
label .btn-hapus-love-story,
label .btn-hapus-rekening {
  pointer-events: auto;
}

/* Teks instruksi saat tema terkunci (informasi, bukan ajakan) */
#subtema-instruction.tema-locked-hint {
  color: #0f766e !important;
  font-style: normal;
}

/* =========================================================
   Tema terkunci (order sudah tersimpan) — UX lebih jelas
   ========================================================= */
html.tema-locked select:disabled,
html.tema-locked input:disabled,
html.tema-locked textarea:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  opacity: 1 !important; /* tetap terbaca */
}

html.tema-locked .subtema-item {
  cursor: default;
  position: relative;
}

html.tema-locked .subtema-item::after {
  /* overlay tipis agar terasa terkunci tapi masih bisa klik tombol "Lihat Tema" */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.15);
  pointer-events: none;
}

/* Kunci nama & tanggal acara (setelah submit) — tampilan sama seperti tema terkunci */
html.acara-nama-tanggal-locked #main_nama_acara:disabled,
html.acara-nama-tanggal-locked #main_tanggal_acara:disabled,
html.acara-nama-tanggal-locked #events-container input[name="nama_acara_arr[]"]:disabled,
html.acara-nama-tanggal-locked #events-container input[name="tanggal_acara_arr[]"]:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* Tambah Acara terkunci — tetap gaya outline, abu lembut (bukan solid primer) */
#add-event.idb-btn-tambah.add-event-locked,
button#add-event.idb-btn-tambah.add-event-locked {
  pointer-events: auto;
  cursor: not-allowed;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  opacity: 0.72;
  color: #a8a29e !important;
  background-color: transparent !important;
  background-image: none !important;
  border-color: #d6d3d1 !important;
  box-shadow: none !important;
  transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#add-event.add-event-locked::before,
button#add-event.add-event-locked::before {
  content: none !important;
  display: none !important;
}

#add-event.idb-btn-tambah.add-event-locked:hover,
button#add-event.idb-btn-tambah.add-event-locked:hover {
  transform: none;
  box-shadow: none !important;
  opacity: 0.78;
  color: #a8a29e !important;
  background-color: color-mix(in srgb, #78716c 6%, transparent) !important;
  background-image: none !important;
  border-color: #d6d3d1 !important;
}

html.acara-nama-tanggal-locked #main_tanggal_acara + .flatpickr-alt-input,
html.acara-nama-tanggal-locked #events-container input.flatpickr-input[disabled] + .flatpickr-alt-input,
html.acara-nama-tanggal-locked .fp-alt-input:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}