/* ===============================
   Global Base Reset and Variables
   =============================== */
   *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --deep-red: #dc143c;
    --base-font-size: 16px;
    --heading-font-size: 2rem;
    --button-font-size: 1.2rem;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --heading-xl: clamp(1.8rem, 4vw, 2.5rem);
    --heading-lg: clamp(1.5rem, 3vw, 2rem);
    --heading-md: clamp(1.2rem, 2.5vw, 1.5rem);
    --text-base: clamp(0.9rem, 1.5vw, 1.1rem);
    --text-sm: clamp(0.8rem, 1.2vw, 0.9rem);
}

/* ===============================
   Global Fix and Body Styles
   =============================== */
html {
    overflow-x: hidden;
}

body {
    font-family: 'Lato', sans-serif;
    background: linear-gradient(135deg, #ffe6e6, #ffb3b3);
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ===============================
   Container
   =============================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 2;
    min-height: min-content;
}

/* ===============================
   Floating Hearts Background
   =============================== */
#hearts-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-heart {
    position: absolute;
    background: #f18e9f;
    opacity: 0.8;
    width: 40px;
    height: 40px;
    transform: rotate(-45deg);
    /* animation: floatHeart 8s ease-in-out infinite; */
}

.bg-heart:before,
.bg-heart:after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
    width: 100%;
    height: 100%;
}

.bg-heart:before {
    top: -50%;
}

.bg-heart:after {
    left: 50%;
}

@keyframes floatHeart {
    0% {
        transform: rotate(-45deg) translate(0, 0) scale(1);
        opacity: 0.2;
    }
    50% {
        transform: rotate(-45deg) translate(-20px, -20px) scale(1.1);
        opacity: 0.15;
    }
    100% {
        transform: rotate(-45deg) translate(0, 0) scale(1);
        opacity: 0.2;
    }
}

/* Position updates for individual hearts */
.bg-heart:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.bg-heart:nth-child(2) { left: 30%; top: 40%; animation-delay: 2s; }
.bg-heart:nth-child(3) { left: 50%; top: 15%; animation-delay: 4s; }
.bg-heart:nth-child(4) { left: 70%; top: 50%; animation-delay: 6s; }
.bg-heart:nth-child(5) { left: 85%; top: 30%; animation-delay: 8s; }
.bg-heart:nth-child(6) { left: 15%; top: 70%; animation-delay: 1s; }
.bg-heart:nth-child(7) { left: 45%; top: 80%; animation-delay: 3s; }
.bg-heart:nth-child(8) { left: 75%; top: 75%; animation-delay: 5s; }
.bg-heart:nth-child(9) { left: 90%; top: 60%; animation-delay: 7s; }
.bg-heart:nth-child(10) { left: 25%; top: 85%; animation-delay: 9s; }

/* ===============================
   Popups and Message Pages
   =============================== */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.97);
    border-radius: 12px;
    padding: clamp(0.8rem, 2vw, 1.2rem);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 101;
    backdrop-filter: blur(4px);
    width: 95%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    gap: var(--spacing-sm);
}
.popup.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.message-page {
    display: none;
    animation: fadeIn 0.5s ease forwards;
    width: 100%;
    height: auto;
    min-height: min-content;
    overflow-y: auto;
    margin: 1rem 0;
}
.message-page.active {
    display: block;
}

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

/* ===============================
   Form and Button Styles
   =============================== */
.form-group {
    margin: 1rem 0;
}
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: bold;
}
.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    font-size: var(--base-font-size);
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* Headings and Paragraphs for Popups and Message Content */
.popup h2,
.message-content h2 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    text-align: center;
    color: #5a3e36;
    letter-spacing: 0.5px;
}
.message-content p,
.popup p {
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
    text-align: center;
    color: #4a4a4a;
    line-height: 1.5;
}
.message-content p {
    font-size: 1.4rem;
    padding: var(--spacing-sm);
}
.love-sign {
    font-size: 1.6rem;
    margin-top: 1.5rem;
}

/* Emphasized text styling */
em {
    font-style: italic;
    color: var(--deep-red);
    font-weight: 500;
    font-size: 1.2em;
}

