/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #000000 0%, #FF0000 100%);
    color: #fff;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: #FFD700;
}

p, li, a {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    color: #f0f0f0;
}

/* =============================================
   STICKY NAVBAR — FULLY ALIGNED ON ALL DEVICES
============================================= */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.75rem, 4vw, 1.25rem) clamp(2%, 5vw, 5%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 40px rgba(255, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar:hover {
    background: rgba(0, 0, 0, 0.95);
    box-shadow: 0 12px 50px rgba(255, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.logo-container {
    display: flex;
    align-items: center;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

.logo {
    font-size: clamp(1.5rem, 6vw, 2rem);
    font-weight: 800;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    white-space: nowrap;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
}

.logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: left 0.7s ease;
}

.logo:hover::before {
    left: 100%;
}

.logo:hover {
    transform: translateY(-2px);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    background: rgba(255, 215, 0, 0.1);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hamburger {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.hamburger::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.hamburger:hover::before {
    left: 100%;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
    transform-origin: center;
}

.hamburger:hover span {
    background: #FFD700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.navbar.active .hamburger .line1 {
    transform: rotate(45deg) translate(5px, 5px);
    background: #FFD700;
}

.navbar.active .hamburger .line2 {
    opacity: 0;
    transform: translateX(-10px);
}

.navbar.active .hamburger .line3 {
    transform: rotate(-45deg) translate(7px, -7px);
    background: #FFD700;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: clamp(0.5rem, 2vw, 2rem);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s ease;
    z-index: -1;
}

.nav-links a:hover::before {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #FFD700, transparent);
    transition: all 0.4s ease;
    border-radius: 2px;
}

.nav-links a:hover::after {
    width: 80%;
}

.nav-links a:hover {
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.2);
}

/* Active state animation */
.nav-links a:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

/* =============================================
   MOBILE MODE: PHONES (< 768px)
============================================= */

@media (max-width: 767px) {
    .navbar {
        position: relative;
    }
    
    .hamburger {
        display: flex;
        position: absolute;
        right: clamp(2%, 5vw, 5%);
        top: 50%;
        transform: translateY(-50%);
    }
    
    .nav-links {
        position: fixed;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.98);
        padding: 2.5rem 1rem;
        gap: 2rem;
        opacity: 0;
        transform: translateY(-20px);
        transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
        z-index: 999;
        text-align: center;
        visibility: hidden;
        height: 0;
        overflow: hidden;
        backdrop-filter: blur(15px);
        border-top: 1px solid rgba(255, 215, 0, 0.2);
    }

    .navbar.active .nav-links {
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
        height: auto;
        overflow: visible;
    }

    .nav-links a {
        padding: 1rem 2rem;
        font-size: 1.2rem;
        width: 80%;
        margin: 0 auto;
        text-align: center;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.05);
        transition: all 0.4s ease;
    }

    .nav-links a:hover {
        background: rgba(255, 215, 0, 0.15);
        transform: translateX(10px);
    }

    /* Dim content behind menu */
    .navbar.active ~ .hero {
        opacity: 0.4;
        pointer-events: none;
        transition: opacity 0.4s ease;
    }
}

/* =============================================
   TABLET & DESKTOP MODE: ≥ 768px
============================================= */

@media (min-width: 768px) {
    .hamburger {
        display: none !important;
    }

    .nav-links {
        display: flex !important;
    }
    
    /* Staggered animation for nav items */
    .nav-links li {
        opacity: 0;
        transform: translateY(-10px);
        animation: fadeInDown 0.5s ease forwards;
    }
    
    .nav-links li:nth-child(1) { animation-delay: 0.1s; }
    .nav-links li:nth-child(2) { animation-delay: 0.2s; }
    .nav-links li:nth-child(3) { animation-delay: 0.3s; }
    .nav-links li:nth-child(4) { animation-delay: 0.4s; }
    
    @keyframes fadeInDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Additional smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.nav-links a:focus {
    outline: 2px solid #FFD700;
    outline-offset: 4px;
}

.hamburger:focus {
    outline: 2px solid #FFD700;
    outline-offset: 4px;
}


/* Hero Section */
.hero {
    text-align: center;
    padding: 8rem 5% 4rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(255,0,0,0.3) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.hero p {
    font-size: 1.5rem;
    max-width: 700px;
    margin: 0 auto 3rem;
    color: #eee;
}

/* Attendance Form */

.attendance-form {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(15px);
    padding: clamp(1.5rem, 8vw, 3rem);
    border-radius: 20px;
    max-width: 900px;
    margin: clamp(3rem, 12vw, 7rem) auto;
    border: 2px solid #FFD700;
    box-shadow: 0 12px 50px rgba(255, 215, 0, 0.25);
    animation: slideUp 0.8s ease-out;
    overflow: hidden;
}

.attendance-form h2 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    margin-bottom: clamp(1rem, 5vw, 2rem);
    text-align: center;
    color: #FFD700;
    word-wrap: break-word;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: clamp(1rem, 4vw, 1.75rem);
    position: relative;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: clamp(0.8rem, 4vw, 1.2rem);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 14px;
    color: #fff;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Montserrat', sans-serif;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    transform: translateY(-1px);
    outline: none;
}

.form-group label {
    position: absolute;
    top: clamp(1rem, 4vw, 1.2rem);
    left: clamp(1rem, 4vw, 1.2rem);
    font-size: clamp(0.8rem, 3vw, 0.9rem);
    color: rgba(255, 215, 0, 0.7);
    pointer-events: none;
    transition: all 0.3s ease;
    background: transparent;
}

.form-group input:focus ~ label,
.form-group textarea:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label,
.form-group textarea:not(:placeholder-shown) ~ label {
    top: clamp(-0.5rem, -2vw, -0.3rem);
    left: clamp(1rem, 4vw, 1.2rem);
    font-size: clamp(0.6rem, 2.5vw, 0.75rem);
    background: rgba(0, 0, 0, 0.7);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    color: #FFD700;
    transform: scale(0.95);
}

.photo-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: clamp(1rem, 5vw, 2rem);
    text-align: center;
}

.photo-preview {
    width: clamp(80px, 25vw, 140px);
    height: clamp(80px, 25vw, 140px);
    border-radius: 50%;
    object-fit: cover;
    border: 3px dashed #FFD700;
    margin: clamp(1rem, 4vw, 1.5rem) 0;
    opacity: 0.6;
    transition: all 0.4s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.photo-preview.show {
    opacity: 1;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
}

.upload-btn {
    background: transparent;
    border: 2px solid #FFD700;
    color: #FFD700;
    padding: clamp(0.7rem, 3.5vw, 1rem) clamp(1.5rem, 8vw, 2.2rem);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
    min-width: 180px;
}

.upload-btn:hover {
    background: #FFD700;
    color: #000;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.6);
    border-color: #fff;
}

.submit-btn {
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    color: white;
    border: none;
    padding: clamp(0.7rem, 3vw, 1rem) clamp(2rem, 8vw, 2.8rem); /* ← DIPERKECIL */
    border-radius: 50px;
    font-size: clamp(1rem, 3.5vw, 1.2rem); /* ← FONT LEBIH KECIL */
    font-weight: 700;
    cursor: pointer;
    margin-top: clamp(1.5rem, 6vw, 2rem);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(255, 0, 0, 0.4);
    width: 100%;
    max-width: 320px; /* ← BATASAN MAX WIDTH AGAR TIDAK TERLALU LEBAR */
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Montserrat', sans-serif;
    margin-left: auto;
    margin-right: auto;
}

.submit-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(255, 0, 0, 0.6);
    animation: glow 1.5s infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 8px 20px rgba(255, 0, 0, 0.4); }
    to { box-shadow: 0 15px 35px rgba(255, 0, 0, 0.7); }
}

/* Ensure no overflow on small screens */
body {
    overflow-x: hidden;
}

/* Make sure forms are not cut off on portrait phones */
@media (max-width: 480px) {
    .attendance-form {
        margin: clamp(2rem, 10vw, 6rem) auto;
        padding: clamp(1.2rem, 6vw, 2.5rem);
    }

    .form-group input,
    .form-group textarea {
        padding: clamp(0.7rem, 4vw, 1.1rem);
        font-size: clamp(0.85rem, 3.5vw, 1rem);
    }

    .upload-btn,
    .submit-btn {
        padding: clamp(0.7rem, 3.5vw, 1rem) clamp(1.2rem, 7vw, 2rem);
        font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    }

    .photo-preview {
        width: clamp(70px, 30vw, 120px);
        height: clamp(70px, 30vw, 120px);
    }
}

/* Leaderboard */
.leaderboard-section {
    padding: 5rem 5%;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 100%);
}

.leaderboard-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: clamp(2rem, 5vw, 3rem);
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 3rem;
    margin-top: 2rem;
    width: 100%;
    max-width: 2000px;
    margin-left: auto;
    margin-right: auto;
}

