/* ============================================================
   WEDDING WISHES – Full Styles
   ============================================================ */

/* ----- THEME VARIABLES ----- */
:root {
    --l-100: #FBEFEF; --l-200: #FFE2E2; --l-300: #F5CBCB; --l-400: #C5B3D3;
    --d-100: #F4ABC4; --d-200: #595B83; --d-300: #333456; --d-400: #060930;

    --bg-page: var(--l-100);
    --bg-card: #fff;
    --bg-card-alt: var(--l-100);
    --bg-input: #fff;
    --accent: var(--l-400);
    --accent-strong: var(--d-300);
    --accent-contrast: #fff;
    --text-primary: #3a2c3c;
    --text-secondary: #5c4d5c;
    --text-muted: #776877;
    --border-subtle: var(--l-300);
    --shadow: 0 8px 32px rgba(160, 140, 175, .3);
    --shadow-lg: 0 12px 48px rgba(160, 140, 175, .25);
    --placeholder-color: #b7a6b7;
    --chip-hadir-fg: #6b9274;
    --chip-belum-fg: #b27777;
    --error-bg: rgba(224, 96, 96, .1);
    --error-fg: #c24747;
    --success-bg: rgba(107, 168, 120, .12);
    --success-fg: #3f7d4c;
    --card-radius: 20px;
    --toast-bg: #fff;
    --toast-text: #3a2c3c;
    --toast-shadow: 0 8px 32px rgba(160, 140, 175, .35);
}

body.dark-theme {
    --bg-page: var(--d-400);
    --bg-card: var(--d-300);
    --bg-card-alt: #2a2b4a;
    --bg-input: #23244080;
    --accent: var(--d-100);
    --accent-strong: var(--d-100);
    --accent-contrast: #2a1220;
    --text-primary: #f5eef2;
    --text-secondary: #cfc9de;
    --text-muted: #9c96b8;
    --border-subtle: #46477a;
    --shadow: 0 8px 32px rgba(0, 0, 0, .55);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, .6);
    --placeholder-color: #7d789e;
    --error-bg: rgba(224, 96, 96, .14);
    --error-fg: #ff9d9d;
    --success-bg: rgba(244, 171, 196, .14);
    --success-fg: #f4abc4;
    --toast-bg: var(--d-300);
    --toast-text: #f5eef2;
    --toast-shadow: 0 8px 32px rgba(0, 0, 0, .6);
}

/* Font Awesome loads with font-display:block by default on cdnjs; override to swap */
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/webfonts/fa-regular-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/webfonts/fa-solid-900.woff2') format('woff2');
}

/* ----- RESET ----- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }

/* ----- BODY ----- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.4s, color 0.4s;
}

* { transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s; }
h1, h2, h3 { font-family: 'Cormorant Garamond', serif; }

/* ----- LAYOUT ----- */
.page-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(16px, 3vw, 36px) clamp(16px, 4vw, 48px) 60px;
    flex: 1 0 auto;
    width: 100%;
}
.grid {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(16px, 2.5vw, 24px);
    align-items: stretch;
}
.form-col { flex: 1 1 360px; min-width: 260px; display: flex; flex-direction: column; }
.messages-col { flex: 1 1 360px; min-width: 260px; display: flex; flex-direction: column; }

/* ----- FORM STATUS ----- */
#formStatus {
    display: none;
    text-align: center;
    padding: 10px 14px;
    margin-top: 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .85rem;
}
#formStatus.success { display: block; background: var(--success-bg); color: var(--success-fg); border: 1px solid currentColor; }
#formStatus.error { display: block; background: var(--error-bg); color: var(--error-fg); border: 1px solid currentColor; }

