/* --- Global Reset & Fonts --- */
:root {
    --primary-color: #FFD700; /* Gold */
    --secondary-color: #4a90e2; /* Bright Blue */
    --dark-blue: #0b192f;
    --light-blue: #1e3a5f;
    --text-color: #e6f1ff;
    --text-muted: #a8b2d1;
    --font-family: 'IBM Plex Sans Thai', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* ป้องกันการเลื่อนหน้าจอ */
    font-family: var(--font-family);
    background-color: var(--dark-blue);
    color: var(--text-color);
}

/* --- Main Scene & Background --- */
.main-scene {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sky-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 65%; /* ท้องฟ้า 65% */
    background: linear-gradient(to top, #1e3a5f, #0b192f);
    z-index: 1;
}

.landmarks {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    opacity: 0.5;
}

.landmarks img {
    width: 100%;
    display: block;
}

.moon {
    position: absolute;
    top: 10%;
    left: 15%;
    width: 100px;
    height: 100px;
    background-color: #FFFACD;
    border-radius: 50%;
    box-shadow: 0 0 40px #FFFACD, 0 0 80px #FFFACD;
}

/* --- Fireworks Animation --- */
.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    background-image: radial-gradient(circle, #ffffff 20%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
    opacity: 0;
    animation: firework-anim 4s infinite;
}

.fw1 { top: 20%; left: 80%; animation-delay: 0s; }
.fw2 { top: 30%; left: 30%; animation-delay: 1.5s; }
.fw3 { top: 15%; left: 55%; animation-delay: 3s; }

@keyframes firework-anim {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    10% { opacity: 1; }
    50% { opacity: 1; transform: scale(1.5); }
    80% { opacity: 0; transform: scale(2.5); box-shadow: 0 0 20px 20px rgba(255, 215, 0, 0); }
    81% { box-shadow: 0 0 20px 20px gold; }
}


/* --- River & Krathongs --- */
.river-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35%; /* แม่น้ำ 35% */
    background: linear-gradient(to bottom, #1e3a5f, #112240);
    z-index: 2;
}

.krathong-wrapper {
    position: absolute;
    bottom: 0;
    left: var(--x-start, 50%);
    transform: translateY(100%) scale(var(--scale, 1));
    animation: float-river var(--duration) linear var(--delay) infinite;
    cursor: pointer;
    z-index: 10;
}
.krathong-wrapper:hover .krathong-bubble {
    opacity: 1;
    transform: translateY(-10px);
}

.krathong-img {
    width: 100px;
    transition: transform 0.3s ease;
    animation: bobbing 5s ease-in-out infinite;
}
.krathong-wrapper:hover .krathong-img {
    transform: scale(1.1);
}

.krathong-bubble {
    position: absolute;
    bottom: 90%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 14px;
    width: 200px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    pointer-events: none;
}
.krathong-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.9) transparent transparent transparent;
}


@keyframes float-river {
    to {
        transform: translateX(calc(100vw + 150px)) translateY(var(--y-pos)) scale(var(--scale, 1));
    }
}
@keyframes bobbing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}


