:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --background-color: #ecf0f1;
    --card-background: #ffffff;
    --text-color: #2c3e50;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 導航列 */
header {
    background: var(--primary-color);
    color: white;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

main {
    margin-top: 80px;
}

/* 主視覺區 */
.hero-section {
    background: var(--gradient-bg);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hero-section p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.stat-card p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.8;
}

/* 參數輸入區 */
.input-section {
    padding: 4rem 0;
    background: white;
}

.input-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.parameter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.parameter-group {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid #e0e0e0;
}

.parameter-group h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.3rem;
    text-align: center;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.input-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
    appearance: none;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    outline: none;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
}

.input-group .value {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* 預測分析區 */
.prediction-section {
    padding: 4rem 0;
    background: var(--background-color);
}

.prediction-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.prediction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.prediction-card, .recommendation-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.prediction-card h3, .recommendation-card h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.yield-display {
    text-align: center;
    margin-bottom: 2rem;
}

.yield-meter {
    width: 150px;
    height: 150px;
    border: 8px solid #e0e0e0;
    border-radius: 50%;
    margin: 0 auto 1rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yield-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--success-color) 0deg, var(--success-color) 348deg, transparent 348deg);
    transform: rotate(-90deg);
}

.yield-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    z-index: 1;
}

.confidence-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.confidence-meter {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--secondary-color);
    width: 87%;
    transition: width 0.3s;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--secondary-color);
}

.recommendation-item i {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.trend-chart {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.trend-chart h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

#trendChart {
    max-width: 100%;
    height: auto;
}

/* 即時監控區 */
.monitor-section {
    padding: 4rem 0;
    background: white;
}

.monitor-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

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

.monitor-card {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--success-color);
    transition: transform 0.3s;
}

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

.monitor-card.warning {
    border-left-color: var(--warning-color);
}

.monitor-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.status-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--success-color);
    margin: 0 auto 1rem;
    animation: pulse 2s infinite;
}

.monitor-card.warning .status-indicator {
    background: var(--warning-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.yield-value {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--success-color);
}

.monitor-card.warning .yield-value {
    color: var(--warning-color);
}

.status-text {
    font-weight: bold;
}

/* 頁尾 */
footer {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links a:hover {
    color: var(--secondary-color);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .hero-section h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .parameter-grid {
        grid-template-columns: 1fr;
    }
    
    .prediction-grid {
        grid-template-columns: 1fr;
    }
    
    .monitor-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card h3 {
        font-size: 2rem;
    }
    
    .hero-section h1 {
        font-size: 1.5rem;
    }
}