/* Estilos Gerais */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
}

.logo img {
    max-width: 200px;
    height: auto;
    margin-bottom: 10px;
}

h1 {
    color: #1e3a8a;
    margin: 0;
    font-size: 2em;
}

/* Filtros */
.filters-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.btn-primary {
    background-color: #1e3a8a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
    height: 40px;
}

.btn-primary:hover {
    background-color: #0a192f;
}

/* Resultados */
.results-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    margin: 0;
    color: #1e3a8a;
}

.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.printer-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

.btn-action {
    background-color: #1e90ff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

.btn-action:hover {
    background-color: #0066cc;
}

/* Grid de Tickets */
/* Substitua a seção de .ticket-card no consulta.css por: */
.ticket-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    box-sizing: border-box;
}

.ticket-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.ticket-header img {
    max-width: 140px;
    margin-bottom: 10px;
}

.ticket-day {
    font-weight: bold;
    color: #1e3a8a;
    background-color: rgba(30, 58, 138, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.ticket-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ticket-info {
    margin-bottom: 10px;
}

.ticket-info p {
    margin: 10px 0;
    line-height: 1.5;
    font-size: 1rem;
}

.ticket-info strong {
    font-weight: 600;
    color: #0a192f;
    min-width: 100px;
    display: inline-block;
}

.ticket-qr {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background-color: #f9f9f9;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.ticket-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    gap: 10px; /* Adiciona espaçamento entre os elementos */
}
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap; /* Evita quebra do texto "Selecionar" */
}

.ticket-actions .btn-action {
    flex: 1; /* Faz o botão ocupar o espaço disponível */
    text-align: center;
    padding: 8px 5px; /* Ajuste o padding para caber melhor */
    white-space: nowrap; /* Evita quebra de linha */
}

.checkbox-container label {
    font-size: 0.9rem;
    cursor: pointer;
}

/* Ajuste no grid para centralizar os cards */
#results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    justify-items: center;
}

/* Mantenha os outros estilos existentes */

/* Loading */
.loading-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #1e3a8a;
}

.loading-spinner {
    border: 4px solid rgba(30, 58, 138, 0.1);
    border-top: 4px solid #1e3a8a;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensagens */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

/* Responsividade */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: flex-start;
    }
    
    #results-grid {
        grid-template-columns: 1fr;
    }
}

/* Estilo do ticket para impressão */
@media print {
    body * {
        visibility: hidden;
    }
    
    .ticket-card, .ticket-card * {
        visibility: visible;
    }
    
    .ticket-card {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        height: auto;
        margin: 0;
        padding: 10mm;
        box-shadow: none;
        border: none;
        page-break-after: always;
    }
    
    .ticket-actions, .printer-select, .btn-action {
        display: none !important;
    }
    
    .ticket-qr {
        height: 150px;
    }
}
/* Consulta inteligente */
.empty-search-state,
.no-results,
.search-summary {
    grid-column: 1 / -1;
}

.empty-search-state,
.no-results {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 38px 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
    color: #475569;
}

.empty-search-state h3 {
    margin: 8px 0 6px;
    color: #0f172a;
    font-size: 1.2rem;
}

.empty-search-icon {
    font-size: 2rem;
    line-height: 1;
}

.no-results {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.no-results strong {
    color: #0f172a;
    font-size: 1.05rem;
}

.search-summary {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

mark {
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    padding: 0 4px;
}

#filter-search {
    min-width: 260px;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #0f172a;
        color: #e5e7eb;
    }

    .filters-container,
    .results-container,
    .ticket-card {
        background: #111827;
        color: #e5e7eb;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
        border: 1px solid rgba(148, 163, 184, 0.18);
    }

    h1,
    .results-header h2,
    .ticket-day,
    .ticket-info strong,
    .empty-search-state h3,
    .no-results strong {
        color: #f8fafc;
    }

    .filter-group label,
    .ticket-info p,
    .empty-search-state,
    .no-results {
        color: #cbd5e1;
    }

    .filter-group select,
    .filter-group input,
    .printer-select {
        background: #0b1220;
        color: #f8fafc;
        border-color: #334155;
    }

    .ticket-header,
    .ticket-actions {
        border-color: rgba(148, 163, 184, 0.2);
    }

    .ticket-qr {
        background: #ffffff;
    }

    .empty-search-state,
    .no-results {
        background: #0b1220;
        border-color: #334155;
    }

    .search-summary {
        background: rgba(37, 99, 235, 0.16);
        color: #bfdbfe;
        border-color: rgba(96, 165, 250, 0.3);
    }

    mark {
        background: rgba(250, 204, 21, 0.22);
        color: #fde68a;
    }
}

/* Mobile polish - consulta */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .container {
    width: min(100% - 16px, 1180px) !important;
    padding: 12px 0 20px !important;
  }
  header {
    text-align: center !important;
    border-radius: 24px !important;
    padding: 20px !important;
  }
  header .logo img,
  .logo img {
    width: min(78vw, 250px) !important;
    max-height: 120px !important;
    object-fit: contain;
  }
  .filters-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    border-radius: 22px !important;
    padding: 14px !important;
  }
  .filter-group,
  .filter-group input,
  .filter-group select,
  #apply-filters {
    width: 100% !important;
  }
  .results-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .action-buttons {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .btn-primary, .btn-action, .printer-select {
    width: 100% !important;
    min-height: 46px !important;
  }
  #results-grid {
    grid-template-columns: 1fr !important;
  }
  input, select, textarea, button { font-size: 16px !important; }
}
