/* =======================================================
    1. VARIÁVEIS & RESET
   ======================================================= */
:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --success-color: #27ae60;
    --success-hover: #219150;
    --danger-color: #e74c3c;
    --bg-color: #2c3e50;
    --text-color: #34495e;
    --border-color: #bdc3c7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Alinha no topo */
    min-height: 100vh;
    padding-top: 80px;
    /* Espaço para a navbar */
    padding-bottom: 40px;
    font-size: 14px;
    /* <--- FONTE MENOR GERAL */
}

/* Força a tabela a ter barra de rolagem no celular em vez de esconder */
.table-wrapper {
    width: 100%;
    overflow-x: auto; /* Permite rolar para o lado */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Garante que a tabela tenha um tamanho mínimo para não espremer */
table {
    min-width: 600px; /* Ajuste conforme a necessidade */
}

/* =======================================================
    2. COMPONENTES GERAIS
   ======================================================= */
.card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    width: 100%;
    display: flex;
    flex-direction: column;
}

h2,
h3 {
    color: var(--text-color);
    margin-bottom: 0.8rem;
    font-weight: 700;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.1rem;
}

form {
    width: 100%;
}

.form-group {
    margin-bottom: 0.8rem;
    width: 100%;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.3rem;
    color: #7f8c8d;
    font-weight: 600;
    font-size: 0.85rem;
}

input,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
    transition: 0.3s;
    background-color: #fcfcfc;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

button {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
}

.btn-danger {
    background-color: var(--danger-color);
}

/* =======================================================
    3. MODOS DE TELA (LOGIN vs ADMIN)
   ======================================================= */
.login-mode {
    max-width: 400px;
    align-items: center;
    margin-top: 50px;
}

.logo-container {
    width: 100px;
    height: 100px;
    background-color: #ecf0f1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    border: 4px solid #bdc3c7;
    overflow: hidden;
}

.logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-mode {
    width: 98%;
    max-width: 1800px;
    margin: 0 auto;
}

/* =======================================================
    4. LAYOUTS INTERNOS (GRID)
   ======================================================= */

.admin-controls {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.config-card {
    background: #fdfdfd;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

.config-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 5px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 30px;
    width: 100%;
    margin-bottom: 20px;
    align-items: end;
}

.item-list {
    flex-grow: 1;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #eee;
    background: white;
    border-radius: 4px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.85rem;
}

.list-item:hover {
    background-color: #f9f9f9;
}

.action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 4px;
    font-size: 1rem;
    background: transparent;
    color: #7f8c8d;
}

.action-btn:hover {
    background-color: #ecf0f1;
    color: var(--primary-color);
}

.btn-del:hover {
    color: var(--danger-color);
}

.tag-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #666;
    margin-left: 5px;
}

/* =======================================================
   5. TABELA DE USUÁRIOS (FIXA E ELEGANTE)
   ======================================================= */
.table-responsive {
    width: 100%;
    max-height: calc(100vh - 350px);
    min-height: 300px;
    overflow-y: auto;

    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
}

.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

.table-responsive::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

table th {
    background-color: #34495e;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 15px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid #2c3e50;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
    color: #333;
    background-color: white;
}

table tr:nth-child(even) td {
    background-color: #f8f9fa;
}

table tr:hover td {
    background-color: #e8f6ff;
    transition: 0.2s;
}

table th:first-child {
    border-top-left-radius: 4px;
}

table th:last-child {
    border-top-right-radius: 4px;
    width: 100px;
    text-align: center;
}

table td:last-child {
    text-align: center;
}

.tag-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #ccc;
    color: #666;
    margin-left: 8px;
    vertical-align: middle;
}

/* =======================================================
    6. NAVBAR
   ======================================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.navbar-brand {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title {
    font-weight: 300;
    color: #bdc3c7;
    border-left: 1px solid #555;
    padding-left: 15px;
    font-size: 0.95rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: 0.2s;
}

.user-avatar:hover {
    border-color: white;
    transform: scale(1.05);
}

.user-menu-container {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background: white;
    min-width: 220px;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
    flex-direction: column;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #f9f9f9;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: #f5f5f5;
    color: var(--primary-color);
}

.dropdown-item.danger:hover {
    background: #fff5f5;
    color: var(--danger-color);
}

/* =======================================================
    RESPONSIVIDADE (CELULAR)
   ======================================================= */
@media (max-width: 768px) {
    .admin-controls {
        grid-template-columns: 1fr;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-mode {
        width: 100%;
        padding: 0 10px;
    }

    .navbar {
        padding: 0 15px;
    }

    .page-title {
        display: none;
    }
}

.forgot-btn {
    background: none;
    border: none;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 15px;
    cursor: pointer;
    text-decoration: underline;
    transition: 0.3s;
    width: auto;
    display: inline-block;
}

.forgot-btn:hover {
    color: var(--primary-color);
}

.alert-card {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.alert-title {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.request-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e2e3e5;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}