/* CSS Variables for Premium Theme */
:root {
    --bg-dark: #061120;
    --bg-card: #0c1a2e;
    --primary-gold: #c5a059;
    --gold-light: #f3e5ab;
    --gold-dark: #8b6e35;
    --gold-gradient: linear-gradient(135deg, #f5d782 0%, #c5a059 50%, #9e7f3b 100%);
    --gold-glow: 0 0 15px rgba(212, 175, 55, 0.4);
    --gold-glow-intense: 0 0 25px rgba(212, 175, 55, 0.8);
    --text-light: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: rgba(197, 160, 89, 0.25);
    --border-color-active: rgba(197, 160, 89, 0.6);
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Montserrat', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles - Preventing Horizontal Scrolling */
html, body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--bg-dark);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    color: var(--text-light);
    font-family: var(--font-body);
    line-height: 1.5;
    position: relative;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

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

/* Falling Leaf Particles Container */
#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.leaf {
    position: absolute;
    display: block;
    width: 25px;
    height: 25px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.8;
    pointer-events: none;
    z-index: 1;
    animation-name: fall, sway;
    animation-iteration-count: infinite, infinite;
    animation-timing-function: linear, ease-in-out;
}

@keyframes fall {
    0% { top: -5%; }
    100% { top: 105%; }
}

@keyframes sway {
    0% { transform: translateX(0px) rotate(0deg); }
    50% { transform: translateX(80px) rotate(180deg); }
    100% { transform: translateX(0px) rotate(360deg); }
}

/* Background Music Toggle & Tooltip */
.music-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none; /* Let background clicks pass, sub-elements specify pointer-events */
}

.music-tooltip {
    background: rgba(12, 26, 46, 0.95);
    border: 1px solid var(--primary-gold);
    color: var(--gold-light);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    white-space: nowrap;
    animation: tooltipFade 2s infinite alternate;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.music-tooltip.hidden {
    opacity: 0;
}

@keyframes tooltipFade {
    0% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

.music-btn {
    pointer-events: auto; /* Allow click */
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gold-gradient);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #000;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), var(--gold-glow);
    transition: var(--transition);
}

.music-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), var(--gold-glow-intense);
}

.music-icon.playing {
    animation: musicPulse 1.2s infinite ease-in-out alternate;
}

@keyframes musicPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.15) rotate(15deg); }
}

/* Main Layout Wrapper */
.wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ==========================================
   TOP COUNTDOWN BAR
   ========================================== */
.countdown-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    z-index: 10;
    width: 100%;
    max-width: 100%;
}

.countdown-bar:hover {
    border-color: rgba(197, 160, 89, 0.4);
}

.countdown-title {
    color: var(--gold-light);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    white-space: nowrap;
}

.countdown-wrapper {
    display: flex;
    gap: 6px;
    flex: 1;
    max-width: 340px;
    justify-content: flex-end;
}

.countdown-box {
    background: linear-gradient(145deg, #0e2038 0%, #061120 100%);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.35rem 0.2rem;
    text-align: center;
    flex: 1;
    min-width: 0; /* Let box shrink without breaking layout */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.countdown-box .number {
    display: block;
    font-size: clamp(0.95rem, 4vw, 1.25rem); /* Responsive text scaling */
    font-weight: 700;
    color: var(--gold-light);
    text-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
    font-family: var(--font-heading);
    line-height: 1.2;
}

.countdown-box .label {
    display: block;
    font-size: clamp(0.5rem, 2vw, 0.6rem); /* Responsive text scaling */
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-top: 1px;
}

/* ==========================================
   MAIN TWO-COLUMN LAYOUT
   ========================================== */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

/* LEFT PANEL (INVITATION) */
.left-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.invitation-card {
    position: relative;
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--primary-gold);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--gold-glow);
}

.invitation-img {
    width: 100%;
    display: block;
    height: auto;
}

/* Click Target on Invitation image */
.map-btn-overlay {
    position: absolute;
    bottom: 7.25%; /* Coordinates aligned perfectly over the invitation button */
    left: 50%;
    transform: translateX(-50%);
    width: 32.5%;
    height: 4.8%;
    border-radius: 50px;
    cursor: pointer;
    z-index: 10;
    background: rgba(197, 160, 89, 0.03);
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.2);
    animation: btnGlowPulse 1.8s infinite ease-in-out alternate;
    transition: var(--transition);
}