.guest-card {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 28px;
    padding: 2.5rem;
    display: flex;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
    animation: fadeInUp 0.8s ease-out;
    box-shadow: 0 15px 50px rgba(255, 0, 0, 0.2);
    min-height: 200px;
    overflow: hidden;
    position: relative;
    flex-direction: row;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.guest-card:hover {
    transform: translateY(-10px) scale(1.04);
    border-color: #FF0000;
    box-shadow: 0 20px 70px rgba(255, 0, 0, 0.6);
    background: rgba(10, 10, 10, 0.9);
}

.guest-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #FFD700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    flex-shrink: 0;
    margin-right: 2.5rem;
}

.guest-details {
    flex: 1;
    min-width: 0;
}

.guest-details h3 {
    color: #FFD700;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 0.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.guest-details p {
    margin: 0.5rem 0;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: #ccc;
    line-height: 1.5;
}

.guest-details .phone {
    color: #FF0000;
    font-weight: 600;
    font-size: 1rem;
}

.guest-details .purpose {
    font-style: italic;
    color: #aaa;
    margin-top: 0.7rem;
    font-size: 0.95rem;
}

.guest-details .timestamp {
    font-size: 0.8rem;
    color: #777;
    margin-top: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    padding: 1rem 2rem;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
    font-weight: 600;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(150%);
    transition: transform 0.5s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast .icon {
    font-size: 1.5rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    .leaderboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    }
    
    .guest-card {
        padding: 2.8rem;
        min-height: 220px;
    }
    
    .guest-photo {
        width: 150px;
        height: 150px;
    }
    
    .guest-details h3 {
        font-size: 1.6rem;
    }
}

