/* Reset & Variables */
@font-face {
    font-family: 'Fz Aghita';
    src: url('fonts/Aghita.woff2') format('woff2'),
         url('FzAghita.ttf') format('truetype'),
         url('FzAghita.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-red: #7E1F1A;
    --dark-red: #5e1511;
    --env-red: #a4231b;
    --gold: #D4AF37;
    --gold-light: #f0d497;
    --bg-main: #f5ebe1;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Cormorant Garamond', 'Roboto', sans-serif;
    --font-names: 'Fz Aghita', 'Baskerville', 'Times New Roman', serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background-color: #1f0504;
    color: #333;
    transition: background-color 1.5s ease;
}

body.opened {
    background-color: #ffffff;
}

.app-wrapper {
    max-width: 850px;
    margin: 0 auto;
    background-color: var(--bg-main);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" opacity="0.05"><circle cx="100" cy="100" r="80" fill="none" stroke="%237E1F1A" stroke-width="2"/></svg>');
    background-size: 400px;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.6);
    overflow-x: hidden;
    display: none; /* Hidden until envelope opens */
}

/* Base Classes */
.text-red {
    color: var(--primary-red);
}

.tracking-wide { letter-spacing: 2px; }
.tracking-widest { letter-spacing: 4px; }
.tracking-wider { letter-spacing: 3px; }

.fw-500 { font-weight: 500; }
.text-sm { font-size: 0.9rem; }
.text-xs { font-size: 0.75rem; }

/* =========================================
   ENVELOPE SCREEN
   ========================================= */
.envelope-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: #1f0504;
    display: flex;
    align-items: center;
    justify-content: center;
}

.envelope-card {
    position: relative;
    width: 90%;
    max-width: 750px;
    padding: 20px 70px;
    background-color: #8A1A14;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.2);
    transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
    overflow: hidden;
}

.envelope-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.2;
    background-image: url('images/dragon_left.webp'), url('images/dragon_right.webp');
    background-position: left top, right bottom;
    background-size: 280px, 280px;
    background-repeat: no-repeat, no-repeat;
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 576px) {
    .envelope-card::before {
        background-image: url('images/dragon_left.webp');
        background-position: center;
        background-size: 450px;
        opacity: 0.15;
    }
}

.envelope-card > * {
    position: relative;
    z-index: 1;
}

.envelope-opened .envelope-card {
    transform: translateY(-120%);
}

.env-logo {
    width: 50px;
    height: 50px;
    background: var(--gold-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    box-shadow: 0 0 15px rgba(234, 221, 150, 0.4);
    animation: pulsateLogo 2s infinite ease-in-out;
}

@keyframes pulsateLogo {
    0%, 100% { transform: scale(1); box-shadow: 0 0 15px rgba(240, 212, 151, 0.4); }
    50% { transform: scale(1.15); box-shadow: 0 0 25px rgba(240, 212, 151, 0.8); }
}
.env-logo-icon {
    width: 28px;
    height: 28px;
    filter: brightness(0) saturate(100%) invert(16%) sepia(55%) saturate(3665%) hue-rotate(346deg) brightness(94%) contrast(89%);
    opacity: 0.95;
}

.env-names {
    font-family: var(--font-names);
    font-size: 2.8rem;
    color: var(--gold-light);
    margin: 0;
    line-height: 1.2;
}

.env-amp {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    color: var(--gold-light);
}

.env-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    opacity: 0.8;
}
.env-divider::before, .env-divider::after {
    content: '';
    width: 60px;
    height: 1px;
    background: var(--gold-light);
}
.env-divider i {
    color: var(--gold-light);
    font-size: 0.7rem;
}

.env-date {
    color: var(--gold-light);
    font-family: var(--font-serif);
    font-size: clamp(0.7rem, 3.8vw, 1rem); /* Fluid font size for 1 line fit on mobile */
    white-space: nowrap; /* Forces text to stay on one line */
    margin-bottom: 25px;
    opacity: 0.9;
}

.env-invite {
    color: var(--gold-light);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-style: italic;
    opacity: 0.9;
    margin-bottom: 40px;
}

