/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    will-change: transform;
}

/* Header Styles */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    will-change: transform;
    backface-visibility: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    min-height: 70px;
}

.logo h1 a {
    text-decoration: none;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: bold;
    display: inline-block;
    transition: transform 0.3s ease;
}

.logo h1 a:hover {
    transform: translateY(-2px);
}

.logo p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-list a {
    text-decoration: none;
    color: #34495e;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-list a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #3498db;
    transition: width 0.3s ease;
}

.nav-list a:hover {
    color: #3498db;
}

.nav-list a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></svg>');
    background-size: 30px 30px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% { transform: translateY(0); }
    100% { transform: translateY(-30px); }
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    text-align: left;
    position: relative;
    z-index: 1;
}

.hero-text h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 300;
    line-height: 1.2;
}

.hero-text p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.search-box {
    display: flex;
    gap: 1rem;
    max-width: 500px;
}

.search-box input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.search-box button {
    padding: 1rem 2rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.search-box button:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.search-box button:active {
    transform: translateY(0);
}

/* Live Price Ticker */
.hero-stats {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid rgba(255,255,255,0.2);
}

.live-price-ticker h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    opacity: 0.95;
}

.ticker-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.ticker-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.ticker-item .name {
    font-weight: 500;
}

.ticker-item .price {
    font-weight: bold;
    font-size: 1.1rem;
}

.ticker-item .change {
    font-size: 0.9rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.ticker-item .change.up {
    background: rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.ticker-item .change.down {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #7f8c8d;
    font-size: 1rem;
}

/* Featured Materials Section */
.featured-materials {
    padding: 4rem 0;
    background: white;
}

.material-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.material-card {
    background: #f8f9fa;
    padding: 1.8rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.material-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #e74c3c);
    transition: left 0.5s ease;
}

.material-card:hover::before {
    left: 0;
}

.material-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
    border-color: #3498db;
}

.material-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.material-card h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.3rem;
}

.material-card .trend-arrow {
    font-size: 1.2rem;
    padding: 0.3rem 0.6rem;
    border-radius: 50%;
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.material-card .trend-arrow.down {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.material-card .price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

.material-card .change {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.material-card .change.positive {
    color: #27ae60;
}

.material-card .change.negative {
    color: #e74c3c;
}

.material-card .card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Materials Section */
.materials-section {
    padding: 4rem 0;
}

.materials-section:nth-child(even) {
    background: white;
}

.materials-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: #2c3e50;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.material-category {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 2px solid #f8f9fa;
}

.material-category:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    border-color: #3498db;
}

.material-category h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.material-category h3::before {
    content: '📊';
}

.material-list {
    list-style: none;
}

.material-list li {
    margin-bottom: 0.8rem;
}

.material-list a {
    text-decoration: none;
    color: #34495e;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.material-list a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #3498db;
    transition: height 0.3s ease;
    border-radius: 2px;
}

.material-list a:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #3498db;
    padding-left: 1.2rem;
}

.material-list a:hover::before {
    height: 70%;
}

.material-list .price-tag {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Analysis Section */
.analysis-section {
    padding: 4rem 0;
    background: white;
}

.analysis-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: #2c3e50;
}

.analysis-content {
    max-width: 1000px;
    margin: 0 auto;
}

.chart-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.time-range-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.time-btn {
    padding: 0.8rem 1.5rem;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.time-btn:hover,
.time-btn.active {
    background: #3498db;
    color: white;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.stat-card h4 {
    color: #7f8c8d;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card .trend {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.stat-card .trend.up {
    color: #27ae60;
}

.stat-card .trend.down {
    color: #e74c3c;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s ease;
}

.close:hover {
    color: #e74c3c;
}

.modal h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

/* Footer Styles */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-section h3 {
    color: #3498db;
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    position: relative;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 50px;
    height: 3px;
    background: #3498db;
    border-radius: 2px;
}

.footer-section p {
    line-height: 1.8;
    opacity: 0.9;
}

.update-time {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(52, 152, 219, 0.2);
    border-radius: 5px;
    font-size: 0.9rem;
    border-left: 3px solid #3498db;
}

.footer-section a {
    color: #3498db;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-section a:hover {
    opacity: 0.8;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 3000;
    transform: translateX(120%);
    transition: transform 0.4s ease;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    color: #2c3e50;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.3s ease;
}

.toast-close:hover {
    color: #e74c3c;
}

.price-alert {
    border-left: 4px solid #27ae60;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }