/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* 头部样式 */
header {
    background-color: #2e7d32;
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 600;
}

.class-info {
    font-size: 1.2rem;
    background-color: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
}

/* 导航样式 */
nav {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

nav ul li {
    margin: 0 10px;
}

nav ul li a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 4px;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: #2e7d32;
    color: white;
}

.admin-link {
    margin-left: auto;
    background-color: #1976d2;
    color: white !important;
}

.admin-link:hover {
    background-color: #1565c0 !important;
}

/* 主内容样式 */
main {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

/* 英雄区域 */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #81c784 0%, #43a047 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* 按钮样式 */
.btn-primary {
    display: inline-block;
    background-color: #fff;
    color: #2e7d32;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 30px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-secondary {
    display: inline-block;
    background-color: #e0e0e0;
    color: #333;
    padding: 10px 20px;
    font-size: 1rem;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #d5d5d5;
}

/* 特性卡片 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-card {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.feature-card h3 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

/* 计算器页面样式 */
.calculator-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.calculator-card {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.calculator-card h3 {
    color: #2e7d32;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

/* 结果展示 */
.results-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.results-section h3 {
    color: #2e7d32;
    margin-bottom: 20px;
    font-size: 1.6rem;
}

.result-comparison {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.result-item {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    flex: 1;
    min-width: 200px;
}

.result-item.option1 {
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
}

.result-item.option2 {
    background-color: #ffebee;
    border: 2px solid #f44336;
}

.result-item h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.carbon-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 10px;
}

.carbon-saved {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4caf50;
    text-align: center;
    margin: 20px 0;
}

/* 图表容器 */
.chart-container {
    margin: 30px 0;
    height: 400px;
}

/* 记录页面样式 */
.records-container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.records-table th,
.records-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.records-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #2e7d32;
}

.records-table tr:hover {
    background-color: #f5f5f5;
}

.empty-records {
    text-align: center;
    padding: 40px;
    color: #777;
}

/* 排名页面样式 */
.ranking-container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.rank-item:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.rank-number {
    font-size: 1.5rem;
    font-weight: bold;
    width: 40px;
    text-align: center;
    margin-right: 20px;
}

.rank-top3 .rank-number {
    color: #ff9800;
}

.rank-user {
    flex: 1;
    font-size: 1.1rem;
}

.rank-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2e7d32;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 450px;
    animation: modalFadeIn 0.3s ease-out;
}

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

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.form-note {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* 管理员登录页面样式 */
.login-container {
    max-width: 400px;
    margin: 40px auto;
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
    color: #2e7d32;
    margin-bottom: 30px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background-color: #2e7d32;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background-color: #1b5e20;
}

.login-error {
    color: #f44336;
    text-align: center;
    margin-top: 15px;
}

/* 管理员后台样式 */
.admin-dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    min-height: calc(100vh - 150px);
}

.admin-sidebar {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 80px;
    height: fit-content;
}

.admin-sidebar h3 {
    color: #2e7d32;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar ul li {
    margin-bottom: 10px;
}

.admin-sidebar ul li a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.admin-sidebar ul li a:hover,
.admin-sidebar ul li a.active {
    background-color: #2e7d32;
    color: white;
}

.admin-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-content h2 {
    color: #2e7d32;
    margin-bottom: 30px;
}

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

.stat-card {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #2e7d32;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* 导出按钮 */
.export-btn {
    background-color: #1976d2;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.export-btn:hover {
    background-color: #1565c0;
}

/* 牛肉碳足迹构成分析样式 */
.beef-breakdown-section {
    background-color: #fff9f0;
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
}

.beef-breakdown-section h4 {
    color: #e65100;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.breakdown-intro {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
}

.breakdown-chart {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.breakdown-item {
    margin-bottom: 15px;
}

.breakdown-label {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 5px;
    font-weight: 500;
}

.breakdown-bar-container {
    position: relative;
    width: 100%;
    height: 30px;
    background-color: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff9800, #ff5722);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    transition: width 0.6s ease;
    position: relative;
}

.breakdown-value {
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.breakdown-explanation {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.breakdown-explanation h5 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.breakdown-explanation ul {
    list-style: none;
    padding: 0;
}

.breakdown-explanation ul li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    line-height: 1.6;
}

.breakdown-explanation ul li:last-child {
    border-bottom: none;
}

.breakdown-explanation ul li strong {
    color: #ff5722;
}

.reduction-suggestion {
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 15px;
    margin-top: 15px;
    border-radius: 4px;
    line-height: 1.6;
}

.reduction-suggestion strong {
    color: #2e7d32;
}

/* 计算器按钮样式 */
.calculator-actions {
    text-align: center;
    margin: 30px 0;
}

.primary-button {
    background-color: #2e7d32;
    color: white;
    padding: 15px 40px;
    font-size: 1.1rem;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(46, 125, 50, 0.3);
}

.primary-button:hover {
    background-color: #1b5e20;
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(46, 125, 50, 0.4);
}

.secondary-button {
    background-color: #1976d2;
    color: white;
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-button:hover:not(:disabled) {
    background-color: #1565c0;
}

.secondary-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 标签按钮样式 */
.calculator-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab-button {
    padding: 12px 30px;
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background-color: #e8f5e9;
    border-color: #81c784;
}

.tab-button.active {
    background-color: #2e7d32;
    color: white;
    border-color: #2e7d32;
}

.calculator-section {
    display: none;
}

.calculator-section.active {
    display: block;
}

/* 结果展示样式优化 */
.results-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.comparison-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.result-item {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e0e0e0;
}

.emission-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2e7d32;
    margin: 15px 0;
}

.savings-result {
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.savings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    font-size: 1.1rem;
}

.savings-item .label {
    font-weight: 500;
    color: #555;
}

.savings-item .value {
    font-weight: bold;
    color: #2e7d32;
    font-size: 1.3rem;
}

.reduction-tips {
    margin: 20px 0;
}

.reduction-tips h4 {
    color: #2e7d32;
    margin-bottom: 15px;
}

.reduction-tips ul {
    list-style: none;
    padding: 0;
}

.reduction-tips ul li {
    padding: 10px;
    background-color: #f5f5f5;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 3px solid #2e7d32;
}

.save-record {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: white;
    padding: 30px 0;
    margin-top: 50px;
}

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

footer p {
    margin-bottom: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav ul li {
        margin: 5px 0;
        width: 100%;
    }
    
    .admin-link {
        margin-left: 0;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .admin-dashboard {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        position: static;
    }
}

@media (max-width: 480px) {
    .container {
        width: 95%;
        padding: 0 10px;
    }
    
    .hero {
        padding: 40px 15px;
    }
    
    .hero h2 {
        font-size: 1.6rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .calculator-container {
        grid-template-columns: 1fr;
    }
}