/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

header h1 {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

/* Formulário de Busca */
.search-form {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.search-form form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 20px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
    font-size: 0.95em;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Botão Buscar */
.btn-buscar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-buscar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-buscar:active {
    transform: translateY(0);
}

/* Status da Busca */
.status-section {
    margin-bottom: 25px;
}

.status-message {
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    border: 1px solid;
}

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

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

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

/* Seção de Resultados */
.results-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.results-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h2 {
    color: #495057;
    font-size: 1.5em;
    font-weight: 600;
}

.btn-refresh {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Container da Tabela */
.results-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

/* Tabela de Resultados */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.results-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.results-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.results-table tbody tr {
    transition: all 0.2s ease;
}

.results-table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
}

/* Linha principal (clicável) */
.main-row {
    cursor: pointer;
    transition: all 0.3s ease;
}

.main-row:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Linha de detalhes */
.details-row {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
}

.details-content {
    padding: 15px 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-item strong {
    color: #495057;
    margin-right: 8px;
}

/* Botão do WhatsApp */
.btn-whatsapp {
    background-color: #25d366;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-whatsapp:hover {
    background-color: #20ba5a;
    transform: translateY(-2px);
}

.btn-whatsapp:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Ícone do WhatsApp */
.whatsapp-icon {
    font-size: 1.1em;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Resultados vazios */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
    font-size: 1.1em;
}

/* Contador de resultados */
.results-count {
    padding: 15px 30px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
    font-weight: 500;
    color: #495057;
}

/* Loading spinner */
.btn-loading {
    display: none;
}

.btn-buscar.loading .btn-text {
    display: none;
}

.btn-buscar.loading .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   RESPONSIVIDADE MOBILE
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin: 10px;
        border-radius: 8px;
    }

    header {
        padding: 15px;
        border-radius: 8px;
    }

    header h1 {
        font-size: 1.6em;
        margin-bottom: 8px;
    }

    header p {
        font-size: 0.9em;
    }

    .search-form {
        padding: 20px;
    }

    .search-form form {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .results-header h2 {
        font-size: 1.3em;
    }

    /* Ajustes na tabela para mobile */
    .results-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #resultsTable {
        min-width: 300px;
        font-size: 0.9em;
    }

    #resultsTable th, #resultsTable td {
        padding: 8px 10px;
    }

    /* Manter apenas Nome e Ações no mobile */
    #resultsTable th:nth-child(2),
    #resultsTable td:nth-child(2),
    #resultsTable th:nth-child(3),
    #resultsTable td:nth-child(3) {
        display: none;
    }

    /* Ajustes no botão WhatsApp para mobile */
    .btn-whatsapp {
        padding: 8px 12px;
        font-size: 0.8em;
        gap: 6px;
        min-width: 80px;
    }

    /* Detalhes expansíveis em mobile */
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .detail-item {
        padding: 6px 0;
        font-size: 0.9em;
    }

    /* Linha principal em mobile */
    #resultsTable tbody tr.main-row td:first-child {
        padding-left: 8px;
    }

    /* Ajustes nos detalhes */
    #resultsTable tbody tr.details-row td {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        margin: 5px;
    }

    header h1 {
        font-size: 1.4em;
    }

    .search-form {
        padding: 15px;
    }

    #resultsTable th, #resultsTable td {
        padding: 6px 8px;
        font-size: 0.85em;
    }

    .btn-whatsapp {
        padding: 6px 10px;
        font-size: 0.75em;
        gap: 4px;
        min-width: 70px;
    }

    .results-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .btn-refresh {
        align-self: stretch;
        justify-content: center;
    }

    /* Detalhes em telas muito pequenas */
    .detail-item strong {
        display: block;
        margin-bottom: 2px;
    }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar customizada */
.results-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.results-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.results-table-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.results-table-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}