/* Variáveis para facilitar a manutenção */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --bg-color: #f4f7f6;
    --surface-color: #ffffff;
    --text-color: #2c3e50;
    --border-color: #d1d8e0;
    --accent-gradient: linear-gradient(135deg, #0056b3 0%, #00a8ff 100%);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Container Principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Cabeçalho estilizado com o conceito da Logo */
header {
    background: var(--surface-color);
    border-bottom: 3px solid var(--primary-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.logo-container img {
    height: 50px;
    display: block;
}

/* Cartões (Padrão para Clientes, Pets, Relatórios) */
.card {
    background: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}


.card-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Botões com o degradê da marca Janus */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background: var(--accent-gradient);
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.3s ease;
    text-decoration: none;
}

.btn:hover {
    opacity: 0.9;
}

/* Formulários (Inputs) */
input[type="text"],
input[type="password"],
.input-text,
.input-date,
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 14px;
    margin-top: 5px;
    margin-bottom: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    display: block;
}

input:focus,
.input-text:focus,
.input-date:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.input-text::placeholder {
    color: #a0aec0;
}

/* ── Input Date ── */
input[type="date"] {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 14px;
    margin-top: 5px;
    margin-bottom: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    display: block;
    cursor: pointer;

    /* Remove o estilo padrão do browser onde possível */
    -webkit-appearance: none;
    appearance: none;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* Estiliza o ícone do calendário no Chrome/Edge */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    filter: invert(20%) sepia(80%) saturate(500%) hue-rotate(190deg);
    /* Deixa azul no tom da marca */
    transition: opacity 0.2s;
    padding: 2px;
    border-radius: 3px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background-color: rgba(0, 86, 179, 0.08);
}

/* Estiliza a parte editável da data no Chrome/Edge */
input[type="date"]::-webkit-datetime-edit {
    color: var(--text-color);
    font-family: inherit;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

input[type="date"]::-webkit-datetime-edit-text {
    color: var(--border-color);
    padding: 0 2px;
}

input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    border-radius: 2px;
    padding: 1px 3px;
    transition: background-color 0.15s;
}

input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
    background-color: var(--primary-color);
    color: white;
    outline: none;
}

/* Tabelas de Dados (Resultados do SQL) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background-color: #f1f4f8;
    color: var(--primary-color);
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.data-table tr:hover {
    background-color: #f9f9f9;
}

.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.sort-btn:hover {
    opacity: 0.75;
}

.sort-icon {
    font-size: 11px;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.sort-btn.asc .sort-icon,
.sort-btn.desc .sort-icon {
    opacity: 1;
}

.sort-btn.asc .sort-icon::after {
    content: ' ▲';
}

.sort-btn.desc .sort-icon::after {
    content: ' ▼';
}

.sort-btn:not(.asc):not(.desc) .sort-icon::after {
    content: ' ⇅';
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-aberto {
    background: #e8f4fd;
    color: #1565c0;
}

.badge-concluido {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-presencial {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-nao-presencial {
    background: #f5e8e8;
    color: #a52834;
}

.empty-msg {
    text-align: center;
    padding: 40px 20px;
    color: #9aa5b4;
    font-size: 14px;
}

.data-table td {
    font-size: 14px;
}

.data-table th {
    white-space: nowrap;
}

select, 
.input-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 14px;
    margin-top: 5px;
    margin-bottom: 15px;
    display: block;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;

    /* Customização da seta do Select */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230056b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px; /* Espaço para a seta não sobrepor o texto */
}

select:focus,
.input-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* Estilo para as opções dentro do Select */
select option {
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 10px;
}

/* Label padrão para formulários */
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
}

#botao-formulario-direita {
    display: flex;
    justify-content: flex-end; /* Alinha o conteúdo à direita */
    margin-top: 20px;
    gap: 10px; /* Caso você adicione um botão "Cancelar" depois, eles terão espaço */
}

/* ── Snackbar (Notificações) ── */
#snackbar {
    visibility: hidden; /* Escondido por padrão */
    min-width: 300px;
    background-color: var(--text-color); /* Fundo escuro para contraste */
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 3000; /* Acima de tudo */
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
}

/* Classe que será adicionada via JS para mostrar */
#snackbar.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

/* Borda esquerda colorida para indicar sucesso */
#snackbar.success {
    border-left: 5px solid #2ecc71;
}

/* Animações */
@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
    from { bottom: 30px; opacity: 1; }
    to { bottom: 0; opacity: 0; }
}

/* ── Inputs Desabilitados (Read-only/Disabled) ── */
input:disabled,
select:disabled,
textarea:disabled,
.input-text:disabled,
[disabled] {
    background-color: #f8fafc !important; /* Cinza bem claro para não sumir no fundo */
    border-color: #8b8b8b !important;      /* Borda mais suave */
    cursor: not-allowed;                  /* Cursor de "proibido" */
    opacity: 0.8;                         /* Leve transparência */
    box-shadow: none !important;          /* Remove sombras de elevação */
}

