/* ===== TABELAS ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    overflow: hidden; /* Garante que o border-radius funcione */
}

table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

table th {
    background: var(--bg-secondary); /* Priorizando bg-secondary conforme o segundo bloco */
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Arredonda os cantos superiores do cabeçalho quando aplicável */
table thead th:first-child {
    border-top-left-radius: var(--radius-md);
}
table thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

table tr {
    transition: background 0.2s ease;
}

table tr:hover, 
table tbody tr:hover {
    background: var(--bg-primary);
}

table td {
    color: var(--text-secondary);
}

/* ===== LISTAS MODERNAS ===== */
.list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.list-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr auto;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.list-item:hover {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.list-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.list-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== BADGES (Status e Categorias) ===== */
.badge, td .badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--border-light);
    color: var(--text-primary);
    text-align: center;
}

td .badge {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.badge.admin { background: #1976d2; color: white; }
.badge.superadmin { background: #7b1fa2; color: white; }
.badge.user { background: #388e3c; color: white; }
.badge.active { background: #388e3c; color: white; }
.badge.inactive { background: #757575; color: white; }

/* ===== ACTIONS (Botões de Ação) ===== */
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.actions form {
    margin: 0;
    padding: 0;
}

.actions a,
.actions button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
}

.actions a:hover,
.actions button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Estilos de foco para acessibilidade */
.actions a:focus-visible,
.actions button:focus-visible {
    box-shadow: 0 0 0 4px rgba(74,158,255,0.18);
    transform: none;
}

.actions .btn-edit { background: #1976d2; }
.actions .btn-edit:hover { background: #1565c0; }

.actions .btn-delete { background: #d32f2f; }
.actions .btn-delete:hover { background: #b71c1c; }

.actions .btn-view { background: #388e3c; }
.actions .btn-view:hover { background: #2e7d32; }

/* ===== RESPONSIVIDADE ADICIONAL ===== */
@media (max-width: 768px) {
    table {
        font-size: 0.85rem;
    }
    
    table th,
    table td {
        padding: 10px 12px;
    }
    
    .list-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .actions {
        justify-content: flex-start;
    }
}

/* ===== TABELA RESPONSIVA (MOBILE) ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

@media (max-width: 600px) {
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }
.table-responsive1 {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* melhora no iOS */
}

.table-responsive1 table {
  width: 100%;
  min-width: 600px; /* força scroll se a tela for menor */
  border-collapse: collapse;
}

.table-responsive th,
.table-responsive td {
  padding: 8px;
  border: 1px solid #ddd;
  text-align: left;
}
    .table-responsive thead {
        display: none;
    }

    .table-responsive tbody tr {
        margin-bottom: 12px;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-md);
        padding: 10px 12px;
        background: var(--bg-secondary);
    }

    .table-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 6px;
        border-bottom: none;
        gap: 8px;
    }

    .table-responsive tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-primary);
        margin-right: 10px;
        white-space: nowrap;
    }

    /* Garante que o label (data-label) não quebre o layout em telas muito pequenas */
    .table-responsive tbody td:before {
        flex: 0 0 auto;
        max-width: 45%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .table-responsive .actions {
        margin-top: 8px;
        gap: 8px;
    }

/* ===== PAGE HEADER & ACTIONS ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.page-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-primary);
}
.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-actions {
        justify-content: flex-start;
        width: 100%;
    }
    .page-actions .btn-dashboard {
        width: 100%;
    }
}
}
