/* GERAL */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    background-color: #fff;
    padding: 20px; /* Ajuste para mobile */
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px; /* Largura padrão para desktop */
    margin-top: 20px; /* Ajuste para mobile */
    margin-bottom: 20px;
}

h1, h2, h3 {
    color: #007bff; /* Azul primário */
    text-align: center;
    margin-bottom: 20px;
}

/* FORMULÁRIOS */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
}

/* BOTÕES */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.1s ease;
    margin-top: 10px;
    width: 100%; /* Botões ocupam a largura total em mobile */
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

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

.btn-danger {
    background-color: #dc3545;
    color: white !important; 
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* NOVO: Botão Copiar em Destaque */
.btn-copy {
    background-color: #28a745; /* Verde */
    color: white;
    font-weight: bold;
}
.btn-copy:hover {
    background-color: #1e7e34;
}


/* ALERTAS */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* TABELAS */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px; 
}

th, td {
    border: 1px solid #ddd;
    padding: 8px; 
    text-align: left;
}

th {
    background-color: #007bff;
    color: white;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* NAVEGAÇÃO / HEADER */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; 
}

.header-nav h1 {
    font-size: 24px;
    margin: 0 0 10px 0;
    text-align: left;
    width: 100%; 
}

.header-nav a.btn {
    width: auto; 
    margin-top: 0;
}

/* Layout flexível para grupos de formulário (monitor.php) */
.form-flex-group {
    display: flex;
    flex-direction: column; 
    gap: 15px;
}
.form-flex-group > div {
    flex: 1 1 100%;
}

/* Classe específica para esconder a mensagem de atualização */
.update-message {
    font-weight: normal;
}

/* ======================================= */
/* MEDIA QUERY PARA DESKTOPS (Min-width: 768px) */
/* ======================================= */
@media (min-width: 768px) {
    .container {
        padding: 30px;
        margin-top: 50px;
    }

    /* Botões na largura padrão em desktop */
    .btn {
        width: auto;
    }
    
    /* Layout do monitor em desktop: volta para horizontal */
    .form-flex-group {
        flex-direction: row; 
    }

    /* Alinhamento dos itens de filtro em desktop */
    .filter-group {
        display: flex;
        align-items: flex-end; /* Alinha o botão com o campo de data */
        gap: 15px;
    }
    
    .header-nav h1 {
        font-size: 28px;
        width: auto;
    }
    
    /* Tabela volta ao padding normal */
    table {
        font-size: 16px;
    }
    th, td {
        padding: 12px;
    }
}


/* ======================================= */
/* ESTILOS PARA IMPRESSÃO (MODO RELATÓRIO) */
/* ======================================= */
@media print {
    body {
        background-color: #fff !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .container {
        box-shadow: none;
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    /* Ocultar elementos não essenciais ao relatório */
    .header-nav, 
    form, 
    hr, 
    .alert,
    h3:not(.print-title),
    .btn:not(.print-btn),
    .update-message 
    { 
        display: none !important;
    }
    
    /* Mostrar título principal do relatório */
    h1 {
        text-align: left !important;
        margin-top: 0 !important;
        color: #333 !important;
        border-bottom: 2px solid #007bff;
        padding-bottom: 5px;
        font-size: 24px;
    }
    
    /* Exibir filtros/detalhes como cabeçalho do relatório (h4) */
    h4 {
        text-align: left !important;
        margin-top: 15px !important;
        margin-bottom: 10px !important;
        font-size: 18px;
        font-weight: bold;
        /* Garante que o cabeçalho do relatório não quebre a linha no meio */
        page-break-after: avoid; 
    }

    /* Estilo da tabela para impressão */
    table {
        border: 1px solid #333;
        font-size: 10pt;
    }
    th {
        background-color: #ccc !important;
        color: #333 !important;
    }
    tr:nth-child(even) {
        background-color: #f8f8f8 !important;
    }
    
    table {
        page-break-after: auto;
    }
}
