/**
 * charts.html specific styles
 * MQTT Data Charts Page
 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.controls {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.control-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.control-group label {
    font-weight: 600;
    color: #333;
}

.control-group select,
.control-group input,
.control-group button {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #667eea;
}

.control-group button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.control-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.chart-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.chart-info {
    font-size: 0.9em;
    color: #666;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: #667eea;
}

.stats {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-box {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    border-radius: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

/* Date Preset Buttons */
.preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.preset-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.preset-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
}

/* Chart Download Button */
.download-btn {
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}


@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 0 10px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }

    .subtitle {
        font-size: 0.95em;
        margin-bottom: 20px;
    }

    /* Back button full width on mobile */
    .container > a {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 15px 20px !important;
        min-height: 48px;
        box-sizing: border-box;
    }

    /* Controls section mobile layout */
    .controls {
        padding: 15px;
    }

    .control-group {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .control-group label {
        font-weight: 600;
        margin-top: 10px;
    }

    .control-group select,
    .control-group input,
    .control-group button {
        width: 100%;
        min-height: 44px;
        padding: 12px 15px;
        font-size: 16px;
    }

    .control-group button {
        min-height: 48px;
        font-weight: 600;
    }

    /* Chart grid single column */
    .chart-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .chart-container {
        padding: 15px;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .chart-title {
        font-size: 1em;
    }

    .chart-info {
        font-size: 0.85em;
    }

    /* Stats grid responsive */
    .stats {
        padding: 15px;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-box {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.5em;
    }

    .stat-label {
        font-size: 0.9em;
    }
}
