/* CSS Global */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
}

/* --- Estilos da Página de Login (index.html) --- */
body.login-page {
    display: flex; justify-content: center; align-items: center;
    height: 100vh; background-color: #f0f2f5;
}
.login-box {
    background: white; padding: 40px; border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 100%; max-width: 350px;
}
.login-box h2 { text-align: center; color: #333; margin-bottom: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: #666; font-size: 14px;}
.form-group input {
    width: 100%; padding: 10px; border: 1px solid #ccc;
    border-radius: 4px; box-sizing: border-box; font-size: 16px;
}
.btn {
    width: 100%; padding: 12px; background-color: #0d6efd;
    color: white; border: none; border-radius: 4px;
    cursor: pointer; font-size: 16px; font-weight: bold; margin-top: 10px;
}
.btn:hover { background-color: #0b5ed7; }

/* --- Estilos do Painel Inicial e Cards (inicial.php) --- */
body.panel-page {
    background-color: #f8f9fa; padding: 20px;
}
.header {
    display: flex; justify-content: space-between; align-items: center;
    background: white; padding: 15px 30px; border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 30px;
}
.header h1 { color: #333; margin: 0; font-size: 24px; }
.logout-btn {
    background-color: #dc3545; color: white; text-decoration: none;
    padding: 8px 16px; border-radius: 4px; font-weight: bold;
}
.logout-btn:hover { background-color: #bb2d3b; }

.grid-cards { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px; 
}
/* Regras para adaptar a tela do celular e tablet */
@media (max-width: 992px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-cards { grid-template-columns: 1fr; } }

.grid-2-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 768px) { .grid-2-cols { grid-template-columns: 1fr; } }

.card {
    background: white; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex; flex-direction: column; overflow: hidden;
    transition: transform 0.2s;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); }
.card-header {
    background-color: #0d6efd; color: white; padding: 15px;
    font-size: 18px; font-weight: bold; text-align: center;
}
.card-body { padding: 20px; color: #555; flex-grow: 1; line-height: 1.5; }
.card-footer { padding: 15px 20px; background-color: #f1f4f9; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.card-footer a {
    background-color: #198754; color: white; text-decoration: none;
    padding: 10px 15px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: bold; flex: 1; min-width: 100px; text-align: center;
}
.card-footer a:hover { background-color: #157347; }

/* --- Estilos do Gerenciador de Frases --- */
.container { max-width: 1000px; margin: 0 auto; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.form-frase { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.form-frase textarea { width: 100%; height: 100px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 16px; font-family: inherit; resize: vertical; margin-top: 5px; }
.form-row { display: flex; gap: 15px; margin-bottom: 15px; }
.form-row .form-group { flex: 1; margin-bottom: 0; }
.input-group { display: flex; margin-top: 5px; }
.input-group select { flex-grow: 1; padding: 10px; border: 1px solid #ccc; border-radius: 4px 0 0 4px; box-sizing: border-box; font-size: 16px; }
.input-group button { padding: 10px 15px; background-color: #198754; color: white; border: none; border-radius: 0 4px 4px 0; cursor: pointer; font-size: 16px; }
.input-group button:hover { background-color: #157347; }
.btn-caixa-alta { padding: 5px 12px; font-size: 13px; background-color: #0d6efd; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; display: inline-flex; align-items: center; gap: 5px; transition: background-color 0.2s, transform 0.1s; }
.btn-caixa-alta:hover { background-color: #0b5ed7; }
.btn-caixa-alta:active { transform: scale(0.98); }
.btn-verificar-ortografia { padding: 5px 12px; font-size: 13px; background-color: #198754; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; display: inline-flex; align-items: center; gap: 5px; transition: background-color 0.2s, transform 0.1s; }
.btn-verificar-ortografia:hover { background-color: #157347; }
.btn-verificar-ortografia:active { transform: scale(0.98); }

.tabela-frases { width: 100%; border-collapse: collapse; margin-top: 20px; }
.tabela-frases th, .tabela-frases td { border: 1px solid #ddd; padding: 12px; text-align: left; vertical-align: top; }
.tabela-frases th { background-color: #f1f4f9; color: #333; }
.tabela-frases tr:nth-child(even) { background-color: #f9f9f9; }
.tabela-frases tr:hover { background-color: #f1f1f1; }

/* Evita que os botões de ação quebrem de linha e os centraliza */
.tabela-frases th:last-child, .tabela-frases td:last-child {
    white-space: nowrap;
    text-align: center;
}

.btn-voltar { background-color: #6c757d; color: white; text-decoration: none; padding: 8px 16px; border-radius: 4px; font-weight: bold; }
.btn-voltar:hover { background-color: #5c636a; }
.btn-salvar { width: auto; padding: 10px 30px; }

.msg-sucesso { background-color: #d1e7dd; color: #0f5132; padding: 10px; border-radius: 4px; margin-bottom: 15px; border: 1px solid #badbcc; }
.msg-erro { background-color: #f8d7da; color: #842029; padding: 10px; border-radius: 4px; margin-bottom: 15px; border: 1px solid #f5c2c7; }
.tags-badge { background-color: #e9ecef; color: #495057; padding: 3px 8px; border-radius: 12px; font-size: 12px; display: inline-block; margin-top: 5px; }

/* --- Ícones Globais --- */
.fa-solid { margin-right: 6px; }

/* --- Botões de Ação na Tabela --- */
.btn-acao { padding: 6px 10px; border-radius: 4px; color: white; text-decoration: none; font-size: 14px; margin-right: 4px; display: inline-block; border: none; cursor: pointer; }
.btn-editar { background-color: #ffc107; color: #000; }
.btn-editar:hover { background-color: #e0a800; }
.btn-excluir { background-color: #dc3545; }
.btn-excluir:hover { background-color: #c82333; }

/* --- Estilos da Página Pública (frases.php) --- */
body.public-page {
    /* GRADIENTE MODERNO (Padrão) */
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    min-height: 100vh;
    padding: 40px 20px;
    
    /* PARA USAR UMA IMAGEM DE FUNDO: Apague os símbolos de barra e asterisco (/*) das 4 linhas abaixo e cole o link da sua imagem */
    /* background-image: url('https://sua-imagem-aqui.jpg'); */
    /* background-size: cover; */
    /* background-attachment: fixed; */
    /* background-position: center; */
}

body.public-page .container {
    /* Deixa a caixa principal levemente transparente (efeito vidro) */
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 40px;
}

body.public-page .card {
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-radius: 10px;
}

/* --- Paginação --- */
.paginacao { display: flex; justify-content: center; gap: 5px; margin-top: 30px; flex-wrap: wrap; }
.paginacao a, .paginacao span { padding: 8px 16px; border-radius: 4px; background: white; color: #0d6efd; text-decoration: none; border: 1px solid #dee2e6; font-weight: bold; }
.paginacao a:hover { background: #e9ecef; }
.paginacao .atual { background: #0d6efd; color: white; border-color: #0d6efd; }

/* --- Elementos da Página Pública e Painel --- */
.busca-form { display:flex; gap:10px; margin-bottom:20px; } 
.busca-form input { flex:1; padding:12px; border:1px solid #ccc; border-radius:4px; font-size:16px; }
.filtro-categorias { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 30px; justify-content: center; }
.cat-pill { padding: 6px 14px; background: rgba(255,255,255,0.6); border: 1px solid #ccc; border-radius: 20px; text-decoration: none; color: #333; font-size: 14px; transition: 0.2s; }
.cat-pill:hover { background: white; border-color: #0d6efd; }
.cat-pill.active { background: #0d6efd; color: white; border-color: #0d6efd; font-weight: bold; }
.btn-share { background: #f8f9fa; border: 1px solid #dee2e6; color: #0d6efd; cursor: pointer; font-size: 13px; padding: 6px 12px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; font-weight: bold; transition: 0.2s; text-decoration: none; font-style: normal; margin-top: 15px; }
.btn-share:hover { background: #e9ecef; color: #0b5ed7; }
.btn-listen, .btn-copy { background: #e9ecef; border: 1px solid #ced4da; color: #495057; cursor: pointer; font-size: 13px; padding: 6px 12px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; font-weight: bold; transition: 0.2s; text-decoration: none; font-style: normal; margin-top: 15px; margin-right: 5px; }
.btn-listen:hover, .btn-copy:hover { background: #ced4da; color: #212529; }
.btn-whatsapp { background: #25D366; border: 1px solid #1da851; color: white; cursor: pointer; font-size: 13px; padding: 6px 12px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; font-weight: bold; transition: 0.2s; text-decoration: none; font-style: normal; margin-top: 15px; margin-right: 5px; }
.btn-whatsapp:hover { background: #128C7E; color: white; border-color: #128C7E; }
.audio-controls { display: flex; gap: 10px; justify-content: center; align-items: center; margin-bottom: 20px; background: white; padding: 10px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex-wrap: wrap; }
.audio-controls select { padding: 8px; border-radius: 4px; border: 1px solid #ccc; max-width: 250px; font-size: 14px; }

/* --- Responsividade Geral (Celulares e Tablets) --- */
@media (max-width: 768px) {
    .busca-form { flex-direction: column; }
    .busca-form .btn { width: 100% !important; margin-top: 0 !important; }
    .tabela-responsiva { overflow-x: auto; display: block; width: 100%; -webkit-overflow-scrolling: touch; }
    body.public-page .container { padding: 20px; }
    .btn-share, .btn-listen, .btn-copy, .btn-whatsapp { width: 100%; justify-content: center; margin-right: 0; }
    .tabela-frases th, .tabela-frases td { padding: 8px; font-size: 14px; }
    .form-row { flex-direction: column; gap: 10px; }
}

/* --- Estilos para Impressão (Gerar PDF) --- */
@media print {
    body.public-page { background: white; padding: 0; }
    .container { box-shadow: none; padding: 0; border: none; }
    .busca-form, .paginacao, .btn, .filtro-categorias, .btn-share, .btn-listen, .btn-copy, .btn-whatsapp, .audio-controls, #btn-voltar-topo { display: none !important; }
    .tabela-frases { width: 100%; border-collapse: collapse; page-break-inside: auto; }
    .tabela-frases tr { page-break-inside: avoid; page-break-after: auto; }
    /* Mostrar texto completo das frases ao imprimir */
    .texto-resumo { display: none !important; }
    .texto-completo { display: inline !important; }
}

/* --- Modo de Visualização de Impressão na Tela --- */
body.print-mode {
    background: white !important;
    padding: 20px !important;
}
body.print-mode .container {
    background: white !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    max-width: 100% !important;
}
body.print-mode .busca-form,
body.print-mode .paginacao,
body.print-mode .btn,
body.print-mode .filtro-categorias,
body.print-mode .btn-share,
body.print-mode .btn-listen,
body.print-mode .btn-copy,
body.print-mode .btn-whatsapp,
body.print-mode .audio-controls,
body.print-mode #btn-voltar-topo {
    display: none !important;
}
body.print-mode .texto-resumo {
    display: none !important;
}
body.print-mode .texto-completo {
    display: inline !important;
}

/* --- Modal de Imagem --- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 90%; max-width: 450px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.template-options { display: flex; justify-content: center; gap: 15px; margin: 25px 0; }
.color-swatch { width: 45px; height: 45px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: transform 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.color-swatch:hover, .color-swatch.active { transform: scale(1.15); border-color: #333; }

/* --- Estilos para o Modal de Opções de PDF --- */
.btn-opcao-pdf {
    margin: 0;
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ccc;
    text-align: left;
    padding: 12px 20px;
    font-weight: normal;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    transition: all 0.2s ease-in-out;
}
.btn-opcao-pdf:hover {
    background-color: #e9ecef;
    border-color: #0d6efd;
    color: #0d6efd;
    transform: translateX(5px);
}

.btn-opcao-pdf-todas {
    margin: 0;
    background-color: #0d6efd;
    color: white;
    border: 1px solid #0d6efd;
    text-align: left;
    padding: 12px 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    transition: all 0.2s ease-in-out;
}
.btn-opcao-pdf-todas:hover {
    background-color: #0b5ed7;
    border-color: #0b5ed7;
    transform: translateX(5px);
}