:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --border-color: #ddd;
    --light-bg: #f8f9fa;
    --light-border: #eee;
    --error-color: #red;
    --success-color: #green;
    --text-color: #333;
    --card-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    background-color: #f5f7fa;
}

h1, h2, h3, h4 {
    color: #2c3e50;
    margin-bottom: 15px;
}

h1 {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.section {
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    background-color: white;
    box-shadow: var(--card-shadow);
}

.subsection {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--light-border);
}

button {
    padding: 10px 15px;
    margin: 5px;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s;
    width: 100%;
}

button:hover {
    background: var(--primary-hover);
}

input, select, textarea {
    padding: 10px;
    margin: 5px 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
    font-family: inherit;
    font-size: 16px; /* Evita zoom em iOS */
}

textarea {
    min-height: 100px;
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    width: 100%;
}

pre {
    background: var(--light-bg);
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
}

.result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    background-color: var(--light-bg);
}

.error {
    color: #e74c3c;
}

.success {
    color: #27ae60;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.card {
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    background-color: white;
    box-shadow: var(--card-shadow);
}

.json-viewer {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 10px 15px;
    cursor: pointer;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    margin-right: 5px;
    margin-bottom: -1px;
    transition: background-color 0.3s;
}

.tab.active {
    background: white;
    border-bottom: 1px solid white;
    font-weight: bold;
    color: var(--primary-color);
}

.tab-content {
    display: none;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 0 4px 4px 4px;
    background-color: white;
}

.tab-content.active {
    display: block;
}

.sortable-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.sortable-table th, .sortable-table td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.sortable-table th {
    background-color: var(--light-bg);
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable-table th:hover {
    background-color: #e9ecef;
}

.sortable-table th.asc {
    background-color: #e3f2fd;
}

.sortable-table th.desc {
    background-color: #e8f5e9;
}

.sortable-table tr:nth-child(even) {
    background-color: var(--light-bg);
}

.sortable-table tr:hover {
    background-color: #f1f3f5;
}

.sortable-header {
    transition: background-color 0.2s;
}

.sortable-header::after {
    content: ' ↕';
    color: #6c757d;
    margin-left: 5px;
    font-size: 12px;
}

.sortable-header.asc::after {
    content: ' ↑';
    color: #0d6efd;
}

.sortable-header.desc::after {
    content: ' ↓';
    color: #198754;
}

.form-group {
    margin-bottom: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.checkbox-group input {
    width: auto;
    margin-right: 8px;
}

.inline-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.inline-group > * {
    flex: 1;
    min-width: 120px;
}

.user-info {
    background-color: #e8f5e9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.user-info h4 {
    margin-top: 0;
    color: #2e7d32;
}

.user-info p {
    margin-bottom: 5px;
}

/* Media queries para responsividade */
@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    button {
        width: auto;
        min-width: 120px;
    }
    
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}

@media (min-width: 992px) {
    body {
        padding: 20px;
    }
    
    .section {
        padding: 20px;
    }
}

/* Estilos para o modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #ddd;
    text-decoration: none;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
    text-align: right;
}

.modal-footer button {
    margin-left: 10px;
}

/* Estilos para a tabela de resultados */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.results-table th, .results-table td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.results-table th {
    background-color: var(--light-bg);
    font-weight: bold;
}

.results-table tr:nth-child(even) {
    background-color: var(--light-bg);
}

.results-table tr:hover {
    background-color: #f1f3f5;
    cursor: pointer;
}

.results-table tr.selected {
    background-color: #e3f2fd;
}

/* Adicione este CSS ao seu arquivo de estilos */
button.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

button.disabled:hover {
    background-color: var(--primary-color, #007bff);
}

/* Container para tabelas com rolagem horizontal */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin: 15px 0;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Estilos para tabelas */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    font-size: 14px;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
    white-space: nowrap; /* Impede quebra de linha */
}

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

table tr:hover {
    background-color: #f8f9fa;
}

/* Indicador de rolagem horizontal */
.table-responsive::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.9));
    pointer-events: none;
    z-index: 5;
}

/* Para telas pequenas */
@media (max-width: 768px) {
    .table-responsive {
        margin: 10px 0;
        border-radius: 5px;
    }
    
    table th, table td {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Botão para mostrar/ocultar colunas em dispositivos móveis */
.column-toggle-container {
    margin: 10px 0;
    display: none;
}

@media (max-width: 768px) {
    .column-toggle-container {
        display: block;
    }
}

.column-toggle-btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px 10px;
    margin-right: 5px;
    margin-bottom: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.column-toggle-btn:hover {
    background-color: #e9ecef;
}

.column-toggle-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Estilo para linhas da tabela clicáveis */
table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

table tbody tr:hover {
    background-color: #f0f7ff;
}

/* Indicador visual para linhas clicáveis */
table tbody tr::after {
    content: "Clique duplo para editar";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

table tbody tr:hover::after {
    opacity: 1;
}

/* Para telas pequenas, ocultar o indicador */
@media (max-width: 768px) {
    table tbody tr::after {
        display: none;
    }
}