/* === Global === */
body {
    padding-top: 80px;
    font-family: 'Roboto', sans-serif;
    list-style: none;
    overflow-x: hidden;
}

/* === Navbar === */
.navbar {
    position: fixed;
    top: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    z-index: 999;
    transition: all 0.3s ease;
    margin-top: 50px;
    
    /* จัดกึ่งกลางและกำหนดความกว้าง */
    width: 90%;
    max-width: 1000px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 18px;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.navbar-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* === Logo === */
.logo img {
    height: 40px;
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
}

/* === Hamburger Menu === */
.menu-toggle {
    display: none;
    width: 30px;
    height: 24px;
    position: relative;
    cursor: pointer;
    z-index: 1000;
    background: transparent;
    border: none;
    padding: 0;
}

.menu-toggle .bar {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.menu-toggle .bar:nth-child(1) {
    top: 0;
}

.menu-toggle .bar:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.menu-toggle .bar:nth-child(3) {
    bottom: 0;
}

.menu-toggle.active .bar:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* === Nav Menu === */
.nav-menu {
    display: flex;
    gap: 28px;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-menu-inner {
    display: flex;
    gap: 28px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s ease;
    padding: 8px 12px;
    position: relative;
}

.nav-link:hover {
    color: #04FF00;
}

/* === Dropdown === */
.dropdown {
    position: relative;
}

.dropdown-btn {
    background: none;
    border: none;
    color: white;
    font-family: inherit;
    font-size: inherit;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #111;
    border-radius: 8px;
    padding: 10px 0;
    min-width: 180px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown:hover .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-item {
    position: relative;
}

.dropdown-menu a,
.submenu-btn {
    display: block;
    padding: 10px 20px;
    white-space: nowrap;
    color: white;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.dropdown-menu a:hover,
.submenu-btn:hover {
    background-color: #222;
    color: #04FF00;
}

/* === Sub Dropdown === */
.dropdown-submenu {
    position: absolute;
    top: 0;
    left: 100%;
    background: #111;
    border-radius: 8px;
    padding: 10px 0;
    min-width: 180px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.submenu-icon {
    font-size: 12px;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.dropdown-item:hover>.dropdown-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.dropdown-item:hover .submenu-icon {
    transform: rotate(90deg);
}

/* === Auth Buttons === */
.auth-buttons {
    display: flex;
    gap: 12px;
}

.login-btn {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    transition: all 0.3s ease;
}

.login-btn:hover {
    color: #04FF00;
}

.register-btn {
    background: white;
    color: black;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.register-btn:hover {
    background: #04FF00;
    color: #000;
}

/* === Mobile View === */
@media (max-width: 1024px) {
    .navbar {
        width: 95%;
        margin-top: 20px;
        border-radius: 12px;
    }
}

@media (max-width: 768px) {
    .navbar {
        width: 100%;
        margin-top: 0;
        border-radius: 0;
        padding: 1rem;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 80px 20px 20px;
        gap: 0;
        transition: right 0.4s ease;
        z-index: 998;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu-inner {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0;
    }

    .nav-link {
        width: 100%;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .dropdown {
        width: 100%;
    }

    .dropdown-btn {
        width: 100%;
        justify-content: space-between;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        background: transparent;
        box-shadow: none;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .dropdown.active .dropdown-menu {
        max-height: 1000px;
        padding: 10px 0 10px 15px;
    }

    .dropdown.active .dropdown-icon {
        transform: rotate(180deg);
    }

    .dropdown-submenu {
        position: static;
        width: 100%;
        background: transparent;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .dropdown-item.active .dropdown-submenu {
        max-height: 1000px;
        padding: 10px 0 10px 15px;
    }

    .dropdown-item.active .submenu-icon {
        transform: rotate(90deg);
    }

    .auth-buttons {
        margin-top: 20px;
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .login-btn,
    .register-btn {
        text-align: center;
        padding: 12px;
    }

    .register-btn {
        border-radius: 6px;
    }
}