.map-btn-overlay:hover {
    background: rgba(197, 160, 89, 0.2);
    box-shadow: 0 0 20px rgba(245, 215, 130, 0.8);
    transform: translateX(-50%) scale(1.03);
}

@keyframes btnGlowPulse {
    0% { box-shadow: 0 0 5px rgba(197, 160, 89, 0.2); }
    100% { box-shadow: 0 0 15px rgba(245, 215, 130, 0.65); }
}

/* RIGHT PANEL (DETAILS SECTION) */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.panel-section {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.panel-section:hover {
    border-color: rgba(197, 160, 89, 0.35);
}

.panel-title {
    color: var(--gold-light);
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 6px;
}

.panel-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--gold-gradient);
}

/* ==========================================
   INTERACTIVE PANELS STYLING
   ========================================== */

/* RSVP Form */
.rsvp-subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

#rsvp-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--gold-light);
    font-weight: 500;
}

.form-group label .required {
    color: #ef4444;
}

input[type="text"],
input[type="tel"],
select,
textarea {
    background: #091729;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: var(--transition);
    width: 100%;
}

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-color-active);
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.2);
    background: #0d223d;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.radio-label input {
    display: none;
}

.custom-radio {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    transition: var(--transition);
}

.radio-label input:checked + .custom-radio {
    border-color: var(--primary-gold);
    box-shadow: var(--gold-glow);
}

.radio-label input:checked + .custom-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--gold-gradient);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Form Submit Button */
.submit-btn {
    background: var(--gold-gradient);
    color: #0a111a;
    border: none;
    padding: 0.7rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 25px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.4rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), var(--gold-glow);
    transition: var(--transition);
    font-family: var(--font-body);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3), var(--gold-glow-intense);
}

/* Success RSVP Modal */
.rsvp-success-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 17, 32, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.rsvp-success-overlay.active {
    opacity: 1;
    visibility: visible;
}

.success-content {
    text-align: center;
    padding: 1.25rem;
    max-width: 320px;
    transform: scale(0.85);
    transition: var(--transition);
}

.rsvp-success-overlay.active .success-content {
    transform: scale(1);
}

.success-icon {
    width: 45px;
    height: 45px;
    background: var(--gold-gradient);
    border-radius: 50%;
    color: #000;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
    box-shadow: var(--gold-glow-intense);
}

.success-content h4 {
    color: var(--gold-light);
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
}

.success-content p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.close-btn {
    background: transparent;
    border: 1px solid var(--primary-gold);
    color: var(--gold-light);
    padding: 0.35rem 1.25rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--gold-gradient);
    color: #000;
    border-color: transparent;
}

/* Sharing Section Styling */
.share-subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.zalo-share-preview {
    background: rgba(9, 23, 41, 0.4);
    border: 1px solid rgba(197, 160, 89, 0.15);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    width: 100%;
}

.preview-header {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
}

.zalo-bubble {
    background: #0068ff;
    color: #fff;
    padding: 1px 5px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 700;
}

.zalo-card-mockup {
    display: flex;
    gap: 8px;
    background: #0d223f;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    width: 100%;
    min-width: 0; /* Let flex container shrink */
}

.mockup-thumb {
    flex: 0 0 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(197, 160, 89, 0.2);
}

.mockup-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mockup-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    flex: 1; /* Allow content to fit correctly */
    min-width: 0; /* Core fix for text overflow/layout width blowout */
}

.mockup-title {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.mockup-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 2px;
}