.privacy-notice {
    font-size: .75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 16px;
    opacity: .8;
    line-height: 1.5;
}
.privacy-notice i { color: var(--accent); margin-right: 6px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

@keyframes introFade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
.page-wrap { animation: introFade 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* ----- HERO ----- */
.hero {
    text-align: center;
    max-width: 560px;
    margin: 0 auto clamp(20px, 4vw, 36px);
}
.hero h1 {
    font-size: clamp(1.6rem, 4.5vw, 2.6rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.greeting {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ----- TOP BAR ----- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 48px);
    background: transparent;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.topbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
    color: var(--accent-strong);
}
.topbar .brand i { color: var(--accent); font-size: 0.9rem; }
#theme-toggle {
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: 1px transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.3s;
}
#theme-toggle:hover {
    color: var(--accent-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
#theme-toggle .toggle-label { display: none; }

/* ----- CARDS ----- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    transition: box-shadow 0.3s;
}
.card:hover { box-shadow: var(--shadow-lg); }

/* ----- FORM CARD ----- */
.form-card { padding: clamp(24px, 4vw, 40px); }
.form-header {
    margin-bottom: 16px;
    text-align: center;
}
.form-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.form-header h2 span { color: var(--accent-strong); }
.form-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.field {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(197, 179, 211, 0.20);
}
body.dark-theme .field:focus {
    box-shadow: 0 0 0 4px rgba(244, 171, 196, 0.15);
}
.field::placeholder {
    color: var(--placeholder-color);
    font-size: 0.85rem;
}
#form-message::placeholder { font-style: italic; }
.select-wrap { position: relative; }
.select-wrap i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.8rem;
}
textarea.field {
    min-height: 110px;
    max-height: 110px;
}
.counter {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

/* ----- BUTTONS ----- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    border: none;
    background: var(--accent-strong);
    color: var(--accent-contrast);
    box-shadow: var(--shadow);
    width: 100%;
    justify-content: center;
    transition: transform 0.2s, filter 0.2s, box-shadow 0.3s;
}
.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: var(--shadow-lg);
}
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    filter: grayscale(0.3);
}

/* ----- MESSAGES CARD (with scrollable list on desktop) ----- */
.messages-card {
    padding: clamp(18px, 2.8vw, 30px);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.messages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin-bottom: 14px;
}
.messages-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    scroll-margin-top: 10px;
    margin-left: 0.5rem;
}
.messages-header h2 i { color: var(--accent); }
.messages-count { display: none; }

/* ─── The scrollable list wrapper ─── */
.message-list-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    margin-right: -4px;
    -webkit-overflow-scrolling: touch;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100%;
}

@media (min-width: 900px) {
    .form-col,
    .messages-col {
        flex: 1 1 0;
    }
    .form-col { order: 2; }
    .messages-col { order: 1; }
    .message-list-wrap {
        flex: 1 1 0;
        min-height: 0;
    }

    .page-wrap {
        display: flex;
        flex-direction: column;
    }
    .hero { flex-shrink: 0; }
    .grid {
        flex: 1 1 auto;
        min-height: 0;
    }
}

/* ─── Mobile: no forced height, no scrollbar ─── */
@media (max-width: 899px) {
    .messages-col {
        flex: 1 1 360px;
        min-width: 260px;
    }
    .message-list-wrap {
        overflow-y: visible;
        flex: none;
        height: auto;
        padding-right: 0;
        margin-right: 0;
    }
}

/* ----- MESSAGE ITEMS ----- */
.message-item {
    background: var(--bg-card-alt);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 14px 16px;
    opacity: 0;
    animation: fadeIn 0.35s ease forwards;
    flex-shrink: 0;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.message-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    min-width: 0;
}
.message-name span { word-break: break-word; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    background: var(--accent);
    overflow: hidden;
}
.avatar.hadir { background: var(--chip-hadir-fg); }
.avatar.belum { background: var(--chip-belum-fg); }
.avatar i { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1)); }

.message-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 6px;
    word-break: break-word;
    white-space: pre-wrap;
}