.btn-open {
    background: linear-gradient(135deg, #f7e7a6, #e0c268);
    color: #4a1511;
    border: none;
    padding: 12px 35px;
    border-radius: 40px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-family: var(--font-serif);
    transition: transform 0.2s;
}
.btn-open:hover {
    transform: scale(1.05);
}

/* =========================================
   MAIN APP CONTENT (max-width: 450px)
   ========================================= */
.main-content section{
    background-color: rgb(236 223 214);
}
/* Header & Couple Area */
.top-red-pattern, .bottom-red-pattern {
    width: 100%;
    height: 100px;
    background-color: var(--primary-red);
    background-image: url('images/dragon_left.webp');
    background-size: 300px;
    background-repeat: repeat-x;
    background-position: center;
    border-bottom: 2px solid var(--gold);
    border-top: 2px solid var(--gold);
}

.mid-red-band {
    position: absolute;
    top: 65px;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #9c2720;
    background-image: url('images/dragon_left.webp');
    background-size: 250px;
    opacity: 0.95;
    z-index: 0;
}

.sh-text-center {
    font-size: clamp(2.8rem, 9vw, 4rem);
    color: var(--primary-red);
    line-height: 1;
    font-weight: 700;
    font-family: serif;
    text-shadow: 
        2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff,
        0px 2px 0 #fff, 0px -2px 0 #fff, 2px 0px 0 #fff, -2px 0px 0 #fff,
        0 4px 8px rgba(0,0,0,0.3);
    position: relative;
    z-index: 5;
}

.avatar-circle {
    width: clamp(100px, 28vw, 145px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    margin: 0 auto;
    border: none;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.groom-img { 
    background-image: url('images/co-dau-chu-re/chu-re.jpg'); 
    background-size: 150%;
    background-position: 100% 15%;
}
.bride-img { 
    background-image: url('images/co-dau-chu-re/co-dau.jpg'); 
    background-position: center 15%;
}

.role-title {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
    margin-bottom: 2px;
    color: #444;
}

.name-title {
    font-family: var(--font-names);
    font-size: 2rem;
    color: var(--primary-red);
    margin: 0;
}

.sh-box {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 2px solid var(--primary-red);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-main);
}

.sh-icon {
    width: 25px;
}

/* Red Banners */
.red-banner {
    background-color: #8b2621;
    color: #fff;
    text-align: center;
    padding: 15px 0;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 2px;
}

/* Info Section */
.parents-col {
    position: relative;
    padding: 0 10px;
}
.border-end-red::after {
    content: '';
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%;
    width: 1px;
    background-color: var(--primary-red);
}

.address-small {
    font-size: 0.75rem;
    line-height: 1.3;
    margin-top: 5px;
}

.huge-name {
    font-family: var(--font-names);
    font-size: 3rem;
    color: var(--primary-red);
    line-height: 1.1;
}
.huge-amp {
    font-family: var(--font-serif);
    font-size: 1.5rem;
}

.divider-vline {
    width: 1px;
    height: 20px;
    background-color: var(--primary-red);
    opacity: 0.5;
}

.big-day {
    font-size: 2.5rem;
    font-weight: 500;
    font-family: var(--font-serif);
    line-height: 1;
    color: var(--primary-red);
}

/* Album */
.album-grid-img {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.album-overlay {
    position: absolute;
    inset: 0 0 0 10px; /* Bootstrap gutter adjust */
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
}
/* Quick fix for bootstrap gutter on absolute inset */
.col-6.position-relative > .album-overlay {
    left: calc(var(--bs-gutter-x) * 0.5);
    right: calc(var(--bs-gutter-x) * 0.5);
    bottom: 0;
    top: 0;
}

/* Party Section Buttons */
.btn-red-solid {
    background-color: #8b2621;
    color: white;
    border: none;
    transition: 0.3s;
    font-size: 0.9rem;
    letter-spacing: 1px;
}
.btn-red-solid:hover {
    background-color: var(--dark-red);
    color: white;
}
.add-calendar-link {
    color: var(--primary-red);
    text-decoration: underline;
    font-style: italic;
    font-size: 0.85rem;
}

.time-bold {
    font-size: 1.8rem;
    font-weight: bold;
}

/* Map Section */
.address-p {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0 15px;
}

/* Lì Xì (Gift) Section */
.gift-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--primary-red);
    margin-bottom: 30px;
}

.lixi-wrapper {
    position: relative;
    width: 110px;
    height: 140px;
    margin: 0 auto;
    cursor: pointer;
    animation: floating 3s ease-in-out infinite;
}

.lixi-envelope {
    width: 100%;
    height: 100%;
    background-color: #d11e13;
    border: 2px solid #edc653;
    border-radius: 6px;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2), inset 0 0 0 3px #bb1910;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: shakeLoop 3s ease-in-out infinite;
}

