﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #2c3e50, #34495e, #3d566e);
    min-height: 100vh;
    color: #ecf0f1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 5px;
}

header {
    text-align: center;
    background: linear-gradient(45deg, #4a6741, #5d7c4f, #708963);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

    header h1 {
        font-size: 2.2em;
        margin-bottom: 10px;
        font-weight: 700;
    }

.content {
    background: linear-gradient(145deg, #34495e, #2c3e50);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    margin-bottom: 20px;
}

/* ส่วนเลือกวันที่และภาค */
.date-section, .region-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #3d566e, #34495e);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
}

    .date-section h2, .region-section h2 {
        color: #74b9ff;
        margin-bottom: 15px;
        font-size: 1.4em;
        font-weight: 600;
    }

/* Input fields - แก้สีให้อ่านชัด */
input[type="date"], select {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 2px solid #74b9ff;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 10px;
    background: #2c3e50;
    color: #ffffff;
    font-weight: 600;
}

    input[type="date"]:focus, select:focus {
        outline: none;
        border-color: #0984e3;
        box-shadow: 0 0 8px rgba(116,185,255,0.3);
    }

    /* Date picker styling */
    input[type="date"]::-webkit-calendar-picker-indicator {
        filter: invert(1) brightness(1.2);
        cursor: pointer;
    }

/* Select dropdown */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

    select option {
        background: #2c3e50;
        color: #ffffff;
        padding: 8px;
    }

/* ปุ่มต่างๆ */
#locationBtn {
    background: linear-gradient(45deg, #0984e3, #74b9ff);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

    #locationBtn:hover {
        background: linear-gradient(45deg, #0767b8, #5a9bd4);
        transform: translateY(-1px);
    }

/* ข้อมูลปัจจุบัน */
#currentInfo {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
}

#locationInfo {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 8px;
    color: #ffffff;
}

/* กราฟส่วน */
.weekly-chart-section {
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(145deg, #34495e, #2c3e50);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

    .weekly-chart-section h2 {
        color: #74b9ff;
        margin-bottom: 25px;
        text-align: center;
        font-size: 1.6em;
        font-weight: 700;
    }

.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 25px;
    background: linear-gradient(145deg, #2c3e50, #34495e);
    border-radius: 10px;
    padding: 15px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #3d566e, #34495e);
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #ecf0f1;
}

.legend-color {
    width: 24px;
    height: 5px;
    border-radius: 3px;
}

/* ปุ่มวันที่ */
.day-navigation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 15px;
    background: linear-gradient(135deg, #3d566e, #34495e);
    border-radius: 8px;
}

.day-btn {
    padding: 10px 15px;
    border: 2px solid #74b9ff;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #74b9ff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: 600;
}

    .day-btn:hover, .day-btn.active {
        background: linear-gradient(45deg, #0984e3, #74b9ff);
        color: #ffffff;
        transform: translateY(-1px);
        border-color: #0984e3;
    }

/* ส่วนแสดงผลวิเคราะห์ */
.selected-day-detail {
    background: linear-gradient(145deg, #34495e, #2c3e50);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.crop-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.crop-type-section {
    background: linear-gradient(145deg, #3d566e, #34495e);
    border-radius: 10px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,0.1);
}

    .crop-type-section h4 {
        color: #74b9ff;
        margin-bottom: 15px;
        font-size: 1.2em;
        border-bottom: 2px solid #74b9ff;
        padding-bottom: 8px;
        font-weight: 600;
    }

.crop-recommendation .recommendation {
    margin-bottom: 12px;
    text-align: center;
    font-weight: 700;
    padding: 10px;
    border-radius: 8px;
    color: #ffffff;
}

/* แก้สีที่อ่านไม่ออก */
.top-crops {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 3px solid #74b9ff;
    color: #ffffff;
    font-weight: 500;
}

    .top-crops strong {
        color: #74b9ff;
        font-weight: 700;
    }

.crop-details {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 8px;
    overflow: hidden;
}

    .crop-details summary {
        background: linear-gradient(135deg, #0984e3, #74b9ff);
        padding: 10px 15px;
        cursor: pointer;
        font-weight: 700;
        color: #ffffff;
        transition: all 0.3s ease;
    }

        .crop-details summary:hover {
            background: linear-gradient(135deg, #0767b8, #5a9bd4);
        }

.all-crops {
    padding: 15px;
    font-size: 13px;
    line-height: 1.6;
    color: #ffffff;
    max-height: 200px;
    overflow-y: auto;
    font-weight: 500;
}

/* คะแนนสี */
.excellent {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.good {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.fair {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.poor {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

/* URL Display */
.url-display {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
    color: #74b9ff;
}

/* Footer */
footer {
    background: linear-gradient(145deg, #2c3e50, #34495e);
    color: #ecf0f1;
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    border: 1px solid rgba(255,255,255,0.1);
}

.philosophy h3 {
    margin-bottom: 18px;
    color: #74b9ff;
    font-weight: 700;
}

.philosophy p {
    margin-bottom: 15px;
    line-height: 1.7;
    color: #bdc3c7;
}

.accuracy-info, .calculation-method {
    background: linear-gradient(135deg, #3d566e, #34495e);
    padding: 18px;
    border-radius: 8px;
    margin: 18px 0;
    border: 1px solid rgba(255,255,255,0.1);
}

    .accuracy-info h4, .calculation-method h4 {
        color: #74b9ff;
        margin-bottom: 12px;
    }

    .accuracy-info ul {
        list-style-type: none;
        padding-left: 0;
    }

    .accuracy-info li {
        margin: 10px 0;
        padding: 8px 0;
        color: #bdc3c7;
    }

details summary {
    font-weight: 700;
    color: #74b9ff;
    margin-bottom: 8px;
    outline: none;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

    details summary:hover {
        background: linear-gradient(135deg, #0984e3, #74b9ff);
        color: #ffffff;
    }

.method-detail, .philosophy-detail {
    background: linear-gradient(135deg, #3d566e, #34495e);
    padding: 15px;
    border-radius: 8px;
    margin: 12px 0;
    border-left: 3px solid #74b9ff;
    border: 1px solid rgba(255,255,255,0.05);
}

    .method-detail h5, .philosophy-detail h4 {
        color: #74b9ff;
        margin-bottom: 10px;
        font-size: 1.1em;
    }

    .method-detail p, .philosophy-detail p {
        margin: 6px 0;
        line-height: 1.5;
        color: #bdc3c7;
    }

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 5px;
    }

    header {
        padding: 20px;
    }

        header h1 {
            font-size: 1.8em;
        }

    .content {
        padding: 20px;
    }

    input[type="date"], select {
        max-width: 100%;
    }

    .chart-container {
        height: 300px;
        padding: 5px;
    }

    .chart-legend {
        gap: 12px;
        padding: 12px;
    }

    .legend-item {
        font-size: 12px;
    }

    .legend-color {
        width: 18px;
        height: 4px;
    }

    .day-navigation {
        gap: 8px;
        padding: 12px;
    }

    .day-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .weekly-chart-section {
        padding: 18px;
    }

        .weekly-chart-section h2 {
            font-size: 1.4em;
        }

    .crop-analysis-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .crop-type-section {
        padding: 15px;
    }

    .top-crops {
        font-size: 13px;
        padding: 10px;
    }

    .all-crops {
        font-size: 12px;
        padding: 12px;
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .chart-container {
        height: 250px;
    }

    .day-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}
