:root {
    /* 日间模式变量 */
    --primary-color: #2962ff;
    --secondary-color: #0039cb;
    --text-color: #333;
    --bg-color: #ffffff;
    --card-bg: #f5f5f5;
    --nav-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* 夜间模式变量 */
.dark-mode {
    --primary-color: #64b5f6;
    --secondary-color: #1976d2;
    --text-color: #e0e0e0;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --nav-bg: #1a1a1a;
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏样式 */
.navbar {
    background-color: var(--nav-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 24px;
}

.nav-items {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-items a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-items a:hover {
    color: var(--primary-color);
}

/* 导航控制区域样式 */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    z-index: 1001; /* 确保按钮始终可点击 */
}

.login-btn, .register-btn {
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.login-btn {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.register-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    margin-left: 10px;
}

.login-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.register-btn:hover {
    background-color: var(--secondary-color);
}

/* 英雄区域样式 */
.hero {
    padding: 120px 0 60px;
    background: linear-gradient(135deg, var(--bg-color), var(--card-bg));
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.hero-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.hero-content p {
    font-size: 18px;
    margin-bottom: 30px;
}

.cta-button {
    padding: 15px 40px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cta-button:hover {
    background-color: var(--secondary-color);
}

.hero-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px var(--shadow-color);
}

/* 特性区域样式 */
.features {
    padding: 80px 0;
}

.features h2 {
    text-align: center;
    margin-bottom: 50px;
    font-size: 36px;
    color: var(--primary-color);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card i {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

/* 交易区域样式 */
.trading-section {
    padding: 80px 0;
    background-color: var(--card-bg);
}

.trading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.crypto-card {
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.crypto-info {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 50%;
}

.crypto-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.crypto-price {
    width: 50%;
    padding-left: 20px;
}

.crypto-price .price {
    font-size: 1.5rem;
    font-weight: bold;
    transition: color 0.3s ease;
    text-align: left;
}

.change.positive {
    color: #4caf50;
}

.change.negative {
    color: #f44336;
}

.crypto-price .change {
    font-size: 1rem;
    margin-top: 5px;
    text-align: left;
}

/* 关于我们区域样式 */
.about {
    padding: 80px 0;
}

.about h2 {
    text-align: center;
    margin-bottom: 50px;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-text {
    font-size: 18px;
    line-height: 1.6;
}

.about-text ul {
    list-style: none;
    margin-top: 20px;
}

.about-text li {
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
}

.about-text li:before {
    content: "✓";
    color: var(--primary-color);
    position: absolute;
    left: 0;
}

/* 页脚样式 */
footer {
    background-color: var(--card-bg);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.footer-section a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: var(--text-color);
    font-size: 24px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* 移动端菜单按钮样式 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        order: 2;
    }

    .nav-controls {
        gap: 10px;
        /* justify-content: space-between; */
    }

    .theme-toggle {
        order: 1;
    }

    .nav-items {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--nav-bg);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 4px 6px var(--shadow-color);
        z-index: 1000;
    }

    .nav-items.active {
        display: flex;
    }

    .nav-items a {
        padding: 10px 0;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-items a:last-of-type {
        border-bottom: none;
    }
    
    .user-section { 
        width: 100%;
        margin-left: 0;
        /* flex-direction: column; /* Assuming this was original or intended for some context */
        /* gap: 15px; */
    }

    .logged-in, .logged-out { 
        width: 100%;
        justify-content: center;
        /* gap: 15px; */
    }

    .username { 
        text-align: center;
        max-width: 150px; 
        margin: 0 auto; 
    }

    .login-btn, .register-btn, .logout-btn { 
        width: 100%;
        margin: 5px 0;
    }

    .register-btn {
        margin-left: 0;
    }

    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 36px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    position: relative;
    width: 90%;
    max-width: 400px;
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form-group button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.form-group button:hover {
    background-color: var(--secondary-color);
}

.switch-form {
    text-align: center;
    margin-top: 15px;
    color: var(--text-color);
}

.switch-form a {
    color: var(--primary-color);
    text-decoration: none;
}

.switch-form a:hover {
    text-decoration: underline;
}

/* 用户状态显示样式 */
.user-section {    margin-left: 20px;}.username {    color: var(--text-color);    font-weight: 500;    padding: 12px 16px;    display: block;    border-bottom: 1px solid var(--border-color);    text-align: center;    white-space: nowrap;    overflow: hidden;    text-overflow: ellipsis;    max-width: 200px;}.logout-btn {    color: var(--text-color);    text-decoration: none;    display: block;    padding: 12px 16px;    text-align: center;    width: 100%;    background: none;    border: none;    cursor: pointer;    transition: background-color 0.3s;}.logout-btn:hover {    background-color: rgba(0, 0, 0, 0.1);}

/* 响应式调整 */
@media (max-width: 768px) {
    .user-section {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        gap: 15px;
    }

    .logged-in, .logged-out {
        width: 100%;
        justify-content: center;
        gap: 15px;
    }

    .username {
        text-align: center;
        max-width: 150px; /* 移动端显示更多字符 */
        margin: 0 auto;
    }

    .login-btn, .register-btn, .logout-btn {
        width: 100%;
        margin: 5px 0;
    }

    .register-btn {
        margin-left: 0;
    }
}

/* 价格变化动画 */
@keyframes priceUp {
    0% { color: inherit; }
    50% { color: #00c853; }
    100% { color: inherit; }
}

@keyframes priceDown {
    0% { color: inherit; }
    50% { color: #ff3d00; }
    100% { color: inherit; }
}

.price-up {
    animation: priceUp 1s ease-in-out;
}

.price-down {
    animation: priceDown 1s ease-in-out;
}

.crypto-price .change {
    font-size: 1rem;
    margin-top: 5px;
    text-align: left;
}

.crypto-price .change.positive {
    color: #00c853;
}

.crypto-price .change.negative {
    color: #ff3d00;
}

/* 加载状态样式 */
.crypto-price .price:empty::before,
.crypto-price .price:contains("Loading...") {
    content: "Loading...";
    opacity: 0.7;
}

.crypto-price .change:empty::before,
.crypto-price .change:contains("--") {
    content: "--";
    opacity: 0.7;
}

/* 用户下拉菜单样式 */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.3s;
}

.user-dropdown-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px var(--shadow-color);
    z-index: 1002;
    border-radius: 5px;
    overflow: hidden;
}

.dropdown-content .username {
    padding: 12px 16px;
    display: block;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: center;
}

.dropdown-content a:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.user-dropdown:hover .dropdown-content {
    display: block;
}

/* 隐藏直接显示的用户名和登出按钮 */
.logged-in .username,
.logged-in .logout-btn {
    display: none;
}

/* 添加用户图标按钮 */
.user-icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Toast Notification System for index.html */
#toast-container-idx {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-notification-idx {
    padding: 12px 20px;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    opacity: 0; /* Start transparent */
    transition: opacity 0.3s ease-in-out;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    background-color: #333; /* Default background */
}

.toast-notification-idx.success {
    background-color: #28a745;
}

.toast-notification-idx.warning {
    background-color: #ffc107;
    color: #333; /* Darker text for yellow background for better contrast */
}

.toast-notification-idx.danger {
    background-color: #dc3545;
}

.toast-notification-idx.info {
    background-color: #17a2b8;
}

/* Price animation styles (if not already present and styled) */
.price-up {
    animation: priceUpAnimation 0.5s ease-out;
    color: var(--positive-color, #4CAF50); /* Green for price up */
}

.price-down {
    animation: priceDownAnimation 0.5s ease-out;
    color: var(--negative-color, #F44336); /* Red for price down */
}

@keyframes priceUpAnimation {
    0% { transform: translateY(5px); opacity: 0.7; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes priceDownAnimation {
    0% { transform: translateY(-5px); opacity: 0.7; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Dark mode considerations for toasts if needed, assuming light mode is default */
.dark-mode .toast-notification-idx.warning {
    background-color: #ef6c00; /* Darker orange for dark mode */
    color: white; /* White text for dark mode warning */
}
/* ... any other specific dark mode toast overrides ... */


