/* Base Styles */
:root {
  --primary-color: #4a4a4a;
  --secondary-color: #6c6c6c;
  --accent-color: #333333;
  --light-gray: #f5f5f5;
  --medium-gray: #e0e0e0;
  --dark-gray: #9e9e9e;
  --danger-color: #e53935;
  --success-color: #43a047;
  --text-color: #333333;
  --text-light: #ffffff;
  --border-radius: 4px;
  --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --sidebar-width: 250px;
}

/* Modern Black, White & Gray Theme - Responsivo */

:root {
  --primary: #222;
  --primary-dark: #111;
  --secondary: #444;
  --background: #f7f7f7;
  --surface: #fff;
  --text: #222;
  --text-light: #fff;
  --danger: #e53935;
  --success: #43a047;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(30, 42, 73, 0.08);
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
  --sidebar-width: 80px;
  --sidebar-expanded: 220px;
  --gray-light: #f0f0f0;
  --gray-medium: #d1d1d1;
  --gray-dark: #555;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  background-color: var(--light-gray);
  line-height: 1.6;
}

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 10;
  background: var(--primary);
}
.sidebar:hover,
.sidebar:focus-within {
  width: var(--sidebar-expanded);
}

.logo-container {
  margin: 32px 0;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

.main-nav ul {
  list-style: none;
  width: 100%;
  padding: 0;
}

.main-nav li {
  width: 100%;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 1.1em;
  border-left: 4px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

.main-nav a .icon {
  font-size: 1.4em;
}

.main-nav a.active,
.main-nav a:hover {
  background: rgba(255,255,255,0.08);
  border-left: 4px solid var(--gray-medium);
}

.sidebar-footer {
  margin-top: auto;
  padding: 24px 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

.btn, button {
  background: linear-gradient(90deg, var(--primary), var(--gray-dark));
  color: var(--text-light);
  border: none;
  border-radius: var(--radius);
  padding: 10px 24px;
  font-size: 1em;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 8px rgba(34,34,34,0.08);
}

.btn:hover, button:hover {
  background: linear-gradient(90deg, var(--gray-dark), var(--primary));
  transform: translateY(-2px) scale(1.03);
}

.btn-outline, .sidebar-footer .btn-outline {
  background: #fff !important;
  color: var(--primary) !important;
  border: 2px solid var(--primary);
  font-weight: bold;
}

.btn-outline:hover, .sidebar-footer .btn-outline:hover {
  background: var(--primary);
  color: #fff !important;
}

.btn-danger {
  background: var(--danger);
  color: var(--text-light);
}

.btn-danger:hover {
  background: #b71c1c;
}

.main-content {
  margin-left: 220px;
  padding: 40px 5vw 40px 5vw;
  transition: margin-left 0.2s;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--gray-medium);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-content, .dashboard-content, .fragments-content, .locations-content, .history-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
}

.profile-card, .stat-card, .table-container, .location-container, .no-data-message {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  transition: box-shadow var(--transition), transform var(--transition);
  box-sizing: border-box;
}

.profile-card:hover, .stat-card:hover, .table-container:hover {
  box-shadow: 0 8px 32px rgba(30,42,73,0.12);
  transform: translateY(-2px) scale(1.01);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
  display: inline-block;
}

.profile-details h2 {
  margin-bottom: 4px;
  font-size: 1.4em;
}

.profile-details p {
  color: var(--gray-dark);
  margin-bottom: 2px;
}

.profile-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.form-group {
  margin-bottom: 18px;
  width: 100%;
  min-width: 0;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--gray-dark);
}

.form-group input,
.form-group select {
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-medium);
  border-radius: var(--radius);
  font-size: 1em;
  background: var(--gray-light);
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(34,34,34,0.08);
  outline: none;
}

.form-message, .error-message {
  color: var(--danger);
  margin-bottom: 12px;
  font-size: 1em;
}

.form-message.success {
  color: var(--success);
}

.table-container {
  width: 100%;
  max-width: 100vw;
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 auto;
  padding: 0;
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  background: var(--surface);
}

th, td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
  word-break: break-word;
}

th {
  background: var(--gray-light);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(34,34,34,0.18);
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
    border-radius: 12px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 32px;
  width: 95vw;
  max-width: 420px;
  position: relative;
  animation: modalIn 0.3s;
  box-sizing: border-box;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-40px);}
  to { opacity: 1; transform: translateY(0);}
}

