/* public/css/styles.css */
/* Basic styling for Grain Market Intelligence Dashboard */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background-color: #2c5f2d;
    color: white;
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2rem;
    font-weight: 300;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Controls section */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.filter label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
}

.filter select {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    transition: border-color 0.3s ease;
}

.filter select:focus {
    outline: none;
    border-color: #2c5f2d;
}

.filter select:invalid {
    border-color: #e74c3c;
}

/* Chart container */
.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    height: 320px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Placeholder states */
.placeholder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #666;
}

.placeholder-state.error {
    color: #e74c3c;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.placeholder-state h2 {
    margin-bottom: 0.5rem;
    color: #2c5f2d;
}

.placeholder-state p {
    font-size: 1.1rem;
    max-width: 400px;
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2c5f2d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Data table */
.data-table {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.data-table h2 {
    margin-bottom: 1rem;
    color: #2c5f2d;
}

#prices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

#prices-table th,
#prices-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#prices-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

#prices-table tbody tr:hover {
    background-color: #f8f9fa;
}

#prices-table tbody tr {
    cursor: pointer;
}

.error-text {
    color: #e74c3c;
    font-style: italic;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #666;
    border-top: 1px solid #ddd;
    margin-top: 3rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    
    .filter {
        min-width: 100%;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .chart-container {
        height: 250px;
        padding: 1rem;
    }
    
    .data-table {
        padding: 1rem;
    }
    
    #prices-table {
        font-size: 0.9rem;
    }
    
    #prices-table th,
    #prices-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    #prices-table th,
    #prices-table td {
        padding: 0.25rem;
        font-size: 0.8rem;
    }

    /* Time range buttons */
    .time-range-controls {
        display: flex;
        gap: 10px;
        justify-content: center;
    }

    .time-btn {
        padding: 8px 16px;
        border: 1px solid #ddd;
        background: white;
        cursor: pointer;
        border-radius: 4px;
        font-size: 14px;
        transition: all 0.2s;
    }

    .time-btn:hover {
        background: #e9e9e9;
    }

    .time-btn.active {
        background: #4CAF50;
        color: white;
        border-color: #4CAF50;
    }
}