.message-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.empty-state {
    text-align: center;
    padding: 32px 10px;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.empty-state i {
    font-size: 1.6rem;
    margin-bottom: 8px;
    display: block;
    color: var(--accent);
}

/* ----- MESSAGE STATUS ----- */
.message-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.message-status {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ----- PAGINATION ----- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-card-alt);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.page-btn:active { transform: scale(0.94); }
.page-btn:hover:not(:disabled) {
    border-color: var(--accent-strong);
    color: var(--accent-strong);
    box-shadow: var(--shadow);
}
.page-btn.active {
    background: var(--accent-strong);
    color: var(--accent-contrast);
    border-color: var(--accent-strong);
}
.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}
@media (max-width: 600px) {
    .page-btn { min-width: 48px; height: 48px; padding: 0 16px; font-size: 1rem; border-radius: 14px; position: relative; }
    .page-btn::after {
        content: '';
        position: absolute;
        top: -8px; bottom: -8px; left: -8px; right: -8px;
    }
    .pagination { gap: 10px; }
}

/* ----- TOASTS ----- */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: 100%;
    max-width: 90vw;
}
.toast {
    background: transparent;
    backdrop-filter: blur(12px);
    color: var(--toast-text);
    padding: 12px 24px;
    border-radius: 16px;
    box-shadow: var(--toast-shadow);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 16px;
    pointer-events: none;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    min-width: 200px;
    max-width: 100%;
}
.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.toast .toast-msg { display: flex; align-items: center; gap: 10px; }
.toast .toast-msg i { color: var(--accent); }
.toast .toast-timer {
    font-weight: 700;
    color: var(--accent-strong);
    min-width: 24px;
    text-align: center;
}
.toast .toast-btn {
    background: var(--error-bg);
    color: var(--error-fg);
    border: 1px solid currentColor;
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.toast .toast-btn:active { transform: scale(0.94); }
.toast .toast-btn:hover {
    transform: scale(1.05);
    background: var(--error-bg);
}

/* ── Footer ──────────────────────────────── */
footer {
  border-top: 1px solid var(--border-subtle);
  background: transparent;
  backdrop-filter: blur(5px);
  padding: 20px;
  text-align: center;
  font-size: .74rem;
  color: var(--accent-strong);
  flex-shrink: 0;
}

/* ----- RESPONSIVE (additional) ----- */
@media (max-width: 480px) {
    .topbar { padding: 12px 14px; }
    .form-card, .messages-card { padding: 18px 14px; }
    .hero h1 { font-size: 1.5rem; }
    .messages-header h2 { font-size: 1.2rem; }
    .toast-container { bottom: 16px; max-width: 92vw; }
    .toast { padding: 10px 16px; font-size: 0.82rem; width: 100%; }
}
@media (max-width: 400px) {
    .message-item-top { flex-wrap: wrap; }
    .message-name { flex: 1 1 100%; }
}

/* ─── Anti‑snooping ─── */
body.anti-snooping {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ─── BOKEH BLOBS ─── */
.bokeh-wrap {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bokeh {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    transition: opacity 0.4s;
}

/* Light theme blobs */
body:not(.dark-theme) .bokeh { opacity: 0.45; }
body:not(.dark-theme) .b1 { width: 340px; height: 340px; background: #f4abc4; top: -80px; left: -60px; }
body:not(.dark-theme) .b2 { width: 280px; height: 280px; background: #c5b3d3; bottom: 10%; right: -60px; }
body:not(.dark-theme) .b3 { width: 220px; height: 220px; background: #f7cdd8; bottom: 30%; left: 10%; }
body:not(.dark-theme) .b4 { width: 200px; height: 200px; background: #d4b8e0; top: 40%; right: 15%; }

/* Dark theme blobs */
body.dark-theme .bokeh { opacity: 0.18; }
body.dark-theme .b1 { width: 400px; height: 400px; background: #f4abc4; top: -100px; left: -80px; }
body.dark-theme .b2 { width: 320px; height: 320px; background: #595b83; bottom: 5%; right: -80px; }
body.dark-theme .b3 { width: 260px; height: 260px; background: #333456; bottom: 35%; left: 5%; }
body.dark-theme .b4 { width: 240px; height: 240px; background: #d4b8e0; top: 45%; right: 10%; }

/* ─── FLOATING PETALS ─── */
@keyframes petalFall {
    0%   { transform: translateY(-40px) translateX(0) rotate(0deg);   opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 0.7; }
    100% { transform: translateY(105vh) translateX(60px) rotate(360deg); opacity: 0; }
}
@keyframes petalSway {
    0%,100% { translate: 0 0; }
    50%      { translate: 30px 0; }
}

.petals-wrap {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.petal {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 14px;
    border-radius: 60% 40% 60% 40% / 50% 50% 50% 50%;
    animation: petalFall linear infinite, petalSway ease-in-out infinite;
    opacity: 0;
}

/* Light theme petals — soft pinks/mauves */
body:not(.dark-theme) .p1  { background: #e8a0b8; left: 8%;  animation-duration: 10s, 4s; animation-delay: 0s,    0s; }
body:not(.dark-theme) .p2  { background: #c5b3d3; left: 18%; animation-duration: 13s, 5s; animation-delay: 2s,    1s; }
body:not(.dark-theme) .p3  { background: #f4abc4; left: 30%; animation-duration: 9s,  3s; animation-delay: 4s,  0.5s; }
body:not(.dark-theme) .p4  { background: #d4a8cc; left: 45%; animation-duration: 14s, 6s; animation-delay: 1s,  2.5s; }
body:not(.dark-theme) .p5  { background: #e8b8c8; left: 55%; animation-duration: 11s, 4s; animation-delay: 6s,    1s; }
body:not(.dark-theme) .p6  { background: #c5b3d3; left: 65%; animation-duration: 12s, 5s; animation-delay: 3s,    3s; }
body:not(.dark-theme) .p7  { background: #f0b8cc; left: 72%; animation-duration: 8s,  3s; animation-delay: 7s,  0.5s; }
body:not(.dark-theme) .p8  { background: #d8a8d0; left: 80%; animation-duration: 15s, 6s; animation-delay: 0.5s, 2s; }
body:not(.dark-theme) .p9  { background: #e8a0b8; left: 88%; animation-duration: 10s, 4s; animation-delay: 5s,  1.5s; }
body:not(.dark-theme) .p10 { background: #c8b0d8; left: 95%; animation-duration: 13s, 5s; animation-delay: 2.5s, 0s; }

/* Dark theme petals — deeper pinks/purples */
body.dark-theme .p1  { background: #f4abc4; left: 8%;  animation-duration: 10s, 4s; animation-delay: 0s,    0s; }
body.dark-theme .p2  { background: #9b80c0; left: 18%; animation-duration: 13s, 5s; animation-delay: 2s,    1s; }
body.dark-theme .p3  { background: #e880a8; left: 30%; animation-duration: 9s,  3s; animation-delay: 4s,  0.5s; }
body.dark-theme .p4  { background: #b090d0; left: 45%; animation-duration: 14s, 6s; animation-delay: 1s,  2.5s; }
body.dark-theme .p5  { background: #f4abc4; left: 55%; animation-duration: 11s, 4s; animation-delay: 6s,    1s; }
body.dark-theme .p6  { background: #8878b8; left: 65%; animation-duration: 12s, 5s; animation-delay: 3s,    3s; }
body.dark-theme .p7  { background: #e090b8; left: 72%; animation-duration: 8s,  3s; animation-delay: 7s,  0.5s; }
body.dark-theme .p8  { background: #a880c8; left: 80%; animation-duration: 15s, 6s; animation-delay: 0.5s, 2s; }
body.dark-theme .p9  { background: #f4abc4; left: 88%; animation-duration: 10s, 4s; animation-delay: 5s,  1.5s; }
body.dark-theme .p10 { background: #9878b8; left: 95%; animation-duration: 13s, 5s; animation-delay: 2.5s, 0s; }

/* ─── make sure content sits above decor ─── */
.topbar, .page-wrap, footer { position: relative; z-index: 1; }