/* Buttons (shared across pages and popups) */
.buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}
button {
    background-color: #e91e63;
    border: none;
    color: #fff;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    white-space: normal;
    height: auto;
    margin: 0.5rem;
    padding: clamp(0.5rem, 2vw, 1rem) clamp(1rem, 3vw, 2rem);
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
}
button:hover {
    background-color: #d81b60;
    transform: translateY(-3px);
}
button:active {
    transform: translateY(0);
}
/* Add a focus outline for accessibility and user feedback */
button:focus {
    outline: 2px solid #ffffff; /* or another visible color */
    outline-offset: 2px;
}

/* Centered share button styling */
.share-button {
    background-color: #2196F3;
    display: block;
    margin: 1rem auto 0;
}
.share-button:hover {
    background-color: #1976D2;
}

/* Customizes the "Create Yours" button */
.customize-button {
    background-color: #e91e63;
    border: none;
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: block;
    margin: 1rem auto 0;
}
.customize-button:hover {
    background-color: #d81b60;
    transform: translateY(-3px);
}
.customize-button:active {
    transform: translateY(0);
}

/* ===============================
   Landing Page Specific Styles
   =============================== */
#landingPage, #personalizationPage, #previewMessage {
    text-align: center;
}
#landingPage .message-content {
    position: relative;
    padding: 1rem;
    text-align: center;
}
#landingPage .message-content::before,
#landingPage .message-content::after {
    content: '💝';
    font-size: 2rem;
    position: absolute;
    opacity: 0.8;
}
#landingPage .message-content::before {
    top: 0;
    left: 10%;
}
#landingPage .message-content::after {
    bottom: 0;
    right: 10%;
}
#landingPage h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--deep-red);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}
#landingPage p {
    font-size: 1.2rem;
    color: #4a4a4a;
    margin-bottom: 1rem;
    line-height: 1.3;
}

/* ===============================
   Overlay for Popups
   =============================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.2);
    z-index: 100;
}

/* Specific improvements for #sharePopup */
#sharePopup {
    z-index: 102;
    background: #fff;
}

/* ===============================
   Responsive Adjustments
   =============================== */
@media (max-width: 768px) {
    :root {
        --base-font-size: 14px;
        --heading-font-size: 1.75rem;
        --button-font-size: 1rem;
    }
    .buttons {
        flex-direction: column;
        align-items: center;
    }
    button {
        width: 100%;
        max-width: 300px;
        padding: clamp(0.4rem, 1.5vw, 0.8rem) clamp(0.8rem, 2.5vw, 1.5rem);
        font-size: clamp(0.8rem, 2vw, 1rem);
        margin: 0.3rem; /* Reduced from 0.5rem */
    }
    .message-content {
        padding: 1rem;
    }
    h2 {
        font-size: var(--heading-font-size);
    }
    p {
        font-size: var(--base-font-size);
    }
    body, .container {
        padding: 0.5rem;
        margin: 0 auto;
        overflow-x: hidden;
        max-width: 100%;
    }
    p, button, .message-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    .button-container {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    .footer-donate .donate-button {
        padding: 5px 10px;
        font-size: 11px;
    }
    /* Adjust default message buttons size */
    .default-msg-buttons button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        margin: 0.2rem;
    }

}

@media (max-width: 480px) {
    .popup {
        width: 95%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.98);
        padding: var(--spacing-sm);
    }
    button {
        font-size: 1rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    .share-button {
        padding: 0.8rem 1.5rem;
    }
    .message-page {
        min-height: min-content;
        height: auto;
        overflow-y: auto;
    }
    body {
        padding: var(--spacing-xs);
    }
    .container {
        padding: 0 1rem;
    }
    .buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    button {
        width: 100%;
        max-width: 250px;
    }
    /* Responsive share popup text & buttons */
    #sharePopup h2 {
        font-size: 1.2rem;
        line-height: 1.3;
    }
    #sharePopup button {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
    }
    /* Specific fix for <pre> elements in preview message */
    #previewMessage .preview-content {
        font-size: 0.9rem;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        margin: 0 1rem;
    }
    .button-container {
        width: 90%; /* Constrain width */
        margin: 0 auto;
    }

    button {
        max-width: 250px; /* Limit maximum width */
    }
}

@media (max-width: 360px) {
    .popup {
        width: 95%;
        padding: 0.75rem;
    }
    .buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    button {
        width: 100%;
        min-width: unset;
        max-width: 250px;
    }
    .popup h2 {
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        margin-bottom: 1rem;
    }
}