.close-modal {
  position: absolute;
  right: 18px;
  top: 12px;
  font-size: 1.6em;
  color: var(--gray-dark);
  cursor: pointer;
}

/* styles.css - bloco extra para histórico simples */
#counts-history-container .filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
#counts-history-container .filter-bar input,
#counts-history-container .filter-bar select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d1d1d1;
  font-size: 1em;
}
#counts-table th, #counts-table td {
  text-align: left;
  padding: 10px 8px;
}
#counts-table th {
  cursor: pointer;
  background: #f0f0f0;
}
@media (max-width: 700px) {
  #counts-history-container .filter-bar {
    flex-direction: column;
    gap: 6px;
  }
  #counts-table th, #counts-table td {
    padding: 6px 4px;
    font-size: 0.95em;
  }
}

/* RESPONSIVIDADE */
@media (max-width: 900px) {
  .main-content {
    padding: 24px 2vw;
  }
  .profile-card, .stat-card, .table-container, .location-container {
    max-width: 98vw;
    padding: 20px;
  }
}

@media (max-width: 700px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -100vw; /* Escondido fora da tela */
    width: 70vw;
    max-width: 320px;
    height: 100vh;
    background: var(--primary);
    flex-direction: column; /* Mantém vertical */
    align-items: flex-start;
    transition: left 0.3s;
    z-index: 150;
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    padding-top: 32px;
  }
  .sidebar.open {
    left: 0; /* Mostra o menu */
  }
  .main-nav ul {
    flex-direction: column;
    width: 100%;
  }
  .main-nav li {
    width: 100%;
  }
  .main-nav a {
    width: 100%;
    padding: 14px 24px;
    border-left: 4px solid transparent;
    border-bottom: none;
    font-size: 1.1em;
  }
  .sidebar-footer {
    width: 100%;
    padding: 24px 0;
    display: flex;
    justify-content: center;
  }
  .main-content {
    margin-left: 0 !important;
    padding-top: 24px !important;
  }
  body.menu-open::before {
    content: "";
    position: fixed;
    z-index: 100;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.25);
    pointer-events: all;
  }
}

/* Cards e tabelas ocupam toda a largura */
@media (max-width: 700px) {
  .profile-card, .stat-card, .table-container, .location-container {
    max-width: 100vw;
    padding: 8px;
    border-radius: 0;
    box-shadow: none;
  }
  .profile-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .profile-avatar {
    margin-bottom: 6px;
    width: 56px;
    height: 56px;
    font-size: 1.5em;
  }
  .profile-actions {
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }
  table {
    min-width: 400px;
    font-size: 0.95em;
  }
}

/* Tabela rola horizontalmente no mobile */
.table-container {
  overflow-x: auto;
  width: 100%;
}
table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  background: var(--surface);
}
th, td {
  padding: 10px 6px;
  word-break: break-word;
}

/* Ajuste para filtros e formulários */
@media (max-width: 700px) {
  .filter-bar,
  .user-form,
  .location-form,
  .admin-actions {
    flex-direction: column !important;
    gap: 6px !important;
    width: 100%;
  }
  .filter-bar input,
  .filter-bar select {
    width: 100%;
    min-width: 0;
  }
  .form-group input,
  .form-group select {
    width: 100%;
    min-width: 0;
  }
}

/* Modal ocupa quase toda a tela */
@media (max-width: 600px) {
  .modal-content {
    padding: 8px;
    width: 98vw;
    max-width: 98vw;
  }
}

.menu-toggle {
  position: absolute;
  right: 0;
  background: #000;
  color: #fff;
  border: none;
  font-size: 28px;
  border-radius: 8px;
  padding: 4px 12px;
  z-index: 201;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: none;
  right: 3px;
}

@media (max-width: 700px) {
  .menu-toggle {
    display: block;
  }
  .content-header {
    padding-right: 48px; /* espaço para o botão */
  }
}

.stats-container {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 32px;
}
.stat-card {
  flex: 1 1 180px;
  min-width: 180px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 16px;
  text-align: center;
  margin: 0 0 12px 0;
  transition: box-shadow 0.2s;
}
.stat-card h3 {
  font-size: 1.1em;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 600;
}
.stat-card p {
  font-size: 2.2em;
  color: var(--secondary);
  margin: 0;
  font-weight: 700;
}
@media (max-width: 900px) {
  .stats-container {
    flex-direction: column;
    gap: 12px;
  }
  .stat-card {
    min-width: 0;
    width: 100%;
  }
}
.recent-fragments .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
