/* CSS de Estilização - Sistema NAB Brasilândia */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Cores Principais do NAB Brasilândia */
  --color-primary-blue: #9b51e0;
  --color-primary-blue-hover: #803ec2;
  --color-accent-green: #8cc63f;
  --color-accent-orange: #f7931e;
  --color-accent-pink: #ec008c;
  --color-accent-yellow: #fff200;

  /* Paleta Auxiliar */
  --bg-main: #f8fafc;
  --bg-sidebar: #2d1b69;
  --bg-card: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --border-color: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Fontes e Sombras */
  --font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 20px 25px -5px rgba(155, 81, 224, 0.1), 0 10px 10px -5px rgba(155, 81, 224, 0.04);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* === Layout Geral === */
#app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* --- Telas de Auth (Login / Cadastro Inicial) --- */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(155, 81, 224, 0.1) 0%, rgba(140, 198, 63, 0.05) 90%), var(--bg-main);
  padding: 20px;
}

.auth-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 450px;
  padding: 40px 30px;
  border-top: 5px solid var(--color-primary-blue);
  position: relative;
  overflow: hidden;
}

.auth-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 5px;
  background: linear-gradient(90deg, var(--color-accent-green), var(--color-accent-orange), var(--color-accent-pink));
}

.auth-logo {
  text-align: center;
  margin-bottom: 25px;
}

.auth-logo svg {
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
}

.auth-logo h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--bg-sidebar);
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 5px;
}

/* --- Painel Administrativo Principal --- */
.dashboard-layout {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  transition: var(--transition);
  position: relative;
  z-index: 100;
}

.sidebar-header {
  padding: 30px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 45px;
  height: 45px;
}

.sidebar-title-wrapper h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-primary-blue);
}

.sidebar-title-wrapper p {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

.sidebar-menu {
  list-style: none;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.sidebar-item a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
}

.sidebar-item.active a {
  background-color: var(--color-primary-blue);
  color: var(--text-light);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(155, 81, 224, 0.3);
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  color: var(--color-primary-blue);
}

.user-info-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.user-info-role {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px dashed rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  width: 100%;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
}

.btn-logout:hover {
  background-color: var(--danger);
  color: white;
  border-style: solid;
}

/* --- Conteúdo Principal --- */
.main-content {
  flex-grow: 1;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  background-color: var(--bg-card);
  height: 80px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.topbar-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--bg-sidebar);
}

.topbar-date {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.view-container {
  padding: 40px;
  flex-grow: 1;
}

/* === Estilização Geral de Formulários === */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-dark);
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary-blue);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(155, 81, 224, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-blue-hover);
  box-shadow: 0 4px 12px rgba(155, 81, 224, 0.2);
}

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

.btn-success:hover {
  background-color: #059669;
}

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

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--text-dark);
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* === Dashboard (Painel Geral) === */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 5px solid var(--color-primary-blue);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.stat-card.green {
  border-left-color: var(--color-accent-green);
}

.stat-card.orange {
  border-left-color: var(--color-accent-orange);
}

.stat-card.pink {
  border-left-color: var(--color-accent-pink);
}

.stat-info h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-info p {
  font-size: 28px;
  font-weight: 700;
  color: var(--bg-sidebar);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(155, 81, 224, 0.1);
  color: var(--color-primary-blue);
}

.stat-card.green .stat-icon {
  background-color: rgba(140, 198, 63, 0.1);
  color: var(--color-accent-green);
}

.stat-card.orange .stat-icon {
  background-color: rgba(247, 147, 30, 0.1);
  color: var(--color-accent-orange);
}

.stat-card.pink .stat-icon {
  background-color: rgba(236, 0, 140, 0.1);
  color: var(--color-accent-pink);
}

.dashboard-sections {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-sections {
    grid-template-columns: 1fr;
  }
}

.dashboard-panel {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 30px;
  box-shadow: var(--shadow-md);
}

.dashboard-panel h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--bg-sidebar);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