.lixi-envelope::before, .lixi-envelope::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(237, 198, 83, 0.4);
}
.lixi-envelope::before { top: 4px; left: 4px; right: 4px; bottom: 4px; }
.lixi-envelope::after { top: 8px; left: 8px; right: 8px; bottom: 8px; }

.lixi-circle {
    width: 38px;
    height: 38px;
    background-color: #edc653;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lixi-sh {
    width: 22px;
    opacity: 0.9;
}

.click-hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 15px;
}

/* Coins */
.coin {
    position: absolute;
    color: #edc653;
    font-size: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.coin-1 { top: 10px; left: -25px; animation: floatCoin 4s infinite; }
.coin-2 { bottom: 20px; left: -15px; animation: floatCoin 3s infinite 1s; }
.coin-3 { top: 30px; right: -30px; font-size: 0.8rem; animation: floatCoin 3.5s infinite 0.5s; }
.coin-4 { bottom: 20px; right: -20px; font-size: 1.2rem; animation: floatCoin 4.5s infinite 2s; }

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes shakeLoop {
    0%, 80%, 100% { transform: rotate(0) scale(1); }
    85% { transform: rotate(-5deg) scale(1.05); }
    90% { transform: rotate(5deg) scale(1.05); }
    95% { transform: rotate(-5deg) scale(1.05); }
}

@keyframes floatCoin {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(20deg); }
}

/* Modal Gift */
.modal-gift .modal-content {
    background-color: var(--bg-main);
    border: none;
    border-radius: 8px;
    overflow: hidden;
}
.modal-gift .modal-header {
    background-color: #8b2621;
    color: white;
    border-bottom: none;
    justify-content: center;
    position: relative;
    padding: 12px;
}
.modal-gift .modal-title {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 500;
}
.modal-gift .btn-close {
    position: absolute;
    right: 15px;
    filter: invert(1) grayscale(100%) brightness(200%);
    font-size: 0.8rem;
}
.qr-title {
    font-family: var(--font-sans);
    color: var(--primary-red);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 10px;
}
.qr-box {
    background: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.qr-img {
    width: 100%;
    max-width: 150px;
    margin: 0 auto 10px auto;
}
.qr-info {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.85rem;
    color: #333;
    line-height: 1.4;
    margin-top: 5px;
}
.qr-info strong {
    color: var(--primary-red);
    font-size: 0.9rem;
}
.btn-save-qr {
    color: var(--primary-red);
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-block;
    margin-top: 5px;
    font-weight: 500;
}

/* Guestbook section */
.form-box {
    background-color: white;
    border-top: 3px solid #8b2621;
    border-radius: 0 0 6px 6px;
}
.custom-input {
    background-color: #fcfcfc;
    border: 1px solid #eee;
    font-size: 0.9rem;
}

.guest-msg {
    border-radius: 6px;
    border-left: 3px solid var(--primary-red);
}
.g-name {
    font-weight: 600;
    color: var(--primary-red);
    margin: 0;
    font-size: 0.9rem;
}
.g-date {
    font-size: 0.7rem;
    color: #999;
}
.g-text {
    font-size: 0.85rem;
    color: #444;
    margin: 0;
}

/* Custom Scrollbar cho Guestbook */
.guest-list {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-red) #f9f4f1;
}
.guest-list::-webkit-scrollbar {
    width: 6px;
}
.guest-list::-webkit-scrollbar-track {
    background: #f9f4f1;
    border-radius: 10px;
}
.guest-list::-webkit-scrollbar-thumb {
    background-color: #d4a594;
    border-radius: 10px;
}
.guest-list::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-red);
}

/* Background Music Toggle */
.btn-music-float {
    position: fixed;
    bottom: 30px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--primary-red);
    border: 2px solid var(--primary-red);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}
.btn-music-float:hover {
    background-color: var(--primary-red);
    color: white;
}
.btn-music-float.playing i {
    animation: rotateDisk 4s linear infinite;
}
@keyframes rotateDisk {
    100% { transform: rotate(360deg); }
}
