:root {
    /* Ocean Blue Theme (Day) */
    --primary: #0097e6; /* Tropical Ocean Blue */
    --primary-dark: #0081c6;
    --accent: #e1b12c; /* Sand/Sun Yellow */
    --text-main: #2f3640;
    --text-muted: #4b6584;
    --bg-main: transparent; /* Changed to transparent to show scenery */
    --bg-card: rgba(255, 255, 255, 0.95); /* Glassmorphism lebih tebal */
    --border: rgba(255, 255, 255, 0.4);
    --font-main: 'Poppins', sans-serif;
    
    /* Scenery Variables */
    --sky-color-top: #4bcffa;
    --sky-color-bottom: #f5f6fa;
    --celestial-color: #fbc531; /* Sun */
    --celestial-glow: rgba(251, 197, 49, 0.6);
}

[data-theme="dark"] {
    /* Night Theme */
    --primary: #3c6382; /* Muted Moonlight Blue */
    --primary-dark: #0a3d62;
    --accent: #f5f6fa; /* Moonlight */
    --text-main: #f5f6fa;
    --text-muted: #dcdde1;
    --bg-card: rgba(15, 25, 50, 0.95); /* Dark Glassmorphism lebih tebal dan gelap */
    --border: rgba(255, 255, 255, 0.1);
    
    /* Scenery Variables (Night) */
    --sky-color-top: #0c2461;
    --sky-color-bottom: #1e3799;
    --celestial-color: #f5f6fa; /* Moon */
    --celestial-glow: rgba(245, 246, 250, 0.4);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
}

