/* General Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Button Base Styles */
.btn {
    display: inline-block;
    padding: 0.7rem 1.2rem;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    white-space: nowrap;
    text-decoration: none; /* 确保按钮没有下划线 */
}

.btn-register {
    background-color: #FFCC00; /* Secondary color */
    color: #003366; /* Primary color */
    border: 1px solid #FFCC00;
}

.btn-register:hover {
    background-color: #e6b800;
    color: #001a33;
    border-color: #e6b800;
}

.btn-login {
    background-color: transparent;
    color: #FFCC00;
    border: 1px solid #FFCC00;
}

.btn-login:hover {
    background-color: #FFCC00;
    color: #003366;
}

/* Header Styles */
.site-header {
    background-color: #003366; /* Primary color */
    color: #fff;
    padding: 1rem 2rem;
    display: flex; /* 桌面端默认flex布局 */
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .logo {
    font-family: 'Georgia', serif; /* Creative font for brand */
    font-size: 2.2rem;
    font-weight: bold;
    color: #FFCC00; /* Secondary color for logo */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.site-header .logo:hover {
    color: #fff;
}

/* 桌面端：logo, main-nav, auth-buttons 并排 */
.site-header .header-top-mobile-row {
    display: contents; /* 在桌面端，这个容器不产生新的flex或grid上下文，其子元素直接成为site-header的flex项 */
}

.main-nav {
    flex-grow: 1; /* 占据可用空间，将auth-buttons和hamburger推到右侧 */
    display: flex;
    justify-content: center; /* 导航链接居中 */
}

.main-nav ul {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 3px;
    background-color: #FFCC00; /* Secondary color */
    transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.main-nav a:hover,
.main-nav a.active {
    color: #FFCC00; /* Secondary color */
}

.auth-buttons {
    display: flex; /* 桌面端显示按钮 */
    gap: 0.8rem;
    margin-left: 1.5rem; /* 与导航的间距 */
}

.hamburger-menu {
    display: none; /* 桌面端隐藏 */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger-menu .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
}

/* Footer Styles */
.site-footer {
    background-color: #003366; /* Primary color */
    color: #e0e0e0;
    padding: 3rem 2rem;
    font-size: 0.9rem;
}

.site-footer a {
    color: #FFCC00; /* Secondary color for links */
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: #fff;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.footer-column {
    flex: 1;
    min-width: 200px;
}

.footer-column h3 {
    color: #FFCC00; /* Secondary color */
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-column p {
    margin-bottom: 0.5rem;
}

.footer-nav ul li {
    margin-bottom: 0.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 2rem;
    color: #ccc;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .site-header {
        display: grid; /* 手机端使用grid布局 */
        grid-template-columns: 1fr auto 1fr; /* 左侧空白，logo居中，右侧hamburger */
        grid-template-rows: auto auto auto; /* logo/hamburger行，auth-buttons行，nav行 */
        gap: 0.5rem; /* 行间距 */
        padding: 1rem; /* 手机端头部内边距 */
    }

    .site-header .header-top-mobile-row {
        grid-column: 1 / -1; /* 占据所有列 */
        grid-row: 1; /* 第一行 */
        display: grid; /* 使其内部logo和hamburger形成grid布局 */
        grid-template-columns: 1fr auto 1fr; /* 左侧空白，logo居中，右侧hamburger */
        align-items: center;
        width: 100%; /* 确保占据父容器宽度 */
    }

    .site-header .logo {
        grid-column: 2; /* 在header-top-mobile-row中居中 */
        justify-self: center;
        margin: 0; /* 移除可能的自动外边距 */
    }

    .site-header .hamburger-menu {
        display: block; /* 手机端显示 */
        grid-column: 3; /* 在header-top-mobile-row中靠右 */
        justify-self: end;
        margin-left: auto; /* 确保推到最右边 */
        z-index: 1001; /* 确保在菜单之上 */
    }

    .site-header .auth-buttons {
        display: flex; /* 手机端显示按钮 */
        justify-content: center; /* 按钮居中 */
        gap: 0.8rem;
        grid-column: 1 / -1; /* 占据所有列 */
        grid-row: 2; /* 第二行，在logo/hamburger下方 */
        padding: 0.5rem 0;
    }

    .main-nav {
        grid-column: 1 / -1; /* 占据所有列 */
        grid-row: 3; /* 第三行 */
        position: absolute;
        /* top: 100%; 原始值，现在需要根据grid布局调整 */
        /* 重新计算top，让它位于header-top-mobile-row和auth-buttons下方 */
        /* 考虑到padding和gap，这里使用一个相对较大的值，或者通过JS动态计算更准确 */
        /* 暂时保留top: 100%，它会相对于site-header的实际高度。 */
        /* 如果需要精确控制，可以计算第一行和第二行的高度。 */
        left: 0;
        width: 100%;
        background-color: #003366;
        flex-direction: column;
        align-items: center;
        transform: translateY(-100%);
        transition: transform 0.3s ease-in-out;
        opacity: 0;
        pointer-events: none;
        box-shadow: 0 5px 10px rgba(0,0,0,0.2);
        z-index: 990; /* 确保低于hamburger-menu */
    }

    .main-nav.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .main-nav ul {
        flex-direction: column;
        padding: 1rem 0;
        width: 100%;
        text-align: center;
    }

    .main-nav ul li {
        margin: 0.5rem 0;
    }

    .main-nav a {
        padding: 0.75rem 1rem;
        display: block;
        width: 100%;
    }

    .hamburger-menu.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

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

    .hamburger-menu.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-column {
        min-width: unset;
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .footer-column h3 {
        margin-bottom: 0.8rem;
    }

    .footer-nav ul li {
        margin-bottom: 0.3rem;
    }
}