/* Design moderno e sofisticado com paleta de cinza atualizada */
:root {
  /* Paleta de cinza moderna e sofisticada */
  --background: #fafafa;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-hover: #f5f5f5;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Sombras modernas */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Raios de borda */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

* {
  box-sizing: border-box;
}

/* Adicionando configuração de viewport e zoom responsivo */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  background-color: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 0.875rem;
  margin: 0;
  padding: 0;
  min-width: 320px;
}

/* Login page com design glassmorphism moderno */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #f3f4f6 0%, #9ca3af 50%, #6b7280 100%);
  padding: 20px;
  position: relative;
}

.login-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.05"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.05"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 3rem 2.5rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.company-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-title {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: -0.025em;
}

.login-form .form-control {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background-color: var(--surface);
}

.login-form .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

.btn-login {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-weight: 600;
  letter-spacing: 0.025em;
  width: 100%;
  transition: all 0.2s ease;
  color: white;
  font-size: 1rem;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--accent-hover) 0%, #3730a3 100%);
}

/* Navbar moderna sem bordas visíveis nos links */
.navbar {
  background: rgba(17, 24, 39, 0.95) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.navbar-nav .nav-link {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.8) !important;
  transition: color 0.2s ease;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  color: white !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.navbar-nav .nav-link.active {
  color: white !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

/* Cards modernos com sombras e cantos arredondados */
.menu-card {
  background: var(--surface);
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.menu-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.menu-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border);
}

.menu-card:hover::before {
  transform: scaleX(1);
}

.menu-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.menu-card:hover .menu-icon {
  transform: scale(1.1);
}

.menu-card h3 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.menu-card p {
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Tabelas responsivas com scroll melhorado */
.card {
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.card-body {
  padding: 0;
}

.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  position: relative;
}

.table-responsive {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  border-radius: var(--radius-lg);
}

.table {
  margin-bottom: 0;
  font-size: 0.875rem;
  width: max-content;
  min-width: 100%;
}

.table th {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
  color: white;
  font-weight: 600;
  border: none;
  padding: 16px 20px;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 100;
  white-space: nowrap;
}

.table th:first-child {
  border-top-left-radius: var(--radius-lg);
}

.table th:last-child {
  border-top-right-radius: var(--radius-lg);
}

.table td {
  padding: 16px 20px;
  vertical-align: middle;
  border-color: var(--border-light);
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: var(--surface-hover);
}

.table-hover > tbody > tr:hover > td {
  background-color: rgba(79, 70, 229, 0.05);
}

/* Header fixo responsivo */
.fixed-header {
  background: rgba(250, 250, 250, 0.95) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 1rem 0;
}

.page-title {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.025em;
}

/* Botões modernos */
.btn {
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
  letter-spacing: 0.025em;
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--surface);
}

.btn-outline-secondary:hover {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #3730a3 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
}

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

/* Modal moderno */
.modal-dialog {
  max-width: 800px;
  width: 90%;
  margin: 1rem auto;
}

.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  background: var(--surface);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 1.5rem;
  flex-shrink: 0;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 1rem 1.5rem;
  flex-shrink: 0;
}

.modal-title {
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

/* Ajustando layout interno do modal de filtros */
.filter-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  height: 400px;
}

.filter-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.filter-section h6 {
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.values-container {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--surface-hover);
  min-height: 0;
}

.values-container::-webkit-scrollbar {
  width: 8px;
}

.values-container::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: var(--radius-sm);
}

.values-container::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-sm);
}

.values-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Form controls modernos */
.form-control {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background-color: var(--surface);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

/* Checkboxes modernos */
.form-check-input {
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  transition: all 0.2s ease;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Badges modernos */
.badge {
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  letter-spacing: 0.025em;
}

.bg-secondary {
  background: var(--text-secondary) !important;
}

.bg-primary {
  background: var(--accent) !important;
}

/* Paginação moderna */
.pagination {
  gap: 4px;
}

.page-link {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  padding: 8px 16px;
  transition: all 0.2s ease;
  background: var(--surface);
}

.page-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-1px);
}

.page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Alerts modernos */
.alert {
  border: none;
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  border-left: 4px solid;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-left-color: var(--warning);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  border-left-color: var(--success);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border-left-color: var(--danger);
}

/* Scrollbar personalizada melhorada */
.table-responsive::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}

.table-responsive::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: var(--radius-sm);
  margin: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--text-muted) 0%, var(--text-secondary) 100%);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-light);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--text-secondary) 0%, var(--text-primary) 100%);
}

.table-responsive::-webkit-scrollbar-corner {
  background: var(--border-light);
}

/* Firefox scrollbar */
.table-responsive {
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) var(--border-light);
}

/* Animações suaves */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
.menu-card,
.alert {
  animation: fadeIn 0.3s ease-out;
}

/* Estados de loading */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsividade aprimorada para diferentes tamanhos de tela e zoom */
@media (max-width: 1200px) {
  .table th,
  .table td {
    padding: 12px 16px;
    font-size: 0.8rem;
  }

  .page-title {
    font-size: 1.75rem;
  }
}

@media (max-width: 992px) {
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }

  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 0.75rem;
  }

  .fixed-header {
    padding: 0.75rem 0;
  }
}

@media (max-width: 768px) {
  .login-card {
    padding: 2rem 1.5rem;
    margin: 10px;
  }

  .menu-card {
    margin-bottom: 1rem;
    padding: 2rem 1.5rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 0.7rem;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .table-responsive {
    max-height: calc(100vh - 250px);
  }

  .modal-dialog {
    max-width: 95%;
    margin: 0.5rem auto;
  }

  .filter-sections {
    grid-template-columns: 1fr;
    height: 500px;
    gap: 1rem;
  }

  .modal-header,
  .modal-footer {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 576px) {
  .page-title {
    font-size: 1.25rem;
  }

  .table th,
  .table td {
    padding: 6px 8px;
    font-size: 0.65rem;
  }

  .fixed-header {
    padding: 0.5rem 0;
  }

  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .modal-dialog {
    max-width: 98%;
    margin: 0.25rem auto;
  }

  .filter-sections {
    height: 450px;
  }
}

/* Suporte para zoom do navegador */
@media (min-resolution: 1.5dppx) {
  body {
    font-size: 0.8rem;
  }

  .table th,
  .table td {
    padding: 12px 16px;
  }
}

@media (min-resolution: 2dppx) {
  body {
    font-size: 0.75rem;
  }

  .table th,
  .table td {
    padding: 10px 14px;
  }
}

/* Melhorias para telas muito grandes */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }

  .table th,
  .table td {
    padding: 18px 24px;
    font-size: 0.9rem;
  }
}

@media (min-width: 1600px) {
  .table th,
  .table td {
    padding: 20px 28px;
    font-size: 1rem;
  }
}
