/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

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

ul, ol {
    list-style: none;
}

/* ========== 顶部导航 ========== */
header {
    background: #1a1a2e;
    color: #fff;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    align-items: center;
}

.logo img {
    height: 40px;
    vertical-align: middle;
}

.nav-menu {
    display: flex;
    margin-left: 40px;
}

.nav-item {
    color: #ccc;
    padding: 0 20px;
    font-size: 16px;
    line-height: 60px;
    cursor: pointer;
    transition: color 0.3s, border-bottom 0.3s;
    border-bottom: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    border-bottom-color: #ff6b00;
}

.user-area {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-btn,
.register-btn {
    color: #fff;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 20px;
    transition: background 0.3s, color 0.3s;
}

.login-btn {
    background: rgba(255,107,0,0.2);
    border: 1px solid rgba(255,107,0,0.5);
}

.login-btn:hover {
    background: rgba(255,107,0,0.4);
}

.register-btn {
    background: #ff6b00;
}

.register-btn:hover {
    background: #e05a00;
}

.user-info {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 12px 4px 8px;
    border-radius: 24px;
    background: rgba(255,255,255,0.1);
    transition: background 0.3s;
}

.user-info:hover {
    background: rgba(255,255,255,0.2);
}

.user-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid #ff6b00;
    object-fit: cover;
}

.user-nickname {
    color: #fff;
    font-size: 14px;
}

/* ========== 对话框美化 ========== */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.dialog-box {
    background: #fff;
    border-radius: 16px;
    padding: 35px 40px 30px;
    width: 400px;
    max-width: 92%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: dialogFadeIn 0.3s ease;
    position: relative;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dialog-box h2 {
    text-align: center;
    font-size: 26px;
    font-weight: 600;
    color: #222;
    margin-top: 0;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

.dialog-box h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: #ff6b00;
    margin: 8px auto 0;
    border-radius: 2px;
}

.dialog-body input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    background: #fafafa;
}

.dialog-body input:focus {
    border-color: #ff6b00;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.dialog-body .error-msg {
    color: #e74c3c;
    font-size: 13px;
    margin-top: -8px;
    margin-bottom: 10px;
    text-align: center;
}

.dialog-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.dialog-footer .btn-cancel,
.dialog-footer .btn-confirm {
    padding: 10px 32px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.dialog-footer .btn-cancel {
    background: #f0f0f0;
    color: #555;
}

.dialog-footer .btn-cancel:hover {
    background: #e0e0e0;
}

.dialog-footer .btn-confirm {
    background: #ff6b00;
    color: #fff;
}

.dialog-footer .btn-confirm:hover {
    background: #e05a00;
}

.dialog-footer .btn-confirm:active {
    transform: scale(0.97);
}

.dialog-link {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
}

.dialog-link a {
    color: #ff6b00;
    text-decoration: none;
    font-weight: 500;
}

.dialog-link a:hover {
    text-decoration: underline;
}

/* ========== Toast 提示 ========== */
#globalToast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    z-index: 9999;
    font-size: 18px;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ========== 通用按钮样式 ========== */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s, transform 0.1s;
}

.btn-primary {
    background: #ff6b00;
    color: #fff;
}

.btn-primary:hover {
    background: #e05a00;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #2ecc71;
    color: #fff;
}

.btn-success:hover {
    background: #27ae60;
}

/* ========== 响应式调整 ========== */
@media (max-width: 768px) {
    .nav-menu {
        margin-left: 20px;
    }
    .nav-item {
        padding: 0 12px;
        font-size: 14px;
    }
    .dialog-box {
        padding: 25px 20px 20px;
    }
}