.panel-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header-action h3 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* === Layout de Cards e Seções === */
.card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  padding: 30px;
  margin-bottom: 30px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 25px;
  color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title svg {
  color: var(--color-primary-blue);
}

/* Grid de Formulários */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {

  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.section-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 30px 0;
}

/* Toggle do Pai (Switch animado) */
.switch-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 25px 0;
  background-color: rgba(247, 147, 30, 0.05);
  border: 1px solid rgba(247, 147, 30, 0.15);
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--color-accent-orange);
}

input:checked+.slider:before {
  transform: translateX(24px);
}

.switch-label-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dark);
}

.switch-label-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Área Expansível do Pai */
.expandable-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  visibility: hidden;
}

.expandable-section.expanded {
  max-height: 2000px;
  opacity: 1;
  visibility: visible;
  margin-bottom: 20px;
}

/* === Tabela de Beneficiários === */
.table-filter-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.filter-search {
  flex-grow: 2;
  min-width: 250px;
  position: relative;
}

.filter-search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-search .form-control {
  padding-left: 48px;
}

.filter-select {
  flex-grow: 1;
  min-width: 150px;
}

.table-wrapper {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.custom-table th {
  background-color: #f8fafc;
  color: var(--text-dark);
  font-weight: 700;
  padding: 16px 20px;
  border-bottom: 2px solid var(--border-color);
}

.custom-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dark);
  vertical-align: middle;
}

.table-link {
  color: var(--color-primary-blue);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.table-link:hover {
  color: var(--color-primary-blue-hover);
  text-decoration: underline;
}

.custom-table tbody tr {
  transition: var(--transition);
}

.custom-table tbody tr:hover {
  background-color: #f1f5f9;
}

.badge-pathology {
  display: inline-block;
  padding: 4px 8px;
  background-color: rgba(236, 0, 140, 0.08);
  border: 1px solid rgba(236, 0, 140, 0.15);
  color: var(--color-accent-pink);
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

.badge-ubs {
  display: inline-block;
  padding: 4px 8px;
  background-color: rgba(140, 198, 63, 0.08);
  border: 1px solid rgba(140, 198, 63, 0.15);
  color: #55871f;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius-sm);
  border: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  color: white;
}

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

.btn-icon-view:hover {
  background-color: var(--color-primary-blue-hover);
}

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

.btn-icon-edit:hover {
  background-color: #059669;
}

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

.btn-icon-delete:hover {
  background-color: #dc2626;
}

.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--border-color);
  margin-bottom: 15px;
}

.empty-state h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--bg-sidebar);
  margin-bottom: 8px;
}

/* === Perfil do Beneficiário & Abas === */
.profile-header-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  padding: 30px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 6px solid var(--color-primary-blue);
  flex-wrap: wrap;
  gap: 20px;
}

.profile-title-area h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--bg-sidebar);
  margin-bottom: 6px;
}

.profile-meta-info {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.profile-meta-info span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tabs */
.tabs-container {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
  gap: 8px;
}

.tab-btn {
  padding: 12px 24px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 15px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
  top: 2px;
}

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

.tab-btn.active {
  color: var(--color-primary-blue);
  border-bottom: 3px solid var(--color-primary-blue);
}

.tab-content-panel {
  display: none;
}

.tab-content-panel.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

/* Layout de Visualização de Ficha */
.info-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary-blue);
  margin: 30px 0 15px 0;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-section-title:first-of-type {
  margin-top: 0;
}

.info-display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.info-item {
  background-color: #f8fafc;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid #f1f5f9;
}

.info-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.info-value {
  font-size: 14px;
  color: var(--text-dark);
  font-weight: 600;
}

/* Aba de Atestados */
.atestados-section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
}

@media (max-width: 900px) {
  .atestados-section {
    grid-template-columns: 1fr;
  }
}

.upload-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 24px;
  border: 2px dashed var(--border-color);
  text-align: center;
  transition: var(--transition);
}

.upload-card:hover {
  border-color: var(--color-primary-blue);
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 15px auto;
  color: var(--text-muted);
}

.upload-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
  margin-bottom: 15px;
}