.text-accent { color: var(--accent); }
.text-gradient {
    background: linear-gradient(135deg, var(--accent), #ff9f43);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95); /* Selalu Terang di semua mode */
    backdrop-filter: blur(15px);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    color: #2f3640; /* Selalu Gelap */
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo .text-accent {
    color: #0097e6; /* Selalu Biru Terang */
}

.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links a {
    text-decoration: none;
    color: #4b6584; /* Selalu Gelap Muted */
    font-weight: 600;
    transition: all 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    opacity: 1;
    color: var(--accent);
    font-weight: 700;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

/* Hero Section */
.hero {
    /* Removed linear background to let the scenery show through */
    padding: 100px 5% 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
    /* Optional: glassmorphism box for hero to improve readability */
    background: var(--bg-card);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--border);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 20px;
    color: var(--text-main);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    padding: 8px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--border);
}

.search-box i {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-left: 15px;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px;
    font-size: 1rem;
    font-family: var(--font-main);
}

.btn-search {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-search:hover { background: var(--primary-dark); }

/* Removed old Decorative Shapes (Replaced by Scenery) */

/* Main Container */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 60px 5%;
}

/* Filters */
.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 10px 25px;
    border-radius: 50px;
    font-family: var(--font-main);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Gallery Grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* Template Card */
.template-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.template-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.card-img {
    width: 100%;
    height: 220px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.card-category {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--bg-card);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.card-content {
    padding: 20px;
}

.card-title {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.btn-download-trigger {
    width: 100%;
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--primary);
    padding: 12px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.template-card:hover .btn-download-trigger {
    background: var(--primary);
    color: #ffffff; /* Selalu putih saat di-hover */
}

/* Modal Styling (The Trick) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    padding: 40px 30px;
    position: relative;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 15px; right: 15px;
    background: #f1f2f6;
    border: none;
    width: 35px; height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.close-modal:hover {
    background: #ff7675;
    color: white;
}

.modal-header h2 { color: var(--primary-dark); margin-bottom: 5px; }
.modal-header p { color: var(--text-muted); margin-bottom: 25px; }

/* Native Ad inside Modal */
.sponsor-box {
    background: #fffdf5;
    border: 2px dashed var(--accent);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.sponsor-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sponsor-link { text-decoration: none; }
.sponsor-content {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}
.sponsor-content h4 { color: #d35400; font-size: 1rem; margin-bottom: 4px; }
.sponsor-content p { color: var(--text-muted); font-size: 0.85rem; }

/* Countdown & Download Button */
.spinner {
    width: 40px; height: 40px;
    border: 4px solid #f1f2f6;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.btn-download-real {
    display: inline-block;
    background: #00b894;
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 5px 15px rgba(0, 184, 148, 0.3);
    transition: transform 0.2s, background 0.2s;
}

.btn-download-real:hover {
    background: #00a885;
    transform: scale(1.05);
}

.hidden { display: none !important; }

.modal-note {
    font-size: 0.8rem;
    color: #b2bec3;
    margin-top: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .nav-links { display: none; }
}

/* ==================================================
   DYNAMIC BEACH SCENERY
   ================================================== */
.scenery-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background: linear-gradient(to bottom, var(--sky-color-top) 0%, var(--sky-color-bottom) 60%, var(--primary-dark) 100%);
    transition: background 1s ease-in-out;
    overflow: hidden;
}

/* Celestial Body (Sun / Moon) */
.celestial {
    position: absolute;
    width: 120px; height: 120px;
    background: var(--celestial-color);
    border-radius: 50%;
    box-shadow: 0 0 80px var(--celestial-glow), 0 0 30px var(--celestial-glow);
    transition: all 1s ease-in-out;
}
:root[data-theme="light"] .celestial, :root:not([data-theme="dark"]) .celestial {
    top: 10%; right: 15%;
}
[data-theme="dark"] .celestial {
    top: 15%; left: 15%;
    box-shadow: 0 0 50px var(--celestial-glow), inset -15px -10px 0 rgba(0,0,0,0.1);
}

/* Birds (Only visible in light mode) */
.birds {
    position: absolute;
    width: 100%; height: 100%;
    pointer-events: none;
    transition: opacity 1s;
}
[data-theme="dark"] .birds { opacity: 0; }
.bird {
    position: absolute;
    width: 30px; height: 15px;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%232f3640" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M2 12C2 12 6 8 12 12C18 8 22 12 22 12"/></svg>');
    background-size: cover;
    opacity: 0.6;
    animation: fly 20s linear infinite;
}
@keyframes fly {
    0% { transform: translateX(-50px) translateY(100px) scale(0.5); }
    50% { transform: translateX(50vw) translateY(50px) scale(1); }
    100% { transform: translateX(110vw) translateY(0px) scale(0.5); }
}

/* Stars (Only visible in dark mode) */
.stars {
    position: absolute;
    width: 100%; height: 60%;
    background: transparent;
    opacity: 0;
    transition: opacity 1s;
}
[data-theme="dark"] .stars { opacity: 1; }
.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle linear infinite;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Ocean & Waves */
.ocean {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 30%;
    background: var(--primary);
    transition: background 1s;
    overflow: hidden;
}
.wave {
    position: absolute;
    top: -30px;
    width: 200%;
    height: 60px;
    background-repeat: repeat-x;
    background-size: 50% 100%;
}
.wave-1 {
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1440 320" xmlns="http://www.w3.org/2000/svg"><path fill="%23ffffff" fill-opacity="0.3" d="M0,160L48,144C96,128,192,96,288,106.7C384,117,480,171,576,165.3C672,160,768,96,864,85.3C960,75,1056,117,1152,138.7C1248,160,1344,160,1392,160L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    animation: wave-move 15s linear infinite;
}
.wave-2 {
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1440 320" xmlns="http://www.w3.org/2000/svg"><path fill="%23ffffff" fill-opacity="0.2" d="M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,224C672,245,768,267,864,261.3C960,256,1056,224,1152,213.3C1248,203,1344,213,1392,218.7L1440,224L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    animation: wave-move 20s linear infinite reverse;
}
@keyframes wave-move {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Theme Toggle Button in Navbar */
.btn-theme {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #e1b12c; /* Selalu Emas */
    cursor: pointer;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
}
.btn-theme:hover {
    transform: scale(1.2) rotate(15deg);
}