@media (min-width: 1024px) {
    .leaderboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
    }
    
    .guest-card {
        padding: 3rem;
        min-height: 250px;
    }
    
    .guest-photo {
        width: 160px;
        height: 160px;
    }
    
    .guest-details h3 {
        font-size: 1.7rem;
    }
}

@media (min-width: 1440px) {
    .leaderboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(700px, 1fr));
    }
    
    .guest-card {
        padding: 3.5rem;
        min-height: 260px;
    }
    
    .guest-photo {
        width: 180px;
        height: 180px;
    }
    
    .guest-details h3 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    .guest-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
        gap: 1.5rem;
    }

    .guest-photo {
        margin-right: 0;
        margin-bottom: 1.5rem;
    }

    .guest-details {
        text-align: center;
    }

    .guest-details h3 {
        font-size: 1.4rem;
    }

    .guest-details p {
        font-size: 0.95rem;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 5%;
    background: rgba(0, 0, 0, 0.9);
    font-size: 0.9rem;
    color: #aaa;
}

footer a {
    color: #FFD700;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Admin Panel Styles (hidden until logged in) */
.admin-panel {
    display: none;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    animation: modalSlideIn 0.5s ease-out;
    border: 1px solid #FFD700;
    box-shadow: 0 20px 50px rgba(255, 215, 0, 0.3);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: #FFD700;
}

.close-modal {
    background: transparent;
    border: none;
    color: #FFD700;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #FF0000;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .attendance-form {
        padding: 2rem;
    }

    .leaderboard-grid {
        grid-template-columns: 1fr;
    }

    .guest-card {
        flex-direction: column;
        text-align: center;
    }

    .guest-photo {
        margin: 0 auto 1rem;
    }
}