:root {
    --maroon: #6d0000;
    --gold: #d4af37;
    --light-gold: #f7e6c4;
    --dark-maroon: #4a0000;
    --error-red: #ffc2c2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Poppins", sans-serif;
    background-color: var(--maroon);
    color: var(--light-gold);
    line-height: 1.6;
    overflow-x: hidden;

    /* PERUBAHAN: Logo dihapus dari sini karena akan dipindah ke lapisan ::before */
    background-image: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.5),
            rgba(0, 0, 0, 0.3)
        ),
        url("https://www.transparenttextures.com/patterns/classy-fabric.png");

    background-repeat: no-repeat, repeat;
    background-position: center center, top left;
    background-size: cover, auto;
    position: relative; /* Diperlukan agar z-index pada ::before bekerja dengan baik */
    min-height: 100vh;
    background-attachment: fixed;
}

/* =================================================================== */
/* PERUBAHAN: Menambahkan lapisan baru untuk logo transparan besar     */
/* =================================================================== */
body::before {
    content: "";
    position: fixed; /* Dibuat fixed agar selalu di tengah layar */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* Menggunakan variabel dari HTML untuk logo */
    background-image: var(--logo-bg-url);
    background-repeat: no-repeat;
    background-position: center 40%;

    /* Pengaturan ukuran dan transparansi */
    background-size: 80% auto; /* Ukuran logo: lebar 80% dari layar, tinggi otomatis */
    opacity: 0.1; /* Transparansi logo, bisa diubah (misal: 0.1, 0.2) */

    z-index: -1; /* Meletakkan lapisan ini di belakang semua konten */
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 0.5rem 0;
    position: absolute;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90%;
    margin: 0 auto;
    gap: 1rem;
}

.header-logo {
    height: 50px;
}

section {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    background-color: transparent;
}

#hero {
    height: 100vh;
    align-items: center;
    text-align: center;
    padding: 2rem;
    padding-top: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
#hero h1 {
    font-family: "Playfair Display", serif;
    font-size: 3.2rem;
    color: var(--gold);
    margin-bottom: 1rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    animation: fadeInDown 1s ease-out;
}

#hero p {
    font-size: 1.2rem;
    max-width: 600px;
    color: var(--light-gold);
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease-out 0.5s;
    animation-fill-mode: both;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    animation: fadeInUp 1s ease-out 1s;
    animation-fill-mode: both;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-button {
    background-color: var(--gold);
    color: var(--maroon);
    border: 2px solid var(--gold);
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
}

.hero-button:hover {
    background-color: transparent;
    color: var(--gold);
    transform: translateY(-3px);
}

.hero-button.outline {
    background-color: transparent;
    color: var(--gold);
}

.hero-button.outline:hover {
    background-color: var(--gold);
    color: var(--maroon);
}

.section-title {
    text-align: center;
    font-family: "Playfair Display", serif;
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--gold);
    border-radius: 2px;
}

#candidates-putra,
#candidates-putri,
#results,
#how-to-vote {
    justify-content: flex-start;
    padding-top: 80px;
}

#how-to-vote {
    height: 100vh;
    justify-content: center;
    text-align: center;
    padding-bottom: 5rem;
    display: flex;
    flex-direction: column;
}

#how-to-vote p {
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
}

#candidates-putra,
#candidates-putri {
    background-color: var(--dark-maroon);
    border-top: 2px solid var(--gold);
    padding: 20px; /* Menambahkan padding untuk memberi jarak antara nama kandidat dan tepi kontainer */
    padding-bottom: 40px;
}

#candidates-putra .section-title {
    padding-top: 4rem;
}

.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.candidate-card {
    background: linear-gradient(145deg, #800000, #5c0000);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.candidate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.2);
}

.candidate-card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid var(--gold);
}

.candidate-card-content {
    padding: 1rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.candidate-name {
    font-family: "Playfair Display", serif;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 0.25rem;
}

.candidate-number {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--light-gold);
    margin-bottom: 1rem;
}

.vote-button {
    background-color: var(--gold);
    color: var(--maroon);
    border: none;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: center;
    margin-top: 0.5rem;
}

.vote-button:hover {
    background-color: var(--light-gold);
    transform: scale(1.05);
}

#results {
    padding-top: 60px;
}
#results .container {
    padding-top: 1.5rem;
    overflow: visible;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.chart-container {
    overflow-y: auto;
    padding-bottom: 2rem;
    border-radius: 15px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
}

.chart-container canvas {
    width: 100% !important;
    height: 700px !important;
    min-height: 200px;
    max-height: 250px;
    padding: 15px;
}

.chart-container h3 {
    text-align: center;
    font-family: "Playfair Display", serif;
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
}

footer {
    display: none;
}

.section-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
}

.section-nav-static {
    margin-top: 3rem;
    padding-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
}

