/* ================================================
   ADMIN.CSS — Painel Administrativo, Tabela,
               Filtros e FAB Admin
   Midnight Edition | MinhaRua App
   ================================================ */

/* ================= VARIÁVEIS DO ADMIN ================= */
:root {
    --admin-bg-primary: #121212;
    --admin-bg-secondary: #1a1a1a;
    --admin-border-accent: #39ff14;
    --admin-border-muted: #2a2a2a;
    --admin-text-primary: #ffffff;
    --admin-text-muted: #b0b0b0;
    --admin-highlight: #39ff14;
    --admin-highlight-bg: rgba(57, 255, 20, 0.1);
    --admin-hover-bg: rgba(57, 255, 20, 0.1);
    --admin-input-bg: #121212;
    --admin-shadow-glow: 0 0 8px #39ff14;
}

[data-tema="claro"] {
    --admin-bg-primary: #ffffff;
    --admin-bg-secondary: #f9fafb;
    --admin-border-accent: #e5e7eb;
    --admin-border-muted: #e5e7eb;
    --admin-text-primary: #1f2937;
    --admin-text-muted: #6b7280;
    --admin-highlight: #0ea5e9;
    --admin-highlight-bg: rgba(14, 165, 233, 0.1);
    --admin-hover-bg: rgba(14, 165, 233, 0.05);
    --admin-input-bg: #ffffff;
    --admin-shadow-glow: none;
}

/* Redesign - Tema Claro */
[data-tema="claro"] .tabela-admin thead th {
    background-color: #f1f5f9;
    color: #1e293b;
    border-bottom: 2px solid #cbd5e1;
}
[data-tema="claro"] .tabela-admin tbody tr {
    background-color: #ffffff;
    color: #1e293b;
}
[data-tema="claro"] .tabela-admin tbody td {
    border-bottom: 1px solid #e2e8f0;
    color: #111827;
}
[data-tema="claro"] .tabela-admin tbody tr:hover {
  background-color: #e2e8f0 !important;
}

[data-tema="claro"] #painel-admin-modal .tabela-admin td {
  color: #111827 !important;
}

/* ================= REDESIGN MODAL (MODERNO) ================= */
#painel-admin-modal .admin-box {
    border-radius: 16px;
    background-color: #1e2433;
    border: 1px solid #2d3748;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    width: 95vw !important;
    max-width: 1400px !important;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    color: #e2e8f0;
}

#painel-admin-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px 25px;
    background: transparent;
    border-bottom: 1px solid #2d3748;
}

#painel-admin-modal .modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

.btn-fechar-x {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s ease;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-fechar-x:hover {
    color: #ef4444;
    transform: scale(1.1);
}

/* ================= TABS DO ADMIN ================= */
.admin-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #2d3748;
    overflow-x: auto;
    padding: 0 20px;
}