/* Garante que o efeito de azul no foco não apareça em campos desabilitados */
input:disabled:focus,
select:disabled:focus {
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

/* Estilo para quando você usa o atributo readonly (que é diferente de disabled) */
input[readonly] {
    background-color: #f1f5f9;
    cursor: default;
    border-style: dashed; /* Uma dica visual sutil de que é apenas leitura */
}

.modal {
    display: none; /* Escondido por padrão */
    position: fixed;
    z-index: 4000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Fundo escurecido */
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--surface-color);
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 60%; /* Ajuste conforme necessário */
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    position: relative;
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
}

.close-modal:hover { color: var(--primary-color); }



/* Botão de Perigo com Degradê Vermelho */
.btn-danger {
    background: linear-gradient(135deg, #b02a37 0%, #ff4d4d 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3); /* Uma sombrinha vermelha de leve */
}

.btn-danger:hover {
    background: linear-gradient(135deg, #a52834 0%, #e63946 100%) !important;
    opacity: 0.9;
    box-shadow: 0 4px 6px rgba(220, 53, 69, 0.4);
}

/* Container que envolve o input e o texto */
.checkbox-group {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    margin-bottom: 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    user-select: none; /* Impede selecionar o texto ao clicar rápido */
}

/* Esconde o checkbox padrão do navegador */
.checkbox-group input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* O quadrado customizado (estado desmarcado) */
.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
    width: 22px;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 4px; /* Mantém o padrão de 4px do seu CSS */
    transition: all 0.2s ease;
}

/* Efeito Hover no quadrado */
.checkbox-group:hover input ~ .checkmark {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

/* Quando marcado: Aplica o degradê da sua marca */
.checkbox-group input:checked ~ .checkmark {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: var(--shadow);
}

/* O ícone do "check" (escondido por padrão) */
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

/* Mostra o "check" quando marcado */
.checkbox-group input:checked ~ .checkmark:after {
    display: block;
}

/* Desenho do ícone de "V" (check) */
.checkbox-group .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Efeito de foco (acessibilidade) igual aos seus outros inputs */
.checkbox-group input:focus ~ .checkmark {
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
    border-color: var(--primary-color);
}

/* ══════════════════════════════════════════
   ESTILO PARA ITENS DE ARQUIVO (ManualServer)
   ══════════════════════════════════════════ */

/* O container principal do item */
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem !important;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.03); /* Leve transparência */
    border: 1px solid var(--border) !important;
    backdrop-filter: blur(10px);
}

.file-item:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* Área de informações (Ícone e Nomes) */
.file-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.file-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(0, 168, 255, 0.3));
}

.file-name {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Área de Ações (Botão e QR Code) */
.file-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
}

/* Estilização do QR Code */
.qr-container {
    background: #ffffff; /* Fundo branco essencial para o QR Code */
    padding: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.qr-container:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.qr-code-img {
    width: 100px;
    height: 100px;
    display: block;
}

/* ------------------------- CELULARES ----------------------*/

@media screen and (max-width: 1024px) {
    .modal-content {
        width: 95% !important;        /* Força os 95% */
        margin: 10px auto !important;
        max-height: 90vh !important;
        left: 0 !important;           /* Garante que não esteja deslocado */
        right: 0 !important;
        padding: 10px !important;
    }
}

@media (max-width: 600px) {
    .file-item { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .file-actions { width: 100%; justify-content: space-between; }
}

.file-item {
    display: flex;
    flex-direction: row; /* Padrão Desktop */
    align-items: center;
    justify-content: space-between;
    padding: 1rem !important;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border) !important;
    backdrop-filter: blur(10px);
    border-radius: 12px;
    gap: 15px;
    width: 100%;
    box-sizing: border-box; /* Garante que o padding não aumente a largura */
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1; /* Ocupa o espaço disponível */
    min-width: 0; /* Permite que o texto quebre */
}

.file-name {
    font-weight: 600;
    color: var(--text);
    word-wrap: break-word; /* Quebra palavras longas */
    overflow-wrap: break-word;
    display: block;
    font-size: 0.95rem;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 📱 AJUSTES PARA CELULAR (Telas menores que 768px) */
@media (max-width: 768px) {
    .file-item {
        flex-direction: column; /* Empilha um em cima do outro */
        align-items: stretch; /* Estica os botões na largura total */
        text-align: left;
    }

    .file-info {
        width: 100%;
        border-bottom: 1px solid var(--border);
        padding-bottom: 10px;
    }

    .file-actions {
        width: 100%;
        justify-content: space-between; /* Botão de um lado, QR do outro */
        padding-top: 5px;
    }

    .btn {
        flex: 1; /* Faz o botão de baixar ocupar mais espaço */
        text-align: center;
        padding: 12px !important; /* Facilita o toque com o dedo */
    }

    .qr-container {
        display: none;
        padding: 4px;
    }

    .qr-code-img {
        width: 60px;  /* QR Code menor no celular para não poluir */
        height: 60px;
        display: none;
    }
}