.file-input-wrapper input[type=file] {
  font-size: 100px;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}

.atestados-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.atestado-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--bg-card);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.atestado-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-blue);
}

.atestado-icon-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.atestado-type-badge {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: white;
}

.atestado-type-badge.pdf {
  background-color: #ef4444;
}

.atestado-type-badge.img {
  background-color: var(--color-primary-blue);
}

.atestado-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-dark);
}

.atestado-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.atestado-actions {
  display: flex;
  gap: 8px;
}

/* === Modais === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.modal-content.large {
  max-width: 900px;
  height: 85vh;
}

.modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--bg-sidebar);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  transition: var(--transition);
}

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

.modal-body {
  padding: 30px;
  flex-grow: 1;
  overflow-y: auto;
}

.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #f8fafc;
  border-bottom-left-radius: var(--border-radius-lg);
  border-bottom-right-radius: var(--border-radius-lg);
}

/* Preview de Arquivos no Modal */
.preview-pane {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #0f172a;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

.preview-pane img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-pane iframe {
  width: 100%;
  height: 100%;
  border: none;
  background-color: white;
}

/* === Layout de Usuários (Configurações) === */
.user-management-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
}

@media (max-width: 900px) {
  .user-management-grid {
    grid-template-columns: 1fr;
  }
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 16px 24px;
  border-radius: var(--border-radius-sm);
  color: white;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

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

.toast.info {
  background-color: var(--color-primary-blue);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Detalhes do Site da Brasilândia no Dashboard --- */
.nab-about-banner {
  background: linear-gradient(135deg, var(--color-primary-blue) 0%, rgba(140, 198, 63, 0.9) 100%);
  color: white;
  border-radius: var(--border-radius-md);
  padding: 30px;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
  gap: 20px;
}

.nab-about-banner h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
}

.nab-about-banner p {
  max-width: 650px;
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.95;
}

.nab-about-banner .banner-brand-btn {
  background-color: var(--color-accent-orange);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(247, 147, 30, 0.3);
  transition: var(--transition);
  border: 2px solid white;
}

.nab-about-banner .banner-brand-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(247, 147, 30, 0.5);
}

/* Quick Access Grid & Cards (Painel Inicial) */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.nav-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 5px solid var(--color-primary-blue);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.nav-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.nav-card.blue {
  border-left-color: var(--color-primary-blue);
}

.nav-card.pink {
  border-left-color: var(--color-accent-pink);
}

.nav-card.green {
  border-left-color: var(--color-accent-green);
}

.nav-card.blue .nav-icon {
  background-color: rgba(155, 81, 224, 0.1);
  color: var(--color-primary-blue);
}

.nav-card.pink .nav-icon {
  background-color: rgba(236, 0, 140, 0.1);
  color: var(--color-accent-pink);
}

.nav-card.green .nav-icon {
  background-color: rgba(140, 198, 63, 0.1);
  color: var(--color-accent-green);
}

.nav-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--bg-sidebar);
  margin-bottom: 4px;
}

.nav-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.nav-info .nav-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--bg-sidebar);
  margin-top: 8px;
  display: block;
}

.nav-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition);
}

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

/* Danger switch para inativos */
input:checked+.slider.danger {
  background-color: var(--danger);
}

/* Redução de opacidade de itens inativos */
.inactive-row {
  opacity: 0.65;
  background-color: #f1f5f9;
}

/* Estilos de botões de administrador restritos */
.admin-only-btn[disabled] {
  background-color: #e2e8f0 !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
  cursor: not-allowed !important;
  opacity: 0.7 !important;
  box-shadow: none !important;
}

/* Badge do nível de acesso */
.badge-role {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

.badge-role.admin {
  background-color: rgba(155, 81, 224, 0.1);
  color: var(--color-primary-blue);
}

.badge-role.usuario {
  background-color: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}

/* === ESTILOS DO CALENDÁRIO DE ATENDIMENTOS === */

.calendar-wrapper {
  margin-top: 15px;
  background-color: var(--bg-card);
  border-radius: var(--border-radius-md);
}

.calendar-day-cell {
  background-color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow-y: auto;
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
  height: 120px;
}

.calendar-day-cell::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari and Opera */
}