.admin-tab-btn {
  color: #9ca3af;
  border-bottom: 2px solid transparent;
  background: none;
  border: none;
  padding: 14px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.admin-tab-btn.active {
  color: #e2e8f0;
  border-bottom: 2px solid #3b82f6;
}

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

@media (max-width: 768px) {
    .admin-tabs { gap: 5px; margin-bottom: 15px; }
    .admin-tab-btn { padding: 10px 15px; font-size: 0.85rem; }
}

/* ================= BARRA DE FILTROS ================= */
.admin-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 12px 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 0.85rem; font-weight: 600; color: #718096; }

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #4a5568;
    border-radius: 8px;
    background: #2d3748;
    color: #ffffff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.filter-group select:hover,
.filter-group input:hover { border-color: #3b82f6; }

.btn-filtrar-admin {
    background: #3b82f6;
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-filtrar-admin:hover { background: #2563eb; }

.filter-stats { margin-left: auto; font-size: 0.85rem; color: #718096; }
.filter-stats span { color: #ffffff; font-weight: 700; }

/* ================= CORPO E TABELA ================= */
.admin-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.tabela-container {
    overflow-x: auto;
}

.tabela-admin {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

#painel-admin-modal .tabela-admin thead th {
    background-color: #1a202c;
    color: #718096;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    padding: 10px 6px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #2d3748;
}

#painel-admin-modal .tabela-admin tbody tr {
    background-color: transparent;
    border-bottom: 1px solid #2d3748;
}

#painel-admin-modal .tabela-admin tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

#painel-admin-modal .tabela-admin td {
    padding: 10px 6px;
    font-size: 0.8rem;
    overflow: visible;
}

/* Estilo do Protocolo (Badge) */
.badge-protocolo {
    display: inline-block;
    background: #2d3748;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: none;
}
.badge-protocolo:hover { background: #4a5568; }

/* Larguras específicas proporcionais */
.tabela-admin th:nth-child(1), .tabela-admin td:nth-child(1) { width: 80px; text-align: center; } 
.tabela-admin th:nth-child(2), .tabela-admin td:nth-child(2) { width: 120px; }
.tabela-admin th:nth-child(3), .tabela-admin td:nth-child(3) { width: 100px; }
.tabela-admin th:nth-child(4) { width: auto; min-width: 200px; }
#painel-admin-modal .tabela-admin td:nth-child(4) {
  white-space: normal;
  word-break: break-word;
  max-width: 250px;
}
.tabela-admin th:nth-child(5), .tabela-admin td:nth-child(5) { width: 150px; }
.tabela-admin th:nth-child(6), .tabela-admin td:nth-child(6) { width: 100px; }
.tabela-admin th:nth-child(7), .tabela-admin td:nth-child(7) { width: 80px; }
.tabela-admin th:nth-child(8), .tabela-admin td:nth-child(8) { width: 120px; }

#painel-admin-modal .tabela-admin th:nth-child(5),
#painel-admin-modal .tabela-admin th:nth-child(6),
#painel-admin-modal .tabela-admin th:nth-child(7),
#painel-admin-modal .tabela-admin th:nth-child(8),
#painel-admin-modal .tabela-admin td:nth-child(5),
#painel-admin-modal .tabela-admin td:nth-child(6),
#painel-admin-modal .tabela-admin td:nth-child(7),
#painel-admin-modal .tabela-admin td:nth-child(8) {
  text-align: center;
  vertical-align: middle;
}

/* Miniatura da foto */
.thumb-admin {
    width: 48px; height: 48px; object-fit: cover; border-radius: 6px;
    cursor: pointer; transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0s;
    position: relative; z-index: 1;
}
.thumb-admin:hover { transform: scale(2.5); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); z-index: 1000; position: relative; }

.btn-acao-admin {
    width: 38px; height: 38px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; transition: all 0.2s ease;
}

.btn-maps {
  background-color: #3b82f6;
  color: white;
  border-radius: 8px;
  padding: 6px 10px;
  border: none;
  cursor: pointer;
}

.btn-punir {
  background-color: #2d3748;
  color: #e2e8f0;
  border: 1px solid #4a5568;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.btn-excluir {
  background-color: #7f1d1d;
  color: #fecaca;
  border: 1px solid #991b1b;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.btn-excluir:hover {
    background: #b91c1c;
}

/* ================= FAB ADMIN (BOTÃO DE GESTOR) ================= */
.fab-admin {
    position: fixed;
    bottom: 65px; left: 20px;
    width: 60px; height: 60px; border-radius: 16px;
    display: none;
    justify-content: center; align-items: center;
    cursor: pointer; z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-tema="escuro"] .fab-admin {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
[data-tema="escuro"] .fab-admin img { filter: brightness(0) invert(1); }
[data-tema="escuro"] .fab-admin:hover {
    transform: translateY(-4px);
    background: #1e293b;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-tema="claro"] .fab-admin {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}
[data-tema="claro"] .fab-admin:hover {
    transform: translateY(-4px);
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    border-color: #d1d5db;
}