/**
 * =============================================================================
 * ESTILOS PERSONALIZADOS - Sistema de Controle de Temperatura
 * =============================================================================
 * FUNÇÃO: Define estilos CSS personalizados para o projeto
 * USO: Importado automaticamente nas páginas HTML (dashboard.html e history.html)
 * MOMENTO: Carregado automaticamente pelo navegador ao acessar as páginas
 *
 * SEÇÕES:
 *   - Estilos Gerais (body, tipografia)
 *   - Header e navegação
 *   - Cards de temperatura (dashboard)
 *   - Gráficos
 *   - Formulário de histórico
 *   - Tabela de histórico
 *   - Responsividade (mobile e tablet)
 *
 * FRAMEWORK BASE: Bootstrap 5 (carregado no HTML)
 * =============================================================================
 */

/* Estilo Geral */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: #333;
}

/* Header */
header {
    background: linear-gradient(to right, #007bff, #00b7ff);
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

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

nav a {
    padding: 8px 15px;
    border-radius: 20px;
    transition: background 0.3s;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content */
main {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #4a4a4a;
    position: relative;
    padding-bottom: 10px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: #007bff;
}

/* Cards de Temperatura (Dashboard) */
#temperatureCards .card {
    background: white;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

#temperatureCards .card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: #007bff;
}

#temperatureCards .card p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #555;
}

#temperatureCards .card .temp-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff456a;
    margin: 10px 0;
}

/* Gráficos */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: 400px;
    display: flex;
    flex-direction: column;
}

canvas {
    width: 100% !important;
    height: auto !important;
    flex-grow: 1;
}

/* Estilos para o Formulário de Histórico */
#historyForm .form-control, #historyForm .form-select {
    border-radius: 6px;
    border-color: #ced4da;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#historyForm .form-control:focus, #historyForm .form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#historyForm .btn-primary {
    background-color: #007bff;
    border: none;
    font-weight: 500;
    transition: background 0.3s;
}

#historyForm .btn-primary:hover {
    background-color: #0069d9;
}

/* Estilos para a Tabela de Histórico */
#historyTable {
    width: 100%;
    border-collapse: collapse;
}

#historyTable th, #historyTable td {
    padding: 12px;
    text-align: center;
    font-size: 0.9rem;
}

#historyTable th {
    font-weight: 600;
    color: #495057;
    background-color: #e9ecef;
}

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

#historyTable td {
    border-color: #dee2e6;
}

#exportExcel {
    font-weight: 500;
    transition: background 0.3s;
}

#exportExcel:hover {
    background-color: #28a745;
}

/* Responsividade */
@media (max-width: 768px) {
    main {
        padding: 15px;
    }

    h2 {
        font-size: 1.4rem;
    }

    #temperatureCards .card {
        padding: 15px;
    }

    #temperatureCards .card h3 {
        font-size: 1.1rem;
    }

    #temperatureCards .card .temp-value {
        font-size: 1.3rem;
    }

    .chart-container {
        height: 350px;
    }

    #historyForm .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    header {
        padding: 15px;
        text-align: center;
    }

    header h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    nav {
        justify-content: center !important;
    }

    #historyTable th, #historyTable td {
        padding: 8px;
        font-size: 0.85rem;
    }
}