.calendar-day-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.calendar-app-card {
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  border-left: 3px solid transparent;
  display: flex;
  flex-direction: column;
  color: var(--text-dark);
  margin-bottom: 2px;
  box-shadow: var(--shadow-sm);
}

.calendar-app-card:hover {
  transform: scale(1.02);
  filter: brightness(0.95);
}

/* Cores de status dos atendimentos */
.calendar-app-card.status-pendente {
  background-color: #f1f5f9;
  border-left-color: #94a3b8;
  color: #475569;
}

.calendar-app-card.status-presente {
  background-color: #ecfdf5;
  border-left-color: var(--success);
  color: #065f46;
}

.calendar-app-card.status-falta_justificada {
  background-color: #fef9c3;
  border-left-color: var(--warning);
  color: #854d0e;
}

.calendar-app-card.status-falta_nao_justificada {
  background-color: #fee2e2;
  border-left-color: var(--danger);
  color: #991b1b;
}

.app-prof-sub {
  margin-top: 2px;
  font-size: 9px;
}

/* Botões do Navegador de Meses */
.btn-calendar-nav {
  background-color: #9b51e0 !important;
  color: white !important;
}

.btn-calendar-nav:hover {
  background-color: #803ec2 !important;
  box-shadow: 0 2px 8px rgba(155, 81, 224, 0.3);
}
/* ========================================== */
/* RESPONSIVIDADE (MOBILE & TABLET)           */
/* ========================================== */

/* Overlay da Sidebar (Mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar Web/Desktop (Visível por padrão) */
.sidebar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 0;
}
.sidebar.collapsed {
  margin-left: -280px; /* Esconde deslizando pra esquerda no desktop */
}

/* Botões de Menu (Hamburger e Fechar) */
#btn-mobile-menu {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background-color: #9b51e0;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(155, 81, 224, 0.2);
}
#btn-mobile-menu:hover {
  background-color: #803ec2;
  box-shadow: 0 4px 12px rgba(155, 81, 224, 0.3);
  transform: translateY(-1px);
}

#btn-close-sidebar {
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: absolute;
  right: 15px;
}
#btn-close-sidebar:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

@media (max-width: 992px) {
  /* Sidebar Mobile (Oculta por padrão) */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    margin-left: 0 !important; /* Reseta o margin do desktop */
    z-index: 1000;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  /* Exibe o botão de fechar a sidebar no mobile */
  #btn-close-sidebar {
    display: block !important;
  }

  /* Padding Principal */
  .view-container {
    padding: 20px;
  }

  /* Grids Form */
  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Grid Dash (Beneficiários, etc) */
  .nav-grid {
    grid-template-columns: 1fr;
  }

  /* Topbar */
  .topbar {
    padding: 15px 20px;
  }
  .topbar-date {
    display: none; /* Esconde a data no mobile para poupar espaço */
  }

  /* Auth Layout */
  .auth-layout {
    flex-direction: column;
  }
  .auth-left, .auth-right {
    width: 100%;
    min-height: auto;
  }
  
  /* Modal Content */
  .modal-content {
    width: 95%;
    margin: 20px auto;
  }
  
  /* Action Headers da Tabela/Painel */
  .panel-header-action {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 15px !important;
  }
  .panel-header-action > div,
  .calendar-actions-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .panel-header-action button, 
  .panel-header-action select, 
  .panel-header-action .calendar-navigation,
  .calendar-actions-wrapper button,
  .calendar-actions-wrapper select,
  .calendar-actions-wrapper .calendar-navigation {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    flex-shrink: 1 !important;
  }
  
  /* Tabelas Responsivas */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .custom-table {
    min-width: 800px; /* Garante que a tabela não fique espremida, forçando scroll horizontal */
  }
  
  /* Filtros de Pesquisa na Tabela */
  .table-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .table-filter-bar .form-control {
    width: 100% !important;
  }
}