.mockup-domain {
    font-size: 0.6rem;
    color: var(--primary-gold);
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-zalo-btn {
    background: linear-gradient(135deg, #0080ff 0%, #0050c8 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(0, 104, 255, 0.2) !important;
}

.share-zalo-btn:hover {
    background: linear-gradient(135deg, #1e90ff 0%, #0060df 100%) !important;
    transform: translateY(-1px);
}

.copy-link-btn {
    background: transparent;
    border: 1px solid var(--border-color);
}

.copy-link-btn.copied {
    border-color: #22c55e !important;
    color: #22c55e !important;
}

/* Map Section Styles */
.address-details p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.map-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #091729;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.action-btn:hover {
    border-color: var(--primary-gold);
    background: #0e243f;
}

.google-maps-btn:hover { background: #1a3c61; }
.apple-maps-btn:hover { background: #252525; }
.copy-btn.copied { border-color: #22c55e; color: #22c55e; }

.map-embed-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.map-embed-wrapper iframe {
    display: block;
}

/* Footer Section */
.main-footer {
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
}

.main-footer .company-name {
    font-size: 0.75rem;
    color: var(--gold-light);
    font-weight: 600;
    letter-spacing: 1.5px;
    margin-bottom: 2px;
}

.main-footer .copyright {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE MOBILE ADAPTABILITY
   ========================================== */
@media (max-width: 480px) {
    .wrapper {
        padding: 6px;
        gap: 10px;
    }
    
    .countdown-bar {
        flex-direction: column;
        padding: 0.5rem 0.75rem;
        gap: 6px;
        text-align: center;
    }
    
    .countdown-title {
        font-size: 0.85rem;
        justify-content: center;
    }
    
    .countdown-wrapper {
        width: 100%;
        max-width: 320px;
    }
    
    .panel-section {
        padding: 0.85rem;
    }
    
    .panel-title {
        font-size: 1.05rem;
    }
    
    .music-container {
        bottom: 15px;
        right: 15px;
    }
    
    .music-tooltip {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
    
    .music-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* ==========================================
   DESKTOP ADAPTATION (1 SCREEN VIEWPORT)
   ========================================== */
@media (min-width: 1024px) {
    body {
        height: 100vh;
        overflow: hidden;
    }

    .wrapper {
        height: 100vh;
        max-width: 1200px;
        padding: 15px;
        gap: 15px;
        overflow-y: hidden;
    }

    .countdown-bar {
        flex-shrink: 0;
        padding: 0.75rem 1.5rem;
    }

    .countdown-title {
        font-size: 1.1rem;
    }

    .countdown-box .number {
        font-size: 1.4rem;
    }

    .countdown-box .label {
        font-size: 0.65rem;
    }

    .main-layout {
        flex-direction: row;
        flex: 1;
        height: calc(100vh - 120px);
        overflow: hidden;
        align-items: stretch;
    }

    /* Left panel holds constrained image card */
    .left-panel {
        flex: 1.15;
        height: 100%;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        background: rgba(0,0,0,0.15);
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.02);
    }

    .invitation-card {
        display: inline-block;
        max-height: 100%;
        width: auto;
        border: 2px solid var(--primary-gold);
    }

    .invitation-img {
        max-height: calc(100vh - 124px); /* Constrained exactly to viewport height minus outer offsets */
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }

    /* Right panel scrolls details internally */
    .right-panel {
        flex: 1;
        height: 100%;
        overflow-y: auto;
        padding-right: 8px; /* Room for scrollbar */
    }

    /* Form displays inputs side-by-side on desktop */
    .form-row {
        flex-direction: row;
    }
    .form-row .form-group {
        flex: 1;
    }

    .share-actions {
        flex-direction: row;
    }
    .share-actions .action-btn {
        flex: 1;
    }

    .map-actions {
        flex-direction: row;
    }
    .map-actions .action-btn {
        flex: 1;
    }

    /* Custom elegant gold scrollbar for details panel */
    .right-panel::-webkit-scrollbar {
        width: 6px;
    }
    
    .right-panel::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.02);
        border-radius: 10px;
    }
    
    .right-panel::-webkit-scrollbar-thumb {
        background: var(--primary-gold);
        border-radius: 10px;
    }

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

/* Tablet adjust */
@media (min-width: 768px) and (max-width: 1023px) {
    .form-row {
        flex-direction: row;
    }
    .form-row .form-group {
        flex: 1;
    }
    .share-actions {
        flex-direction: row;
    }
    .share-actions .action-btn {
        flex: 1;
    }
    .map-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .map-actions .action-btn {
        flex: 1 1 calc(50% - 4px);
    }
    .map-actions .copy-btn {
        flex: 1 1 100%;
    }
}