/* ===============================
   Floating Heart (from createHeartEffect)
   =============================== */
/* Lower z-index to ensure hearts remain behind all popups and text */
.floating-heart {
    position: fixed;
    z-index: 0 !important;
    pointer-events: none;
    -webkit-animation: floatHeart 6s linear infinite;
    animation: floatHeart 6s linear infinite;
    color: pink;
    opacity: 0.8;
    bottom: 0;
}

/* We'll define the animation here, not inline */
@keyframes floatHeart {
    0% {
        transform: translateY(0) rotate(0deg); /* Only vertical translation */
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg); /* Only vertical translation */
        opacity: 0;
    }
}

/* Additional CSS for confetti if needed */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 0;
    animation: fall 3s linear forwards;
}
@keyframes fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Inline error message styling */
.error-message {
    color: #d8000c; /* or a red shade that fits your design */
    background-color: #ffbaba; /* subtle background to highlight error */
    padding: 0.5rem;
    border-radius: 5px;
    margin: 0.5rem 0;
    display: none; /* shown only when an error occurs */
}

/* Style adjustments for the final YES message */
#yesMessage .message-content p,
#yesMessage .love-sign {
    font-weight: bold;
    text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.3); /* Added text shadow */
}

/* Styling for default message options in the personalization page */
.default-messages {
    margin: 1rem 0;
    text-align: center;
}
.default-messages p {
    margin-bottom: 0.5rem;
    font-size: var(--base-font-size);
    color: #333;
}
.default-msg-buttons button {
    background-color: #f18e9f;
    border: none;
    color: #fff;
    border-radius: 30px;
    cursor: pointer;
    padding: clamp(0.5rem, 2vw, 1rem) clamp(1rem, 3vw, 2rem);
    margin: 0.3rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.default-msg-buttons button:hover {
    background-color: #d81b60;
    transform: translateY(-2px);
}

/* Update footer-donate styles */
.footer-donate {
    position: absolute;
    bottom: 0px; /* Increased bottom spacing */
    left: 0;
    right: 0;
    margin: 0 auto;
    text-align: center;
    z-index: 10;
    padding: 0.5rem 0;
    width: fit-content; /* Changed to fit-content for better centering */
}

/* Update donate button styles */
.footer-donate .donate-button {
    background-color: #ffcc00;
    border: none;
    padding: 8px 16px; /* Slightly reduced padding */
    font-size: 14px; /* Slightly smaller font */
    color: #000;
    border-radius: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: inline-block;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.footer-donate .donate-button:hover {
    background-color: #e6b800;
    transform: translateY(-2px);
}

/* optimized for mobile */
@-webkit-keyframes floatHeart {
    0% { -webkit-transform: translateY(0) rotate(0deg); transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { -webkit-transform: translateY(-100vh) rotate(360deg); transform: translateY(-100vh) rotate(360deg); opacity: 0; }
  }
@keyframes floatHeart {
0% { -webkit-transform: translateY(0) rotate(0deg); transform: translateY(0) rotate(0deg); opacity: 1; }
100% { -webkit-transform: translateY(-100vh) rotate(360deg); transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}


/* Add these to the existing CSS file */
#customNoMessage .form-group textarea {
    width: 100%;
    padding: 1rem;
    margin: 1rem 0;
    border: 2px solid #f18e9f;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
}

#customNoMessage .default-messages {
    margin: 1.5rem 0;
}

#customNoMessage .default-msg-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

#customNoMessage .default-msg-buttons button {
    background-color: #f18e9f;
    color: white;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#customNoMessage .default-msg-buttons button:hover {
    transform: translateY(-2px);
    background-color: #e77c8e;
}

#finalNoText {
    font-size: 1.2rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    line-height: 1.5;
}

/* New styles for the Final NO share buttons */
.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin: 1.5rem 0;
}

.share-buttons button {
    width: 80%;
    max-width: 300px;
}

/* Adjust button container spacing */
.button-container {
    gap: 0.8rem; /* Reduced from 1rem */
}


/* modal styles for payment QR code */
.modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.qr-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-block;
    margin: 20px auto;
}

#closePaymentModal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

#closePaymentModal:hover {
    color: #000;
}
