body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: #1e1e1e;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* --- NOVO: Estilos para o cabeçalho e controle de autenticação --- */
.dashboard-header {
    position: relative; /* Adicionado para o posicionamento absoluto dos controles */
    display: flex;
    justify-content: center; /* Centraliza o título */
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.dashboard-header h1 {
    margin: 0;
    color: #61dafb;
    font-weight: 600;
}

.auth-controls {
    position: absolute; /* Posiciona os controles à direita */
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.auth-button:hover {
    background-color: #0056b3;
}

#loggedInUser {
    color: #a0a0a0;
    font-size: 0.9em;
    font-style: italic;
    margin-right: 5px;
}

/* --- FIM: Estilos para o cabeçalho e controle de autenticação --- */


h2 {
    text-align: center;
    color: #61dafb;
    margin-bottom: 25px;
    font-weight: 600;
}

/* --- Estilos para a nova seção de resumo --- */
.summary-section {
    margin-bottom: 40px;
    padding: 20px;
    background-color: #252525;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.summary-section table {
    margin-top: 15px;
}

/* Estilos para as bolinhas de status */
.status-circle {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-green {
    background-color: #28a745;
}

.status-yellow {
    background-color: #ffc107;
}

.status-gray {
    background-color: #6c757d;
}

.status-red {
    background-color: #dc3545;
}
/* --- Fim dos estilos da seção de resumo --- */

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-buttons button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.filter-buttons button:hover {
    background-color: #0056b3;
}

.filter-buttons button.active {
    background-color: #28a745;
}

.alarm-section {
    margin-top: 30px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

table thead {
    background-color: #2a2a2a;
    color: #f0f0f0;
}

table th, table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #333;
}

table th:first-child { border-top-left-radius: 10px; }
table th:last-child { border-top-right-radius: 10px; }


table tbody tr {
    background-color: #1e1e1e;
    transition: background-color 0.2s ease;
}

table tbody tr:nth-child(even) {
    background-color: #222;
}

table tbody tr:hover {
    background-color: #2a2a2a;
}

.loading, .no-alarms {
    text-align: center;
    font-style: italic;
    color: #999;
    margin-top: 25px;
    padding: 10px;
    background-color: #2a2a2a;
    border-radius: 8px;
}

/* CORRIGIDO: Garante que .hidden sempre oculta o elemento */
.hidden {
    display: none !important; 
}

/* --- ESTILOS ADICIONADOS PARA A COLUNA DE OBSERVAÇÃO --- */
.observation-cell {
    position: relative;
    cursor: pointer;
    min-width: 200px;
    vertical-align: top;
    padding: 12px 15px;
    box-sizing: border-box;
}

.observation-textarea {
    width: calc(100% - 10px);
    min-height: 80px;
    box-sizing: border-box;
    resize: vertical;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #61dafb;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95em;
    background-color: #2a2a2a;
    color: #e0e0e0;
}

.observation-cell button {
    margin-right: 8px;
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.observation-cell .save-observation-btn {
    background-color: #28a745;
    color: white;
}

.observation-cell .save-observation-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.observation-cell .cancel-observation-btn {
    background-color: #dc3545;
    color: white;
}

.observation-cell .cancel-observation-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

.no-observation-placeholder {
    font-style: italic;
    color: #888;
    display: block;
    padding: 5px 0;
}

/* --- ESTILOS EXISTENTES PARA O BOTÃO DE LIMPAR ALARME (REVISADO PARA CONTEXTO DARK) --- */
.clear-alarm-button {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.clear-alarm-button:hover {
    background-color: #c0392b;
}

.clear-alarm-button:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
}

.loading-button {
    background-color: #f39c12;
}

/* --- NOVO: Estilos do Modal de Login --- */
.modal {
    display: flex; /* Usa flexbox para centralizar */
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7); /* Fundo semi-transparente */
    justify-content: center; /* Centraliza horizontalmente */
    align-items: center; /* Centraliza verticalmente */
}

.modal-content {
    background-color: #1e1e1e;
    margin: auto; /* Centraliza no layout flex */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.7);
    width: 90%;
    max-width: 400px; /* Limita largura em telas maiores */
    position: relative; /* Para posicionar o botão de fechar */
    border: 1px solid #333;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #61dafb;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    text-align: center;
    color: #61dafb;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: calc(100% - 20px); /* Ajusta largura para padding */
    padding: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    font-size: 1em;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    border-color: #61dafb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(97, 218, 251, 0.3);
}

.submit-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    width: 100%;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.submit-button:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.login-message {
    color: #dc3545;
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
}

/* --- Media Queries para Responsividade --- */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    .dashboard-header {
        flex-direction: column;
        align-items: center; /* Centraliza os itens na visualização de coluna */
    }
    .auth-controls {
        position: static; /* Reseta o posicionamento para o fluxo normal */
        margin-top: 15px;
        width: 100%;
        justify-content: center; /* Centraliza os botões */
    }
    .auth-button {
        width: auto; /* Deixa o botão se ajustar ao conteúdo */
        flex-grow: 1; /* Permite que eles cresçam para preencher espaço */
    }

    .filter-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    .filter-buttons button {
        width: 90%;
        max-width: 300px;
        display: block;
        margin: 0 auto;
        margin-bottom: 0;
    }

    .summary-section table,
    .alarm-section table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        white-space: nowrap;
    }
    .summary-section th, .summary-section td,
    .alarm-section th, .alarm-section td {
        font-size: 0.85em;
        padding: 8px 10px;
    }

    /* Ajustes para o modal em telas menores */
    .modal-content {
        padding: 20px;
    }
    .modal-content h2 {
        font-size: 1.5em;
    }
}

/* Estilo para indicar que as linhas do resumo são clicáveis */
.plants-summary-row {
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

/* O hover padrão já é #2a2a2a, vamos usar um pouco mais claro para diferenciar */
.plants-summary-row:hover {
    background-color: #333;
}

/* Estilo para a linha expandida */
.plants-summary-row.expanded {
    background-color: #2a3a4a; /* Um azul escuro para destacar */
}

/* Estilos para a linha de detalhe que contém o gráfico */
.chart-detail-row td {
    padding: 20px !important;
    background-color: #252525; /* Mesmo fundo da seção de resumo */
    border-bottom: 2px solid #333;
}

.chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

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

.chart-year {
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 15px;
    min-width: 60px;
    text-align: center;
    color: #61dafb; /* Cor de destaque */
}

.year-nav-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}

.year-nav-btn:hover {
    background-color: #0056b3;
}

.chart-canvas-wrapper {
    position: relative;
    height: 250px; /* Altura fixa para o gráfico */
    width: 95%;   /* Largura relativa ao container */
}

.chart-loading {
    font-style: italic;
    color: #999; /* Cor de texto secundária */
}