.nav-arrow-button {
    font-family: "Poppins", sans-serif;
    color: var(--maroon);
    background-color: var(--gold);
    border: 1px solid var(--gold);
    padding: 8px 20px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-arrow-button:hover {
    transform: translateY(-2px);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--maroon);
    padding: 2.5rem;
    border-radius: 15px;
    border: 2px solid var(--gold);
    text-align: center;
    width: 90%;
    max-width: 450px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-family: "Playfair Display", serif;
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.modal-body {
    color: var(--light-gold);
    margin-bottom: 1.5rem;
}

.vote-code-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.vote-code-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gold);
    font-weight: 600;
}

#voteCodeInput {
    width: 100%;
    padding: 10px;
    background-color: var(--dark-maroon);
    border: 1px solid var(--gold);
    border-radius: 8px;
    color: var(--light-gold);
    font-size: 1rem;
}

#voteCodeInput:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.5);
}

.modal-error {
    color: var(--error-red);
    margin-top: -1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    min-height: 1.2rem;
    text-align: left;
}

.modal-confirm-button {
    background-color: var(--gold);
    color: var(--maroon);
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 1rem;
}

.modal-cancel-button {
    background-color: transparent;
    color: var(--light-gold);
    border: 1px solid var(--light-gold);
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.modal-confirm-button:hover {
    background-color: var(--light-gold);
}

.modal-cancel-button:hover {
    background-color: var(--light-gold);
    color: var(--maroon);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 768px) {
    #hero h1 {
        font-size: 2.2rem;
    }
    .header-logo {
        height: 40px;
    }
    .section-title {
        font-size: 2rem;
    }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    .navbar-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0 1rem;
    }
    .navbar-logos {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        order: 1;
        justify-content: flex-start;
    }
    .navbar-hamburger {
        order: 2;
        margin-left: 0;
        margin-right: 0;
        justify-self: flex-end;
    }
    .navbar-menu {
        order: 3;
        left: 0;
        right: 0;
        top: 100%;
        width: 100%;
    }
    section {
        padding-top: 0.5rem;
    }
    #hero,
    #results {
        text-align: center;
        align-items: center;
        justify-content: center;
    }
    #results {
        padding-top: 70px;
    }
    #results .container {
        padding-top: 0.2rem;
    }
    #results .section-title {
        margin-top: 0.5rem;
    }
}

/* ========== NAVBAR ========== */
.navbar {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}
.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    margin: 0 auto;
    gap: 1rem;
}
.navbar-logos {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.navbar-menu {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.navbar-link {
    color: var(--gold);
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 18px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}
.navbar-link:hover,
.navbar-link.active {
    background: var(--gold);
    color: var(--maroon);
}
/* ========== END NAVBAR ========== */

/* ========== HAMBURGER MENU ========== */
.navbar-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1100;
}
.hamburger-bar {
    width: 28px;
    height: 3px;
    background: var(--gold);
    margin: 4px 0;
    border-radius: 2px;
    transition: 0.3s;
}
@media (max-width: 768px) {
    .navbar-hamburger {
        display: flex;
    }
    .navbar-menu {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        background: rgba(0, 0, 0, 0.95);
        position: absolute;
        top: 100%;
        left: 0;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        padding: 1rem 0;
        animation: fadeInDown 0.3s;
    }
    .navbar-menu.active {
        display: flex;
    }
}
/* ========== END HAMBURGER MENU ========== */

#results .section-title {
    position: relative;
    z-index: 2;
    margin-bottom: 1.5rem;
    background: transparent;
}
#results .chart-container {
    position: relative;
    z-index: 1;
}

#viewAllPutri {
    display: block;
    margin: 4rem auto 0 auto;
    text-align: center;
}

.kandidat-putri {
    margin-bottom: 30px;
    height: auto;
    max-height: 80vh;
    overflow-y: auto;
}

.kandidat-putra {
    background-color: rgba(0, 0, 0, 0.5);
    padding-bottom: 20px;
    padding: 500px; /* Menambahkan padding untuk memberi jarak antara nama kandidat dan tepi kontainer */
}

.fullscreen-overlay {
    position: fixed; /* Membuatnya menempel pada layar */
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100vh; /* 100% dari tinggi viewport/layar */
    background: rgba(26, 12, 12, 0.2); /* Sesuaikan warna dan transparansi */
    z-index: -1; /* PENTING: Mengirimnya ke lapisan paling belakang */
}

.hasil-voting-container {
    background-color: transparent; /* Pastikan latar belakang transparan */
}

.header,
.footer {
    position: relative;
    z-index: 1; /* Mengirim elemen ini ke lapisan lebih tinggi */
}

.chart-container.is-expanded {
    max-height: 900px;
    height: auto;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: visible;
}
.chart-container.is-expanded canvas {
    max-height: 700px;
    height: 700px;
}