/* --- Wave Animation --- */
.wave {
    position: absolute;
    left: -100px;
    bottom: 0;
    width: 200%;
    height: 100px;
    background-size: 1000px 100px;
    opacity: 0.2;
}
.wave.wave1 { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100"><path d="M0 50 C250 100 250 0 500 50 C750 100 750 0 1000 50 L1000 100 L0 100 Z" fill="%23FFFFFF"></path></svg>'); animation: wave-anim 15s linear infinite; z-index: 5; }
.wave.wave2 { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100"><path d="M0 60 C200 120 300 0 500 60 C700 120 800 0 1000 60 L1000 100 L0 100 Z" fill="%23FFFFFF"></path></svg>'); animation: wave-anim 20s linear infinite reverse; opacity: 0.15; z-index: 4; }
.wave.wave3 { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100"><path d="M0 70 C300 140 400 0 500 70 C600 140 700 0 1000 70 L1000 100 L0 100 Z" fill="%23FFFFFF"></path></svg>'); animation: wave-anim 25s linear infinite; opacity: 0.1; z-index: 3; }

@keyframes wave-anim {
    from { transform: translateX(0); }
    to { transform: translateX(-1000px); }
}


/* --- UI Elements (Top & Bottom) --- */
.top-ui, .bottom-ui {
    position: relative;
    width: 100%;
    text-align: center;
    z-index: 20;
    padding: 0 20px;
}

.top-ui {
    padding-top: 20px;
}
.logo { width: 150px; margin-bottom: 10px; }
.top-ui h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary-color);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.top-ui p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 10px auto;
    color: var(--text-muted);
}
.counter {
    background-color: rgba(0,0,0,0.3);
    border: 1px solid var(--light-blue);
    padding: 10px 20px;
    border-radius: 50px;
    display: inline-block;
    margin-top: 15px;
}
.counter small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.counter b {
    font-size: 1.8rem;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.bottom-ui {
    position: absolute;
    bottom: 0;
    left: 0;
    padding-bottom: 20px;
    padding-top: 20px;
    background: linear-gradient(to top, rgba(11, 25, 47, 0.8), transparent);
}
.share-text { display: none; /* ซ่อนไว้ก่อน */}

.social-icons {
    display: none; /* ซ่อนไว้ก่อน */
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.social-icon.facebook { background-color: #1877F2; }
.social-icon.twitter { background-color: #1DA1F2; }
.social-icon.line { background-color: #06C755; }
.social-icon:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.main-button {
    background-image: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    border: none;
    border-radius: 50px;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}
.main-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
}
.main-button .icon { margin-right: 10px; }


/* --- Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.5s ease;
}

.modal-content {
    background-color: var(--dark-blue);
    margin: 5% auto;
    padding: 30px 40px;
    border: 1px solid var(--light-blue);
    width: 90%;
    max-width: 600px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    animation: slideIn 0.5s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.close-button {
    color: var(--text-muted);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}
.close-button:hover { color: #fff; }

/* Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    transition: color 0.4s;
}
.stepper-item.active { color: var(--primary-color); }
.stepper-item span {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--light-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid var(--light-blue);
    transition: all 0.4s;
}
.stepper-item.active span {
    background-color: var(--primary-color);
    color: var(--dark-blue);
    border-color: var(--primary-color);
}
.stepper-item p { margin-top: 8px; font-size: 0.9rem; }
.stepper-line {
    flex-grow: 1;
    height: 2px;
    background-color: var(--light-blue);
    margin: 0 10px;
    transform: translateY(-15px);
}

/* Form Steps */
.form-step { display: none; }
.form-step.active { display: block; animation: stepFadeIn 0.5s; }
@keyframes stepFadeIn { from { opacity: 0; } to { opacity: 1; } }

.step-header {
    text-align: center;
    margin-bottom: 25px;
}
.step-header h3 { font-size: 1.8rem; color: #fff; }
.step-header p { color: var(--text-muted); font-size: 1rem; }

/* Selection List (Krathong, Decoration) */
.selection-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.selection-list li label {
    display: block;
    cursor: pointer;
    text-align: center;
}
.selection-list input[type="radio"] { display: none; }
.selection-list .radio-visual {
    display: block;
    padding: 10px;
    border: 2px solid var(--light-blue);
    border-radius: 10px;
    transition: all 0.3s ease;
}
.selection-list .radio-visual img {
    width: 100%;
    height: auto;
    max-height: 80px;
    object-fit: contain;
}
.selection-list span:not(.radio-visual) {
    display: block;
    margin-top: 10px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.selection-list input[type="radio"]:checked + .radio-visual {
    border-color: var(--primary-color);
    background-color: rgba(255, 215, 0, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.2);
}
.selection-list input[type="radio"]:checked + .radio-visual + span {
    color: var(--primary-color);
    font-weight: 500;
}

/* Form Group (Name, Message) */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--light-blue);
    border: 1px solid #2a4a75;
    border-radius: 8px;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}
.modal-nav-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}
.modal-nav-btn.primary {
    background-image: linear-gradient(45deg, var(--secondary-color), #3b82f6);
    color: white;
}
.modal-nav-btn.primary:hover {
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    transform: translateY(-2px);
}
.modal-nav-btn.secondary {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--light-blue);
}
.modal-nav-btn.secondary:hover {
    background-color: var(--light-blue);
    color: white;
}
.modal-nav-btn.submit-btn {
    background-image: linear-gradient(45deg, #FFD700, #FFA500);
    color: var(--dark-blue);
    font-weight: 600;
}