body { 
    font-family: sans-serif; 
    background-color: #f4f4f4; 
    margin: 0; 
}
.header { 
    background: #333; 
    color: white; 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.header h1 { 
    margin: 0; 
    font-size: 1.5em; 
}
.header a { 
    color: #fff; 
    text-decoration: none; 
    background: #dc3545; 
    padding: 8px 12px; 
    border-radius: 4px; 
}
.container { 
    max-width: 1200px; 
    margin: 20px auto; 
    padding: 20px; 
    background: #fff; 
    border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

/* Estilos do Formulário e Tabela */
.admin-form { 
    background: #f9f9f9; 
    border: 1px solid #eee; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
}
.admin-form h2 { 
    margin-top: 0; 
}
.form-group { 
    margin-bottom: 15px; 
}
.form-group label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
}
.form-group input, .form-group select, .form-group textarea { 
    width: 100%; 
    padding: 8px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    box-sizing: border-box; 
}
.form-group-inline { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
}
.form-group-inline label { 
    margin-bottom: 0; 
}
.btn-submit { 
    background-color: #007bff; 
    color: white; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
}
th, td { 
    border: 1px solid #ddd; 
    padding: 12px; 
    text-align: left; 
}
th { 
    background-color: #f8f8f8; 
}
tr:nth-child(even) { 
    background-color: #fdfdfd; 
}
.prioritaria { 
    color: red; 
    font-weight: bold; 
}
.estado-pendente { 
    color: orange; 
    font-weight: bold; 
}
.estado-realizada { 
    color: green; 
    font-weight: bold; 
}

.error { 
    color: red; 
    background: #ffebee; 
    border: 1px solid red; 
    padding: 10px; 
    border-radius: 4px; 
}
.success { 
    color: green; 
    background: #e8f5e9; 
    border: 1px solid green; 
    padding: 10px; 
    border-radius: 4px; 
}

/* ================================== */
/* --- ESTILOS (Login & Register) --- */
/* ================================== */

/* Layout para páginas de formulário (centralizado) */
body.form-page {
    display: grid;
    place-items: center;
    min-height: 80vh;
}

/* O container do formulário */
.form-container {
    background: #fff;
    border: 1px solid #ccc;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 350px;
    box-sizing: border-box;
}

/* Grupos dentro do container */
.form-container .form-group {
    margin-bottom: 15px;
}

.form-container .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Inputs de texto e senha */
.form-container input[type="tel"],
.form-container input[type="text"],
.form-container input[type="password"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Botão de Submit */
.form-container .btn {
    width: 100%;
    padding: 10px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

/* Cores específicas dos botões */
.btn-login {
    background-color: #28a745; /* Verde */
}
.btn-register {
    background-color: #007bff; /* Azul */
}

/* Link "Não tem conta?" */
.form-link {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
}

/* ================================== */
/* --- CONTROLE DE IMPRESSÃO --- */
/* ================================== */

/* Esconde o cabeçalho do relatório NA TELA (VISÃO NORMAL) */
.print-report-header {
    display: none !important; 
}

/* ================================== */
/* --- ESTILOS PARA MOBILE (CARDS) --- */
/* (Telas com 768px de largura ou menos) */
/* ================================== */
@media (max-width: 768px) {

    .print-report-header {
        display: block !important; /* MOSTRA na impressão */
    }

    /* 1. Ajusta o Header (igual Opção 1) */
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .header div {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* 2. Ajusta o Container (igual Opção 1) */
    .container {
        width: 95%;
        margin: 10px auto;
        padding: 10px;
    }
    
    /* 3. Ajusta os Formulários (igual Opção 1) */
    .form-container {
        width: 90%;
    }

    /* 4. A MÁGICA DA TABELA (Cards) */
    table {
        border: 0;
    }
    
    /* Esconde o cabeçalho original */
    table thead {
        display: none;
    }

    table tr {
        display: block; /* Empilha as linhas */
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 5px;
        box-shadow: 0 2px 3px rgba(0,0,0,0.1);
    }
    
    table td {
        display: block; /* Empilha as células */
        padding: 10px 15px;
        border: none;
        border-bottom: 1px dotted #eee;
    }
    
    /* Cria o "cabeçalho" falso usando um pseudo-elemento */
    table td::before {
        content: attr(data-label); /* Puxa o título da célula */
        float: left;
        font-weight: bold;
        color: #333;
    }

    /* Ações (Botões) */
    table td[style*="flex-direction: column"] {
        display: block; /* Mantém os botões */
    }
    
    table td[style*="flex-direction: column"] a,
    table td[style*="flex-direction: column"] form button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        margin-bottom: 5px;
    }
    
    /* Anotações do Usuário */
    .memo-historico {
        height: 80px; /* Reduz a altura no mobile */
    }

    /* ================================== */
    /* --- AJUSTE (Alinhamento Cards) --- */
    /* ================================== */
    
    /* Força células com texto longo (Descrição e Histórico)
       a alinharem à esquerda, sobrescrevendo a regra "text-align: right" */
    table td[data-label="Descrição"],
    table td[data-label="Histórico"],
    table td[data-label="Minhas Anotações (Memo)"] {
        text-align: left !important;
    }
    
    /* Garante que o formulário de anotação também fique alinhado */
    table td[data-label="Minhas Anotações (Memo)"] form {
        text-align: left;
    }
}

/* ================================== */
/* --- ESTILOS (Filtro de Tarefas) --- */
/* ================================== */

.filter-form {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.filter-form h2 {
    margin-top: 0;
}

/* Layout dos controles do filtro */
.filter-controls {
    display: flex;
    flex-wrap: wrap; /* Permite quebrar linha em telas menores */
    gap: 20px;
    align-items: flex-end; /* Alinha os botões e inputs */
}

/* Faz os filtros crescerem */
.filter-controls .form-group {
    flex: 1;
    min-width: 180px; /* Largura mínima antes de quebrar */
}

.filter-actions {
    display: flex;
    gap: 10px;
}
.btn-clear {
    display: inline-block;
    background-color: #6c757d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    height: 38px; /* Mesma altura do botão de submit */
    box-sizing: border-box;
    margin-top: -55px;
}


/* ================================== */
/* --- AJUSTES (Mobile Cards) --- */
/* ================================== */

/* Precisamos adicionar os data-labels que esquecemos */
@media (max-width: 768px) {
    
    /* Ajusta o novo formulário de filtro para mobile */
    .filter-controls {
        flex-direction: column; /* Empilha os filtros */
        align-items: stretch; /* Ocupa 100% da largura */
    }

.btn-clear {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    margin-top: -10px;
    width: 30%;
}
    
    /* Tabela do ADMIN - index.php */
    .admin-task-list tbody tr td:nth-of-type(1)::before { content: "Data de Criação"; }
    .admin-task-list tbody tr td:nth-of-type(2)::before { content: "Descrição"; }
    .admin-task-list tbody tr td:nth-of-type(3)::before { content: "Usuário"; }
    .admin-task-list tbody tr td:nth-of-type(4)::before { content: "Estado"; }
    .admin-task-list tbody tr td:nth-of-type(5)::before { content: "Prioridade"; }
    .admin-task-list tbody tr td:nth-of-type(6)::before { content: "Histórico"; }
    .admin-task-list tbody tr td:nth-of-type(7)::before { content: "Ações"; }

    /* Tabela do USUÁRIO - index.php */
    .user-task-list tbody tr td:nth-of-type(1)::before { content: "Data de Criação"; }
    .user-task-list tbody tr td:nth-of-type(2)::before { content: "Descrição"; }
    .user-task-list tbody tr td:nth-of-type(3)::before { content: "Estado"; }
    .user-task-list tbody tr td:nth-of-type(4)::before { content: "Prioridade"; }
    .user-task-list tbody tr td:nth-of-type(5)::before { content: "Minhas Anotações"; }
}

/* ================================== */
/* --- AJUSTE (Alinhamento do Filtro) --- */
/* ================================== */

/* Força os inputs e selects DENTRO do filtro 
   a terem a mesma altura do botão "Limpar" */
.filter-controls .form-group select,
.filter-controls .form-group input[type="date"] {
    height: 38px; 
}

/* 1. Força a CÉLULA de Ações a ser flex horizontal */
    table td[style*="flex-direction: column"] {
        display: flex !important;       /* Override 'display: block' */
        flex-direction: row !important; /* Override inline 'column' */
        justify-content: space-between; /* Espaça os botões */
        align-items: stretch; /* Garante altura igual */
        gap: 5px; /* Espaço entre os botões */
    }

    /* 2. Força os LINKS (botões) a terem 30% e centraliza */
    table td[style*="flex-direction: column"] a {
        width: 30% !important; /* Override 'width: 100%' */
        flex: 1 1 30%; /* Permite crescer/encolher */
        margin-bottom: 0; /* Remove margem vertical */
        
        /* Centralização Vertical/Horizontal */
        display: flex;
        align-items: center;
        justify-content: center;
        
        /* Ajustes finos de texto */
        padding: 8px 4px; 
        font-size: 0.85em; 
        line-height: 2;
    }

/* ================================== */
/* --- ESTILOS DE IMPRESSÃO (Corrigido) --- */
/* ================================== */
@media print {

    /* --- 1. ESCONDE OS ELEMENTOS DESNECESSÁRIOS --- */
    /* NÃO escondemos o <body> ou .container, apenas seus "irmãos" */
    
    .header,
    .admin-form,
    .filter-form,
    .change-password-form,
    .success,
    .error,
    #print-report-btn { /* Esconde o próprio botão de imprimir */
        display: none !important;
    }

    /* --- 2. ESCONDE AS COLUNAS INDESEJADAS --- */
    /* Vamos esconder o Histórico (6ª) e as Ações (7ª) */
    
    .task-list th:nth-child(6),
    .task-list td:nth-child(6) {
        display: none !important; /* Esconde Histórico */
    }
    
    .task-list th:nth-child(7),
    .task-list td:nth-child(7) {
        display: none !important; /* Esconde Ações */
    }

    /* --- 3. FORMATAÇÃO DE IMPRESSÃO --- */
    /* Reseta o layout do corpo e do container */
    body, .container {
        background: #fff !important;
        color: #000 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    /* Garante que a lista de tarefas seja exibida */
    .task-list {
        display: block !important;
    }
    
    /* Estiliza a tabela para o papel */
    table {
        width: 100% !important;
        margin-top: 10px;
        border-collapse: collapse;
        font-size: 10pt;
        page-break-inside: auto; /* Permite quebrar a tabela entre páginas */
    }
    
    tr {
        page-break-inside: avoid; /* Tenta não quebrar uma linha no meio */
    }

    th, td {
        border: 1px solid #888 !important;
        padding: 6px 10px !important;
        text-align: left !important;
        vertical-align: top;
    }

    th {
        background-color: #eee !important;
    }

    /* Remove cores */
    .estado-pendente, .estado-realizada, .prioritaria {
        color: #000 !important;
        font-weight: normal !important;
    }

    /* --- TÍTULO DO RELATÓRIO E FILTROS --- */

    /* 1. Esconde os títulos originais */
    .task-list h2, /* Esconde "Todas as Tarefas" */
    .print-report-header h3 { /* Esconde "Filtros Aplicados" */
        display: none !important;
    }

    /* 2. Adiciona o Título Principal ao topo da seção de filtros */
    .print-report-header::before {
        content: "Relatório de Tarefas - TaskMan";
        display: block;
        font-size: 1.3rem; /* Um pouco maior */
        margin-bottom: 20px;
        text-align: center;
        font-weight: bold;
    }

    /* 3. Garante que a seção de filtros (agora com o título) seja exibida */
    .print-report-header {
        display: block !important;
        margin-bottom: 20px;
        border-bottom: 2px solid #000;
        padding-bottom: 15px;
    }
    
}

/* ================================== */
/* --- ESTILO (Header Logo) --- */
/* ================================== */

/* Container para [Logo + Título] */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px; /* Espaço entre o logo e o título */
}

.header-logo {
    height: 80px; /* Altura desejada do logo */
    width: auto;  /* Mantém a proporção */
}