/* Reset e Estilos Globais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5530;
    --secondary-color: #4a7c59;
    --accent-color: #8b9a46;
    --text-color: #000000;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: #2c2c2c;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-logo-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

header h1 {
    margin: 0;
    font-size: 1.2rem;
}

header h1 .title-short {
    display: none;
}

/* Menu Hambúrguer */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 4px;
    z-index: 1002;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-weight: 500;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px; /* padrão: cantos arredondados */
}

nav {
    transition: max-height 0.3s ease;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    position: relative;
    margin: 0;
    padding: 0;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 0.7em;
    margin-left: 0.3rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2c2c2c;
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border-radius: 4px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    z-index: 1001;
    list-style: none;
}

.dropdown-menu li {
    margin: 0;
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.dropdown-menu a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto; /* centralizado */
    padding: 2rem;
    flex: 1;
    /* Ajustar padding para não ficar escondido atrás do header e footer fixos */
    margin-top: 150px; /* Altura aproximada do header */
    margin-bottom: 80px; /* Altura aproximada do footer */
    min-height: calc(100vh - 230px); /* Altura total menos header e footer */
}

/* Páginas de autenticação não devem ter margin-top/bottom */
body.auth-page main,
body.auth-page {
    margin-top: 0;
    margin-bottom: 0;
    min-height: auto;
}

body.auth-page header,
body.auth-page footer {
    display: none;
}

.section {
    display: none;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.section.active {
    display: block;
}

.section h2 {
    color: #000000;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

/* Dashboard Container - Layout em Colunas */
.dashboard-container {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    align-items: flex-start;
}

/* Dashboard Column - Cada coluna vertical */
.dashboard-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* Permite que as colunas encolham se necessário */
}

.dashboard-column h3 {
    color: #000000;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    text-align: center;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    /* Para manter todos os cards com o mesmo tamanho visual */
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.card h3,
.card h4 {
    color: #000000;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.card h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.card .number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #000000;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px; /* padrão: cantos arredondados */
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.2s;
}

.btn-primary {
    background-color: #a0a0a0; /* cinza claro */
    color: white;
    border-radius: 8px; /* cantos mais arredondados */
}

.btn-primary:hover {
    background-color: #2c2c2c; /* cinza escuro no hover */
    transform: scale(1.05);
}

.btn-secondary {
    background-color: #a0a0a0; /* cinza claro - mesmo padrão do btn-primary */
    color: white;
    border-radius: 8px; /* cantos arredondados */
}

.btn-secondary:hover {
    background-color: #2c2c2c; /* cinza escuro no hover */
    transform: scale(1.05);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border-radius: 8px; /* padrão: cantos arredondados */
}

.btn-danger:hover {
    background-color: #c82333;
    transform: scale(1.05);
}

/* Actions */
.actions {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.search-container {
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #2c2c2c;
    box-shadow: 0 0 0 2px rgba(44, 44, 44, 0.2);
}

.search-input::placeholder {
    color: #999;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background-color: #888888;
    color: white;
}

th {
    padding: 0.6rem 1rem; /* mais fino que antes */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

th.sortable .sort-icon {
    font-size: 0.8em;
    margin-left: 0.5rem;
    opacity: 0.5;
    display: inline-block;
    transition: opacity 0.2s;
}

th.sortable:hover .sort-icon {
    opacity: 1;
}

th.sortable.sort-asc .sort-icon::after {
    content: ' ↑';
    opacity: 1;
}

th.sortable.sort-desc .sort-icon::after {
    content: ' ↓';
    opacity: 1;
}

th.sortable.sort-asc .sort-icon,
th.sortable.sort-desc .sort-icon {
    opacity: 1;
}

td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

/* Cantos arredondados no cabeçalho */
thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

/* Tabela de Classificações - Prioridade de largura para coluna Nome */
#tabela-classificacoes th:nth-child(1),
#tabela-classificacoes td:nth-child(1) {
    width: 5%; /* ID - menor largura */
}

#tabela-classificacoes th:nth-child(2),
#tabela-classificacoes td:nth-child(2) {
    width: 25%; /* Nome - prioridade de largura */
    min-width: 150px;
}

#tabela-classificacoes th:nth-child(3),
#tabela-classificacoes td:nth-child(3) {
    width: 40%; /* Descrição - largura flexível */
}

#tabela-classificacoes th:nth-child(4),
#tabela-classificacoes td:nth-child(4) {
    width: 10%; /* Status - largura fixa */
}

#tabela-classificacoes th:nth-child(5),
#tabela-classificacoes td:nth-child(5) {
    width: 10%; /* Ações - largura fixa */
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: var(--text-color);
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.2);
}

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    height: 20px;
    width: 20px !important;
    min-width: 20px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    accent-color: #2c2c2c;
}

.checkbox-label span {
    font-weight: 500;
    color: var(--text-color);
    user-select: none;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Footer */
footer {
    background-color: #2c2c2c;
    color: white;
    text-align: center;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

/* Action Icons */
.action-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
    transition: transform 0.2s, opacity 0.2s;
    color: #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.action-icon:hover {
    transform: scale(1.2);
    opacity: 0.8;
    background-color: rgba(0, 0, 0, 0.1);
}

.action-icon.edit {
    color: #555555;
}

.action-icon.edit:hover {
    color: #2c2c2c;
    background-color: rgba(85, 85, 85, 0.1);
}

.action-icon.delete {
    color: #dc3545;
}

.action-icon.delete:hover {
    color: #c82333;
    background-color: rgba(220, 53, 69, 0.1);
}

.action-icons-container {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 0;
    }

    .header-logo-title {
        flex: 1;
        gap: 0.5rem;
        min-width: 0; /* Permite que o texto seja cortado */
    }

    .header-logo {
        height: 35px;
        flex-shrink: 0;
    }

    header h1 {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    header h1 .title-full {
        display: none;
    }

    header h1 .title-short {
        display: inline;
    }

    .menu-toggle {
        display: flex;
        margin-right: 0.5rem;
        flex-shrink: 0;
    }

    .user-info {
        flex-shrink: 0;
        gap: 0.5rem;
    }

    .user-info span {
        display: none;
    }

    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    nav {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        width: 100%;
    }

    nav.active {
        max-height: 1000px;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        width: 100%;
    }

    nav ul li {
        width: 100%;
    }

    nav a {
        display: block;
        padding: 0.75rem 1rem;
        width: 100%;
    }

    /* Dropdown em mobile */
    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        margin-top: 0;
        padding-left: 1rem;
        background-color: rgba(0, 0, 0, 0.2);
        width: 100%;
    }

    .dropdown.active .dropdown-menu {
        display: block;
    }

    /* Em telas pequenas, colunas viram uma única coluna */
    .dashboard-container {
        flex-direction: column;
        gap: 2rem;
    }

    main {
        padding: 120px 1rem 2rem 1rem; /* Top para compensar header, laterais reduzidas */
    }

    /* Actions responsivo */
    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    /* Layout de duas colunas para permissões */
    .permissoes-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-top: 1rem;
    }

    .permissoes-column {
        display: flex;
        flex-direction: column;
    }

    .permissoes-column h3 {
        margin-bottom: 0.5rem;
        color: #000000;
        font-size: 1.2rem;
    }

    .permissoes-column p {
        margin-bottom: 1rem;
        color: #666;
        font-size: 0.9rem;
    }

    @media (max-width: 1024px) {
        .permissoes-grid {
            grid-template-columns: 1fr;
            gap: 2rem;
        }
    }

    .search-container {
        width: 100%;
    }

    .search-input {
        width: 100%;
        min-width: auto;
    }
}

