/* Style.css - OftalmoVet Design System */
/* Uma estética Dark Mode e Glassmorphic premium, refinada para medicina veterinária de alta tecnologia */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(22, 30, 49, 0.7);
  --bg-card-hover: rgba(30, 41, 67, 0.85);
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(0, 229, 255, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --color-primary: #00e5ff;       /* Azul Cirúrgico / Neon Cyan */
  --color-primary-rgb: 0, 229, 255;
  --color-secondary: #a855f7;     /* Violeta Tecnológico */
  --color-success: #10b981;       /* Verde Clínico Saudável */
  --color-warning: #f59e0b;       /* Alerta */
  --color-danger: #ef4444;        /* Perigo / Altura Crítica */
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

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

/* Scrollbar Custom */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.3);
}

/* Estrutura Principal */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
  z-index: 10;
  overflow-y: auto;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.logo-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.logo-image-container:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.logo-sidebar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.4rem;
  background: linear-gradient(to right, #ffffff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
  cursor: pointer;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: var(--transition-smooth);
}

.nav-link:hover, .nav-item.active .nav-link {
  color: #fff;
  background: rgba(0, 229, 255, 0.08);
  box-shadow: inset 1px 0 0 0 var(--color-primary);
}

.nav-link:hover svg, .nav-item.active .nav-link svg {
  color: var(--color-primary);
  filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.5));
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Área de Conteúdo Principal */
.main-content {
  flex-grow: 1;
  height: 100%;
  overflow-y: auto;
  padding: 40px;
  position: relative;
  background-radial-gradient: circle at 50% 50%, rgba(10, 30, 60, 0.25), var(--bg-primary);
}

/* Decorações do Fundo */
.main-content::before {
  content: '';
  position: absolute;
  top: 10%;
  right: 15%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

.main-content::after {
  content: '';
  position: absolute;
  bottom: 10%;
  left: 10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.06) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

.view-section {
  position: relative;
  z-index: 1;
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cabeçalho das Páginas */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Elementos Estilizados Glass */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(0, 229, 255, 0.15);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #00b0ff);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.45);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-secondary), #d946ef);
  color: #fff;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

.btn-accent:hover {
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 130px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-blue { background: rgba(0, 229, 255, 0.1); color: var(--color-primary); }
.icon-purple { background: rgba(168, 85, 247, 0.1); color: var(--color-secondary); }
.icon-green { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.icon-yellow { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); }

.stat-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Duas colunas do Dashboard */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

/* Tabelas Premium */
.table-container {
  overflow-x: auto;
  margin-top: 16px;
}

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

.custom-table th {
  padding: 14px 16px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  transition: var(--transition-smooth);
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue { background: rgba(0, 229, 255, 0.12); color: var(--color-primary); }
.badge-purple { background: rgba(168, 85, 247, 0.12); color: var(--color-secondary); }
.badge-green { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--color-danger); }

/* Caixa de Busca */
.search-container {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px 12px 46px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.search-icon-svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

/* Modais Glassmorphism */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(18, 25, 41, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-lg);
  padding: 32px;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

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

.modal-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  color: #fff;
}

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

.form-grid-full {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

/* Garante o contraste e a legibilidade das opções em listas de seleção (dropdowns/select) */
.form-select option, select option {
  background-color: #111827 !important; /* Cor escura sólida */
  color: #ffffff !important;            /* Texto branco de alto contraste */
}


.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Seção de Cadastro e Exibição de Clientes */
.details-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
}

.profile-card {
  text-align: center;
  padding: 32px 24px;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 229, 255, 0.2);
}

.profile-avatar-initials {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
}

.profile-name {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.profile-info-list {
  text-align: left;
  list-style: none;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-info-item {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 8px;
}

.profile-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-info-val {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Estilo das Fichas Clínicas */
.clinical-section-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clinical-section-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Grade de Exame Ocular (OD vs OE) */
.eye-exam-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.eye-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 20px;
}

.eye-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eye-od { color: var(--color-primary); }
.eye-oe { color: var(--color-secondary); }

/* Medidores Visuais para Schirmer */
.schirmer-meter-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.schirmer-bar-bg {
  flex-grow: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.schirmer-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.schirmer-bar-fill.normal { background: linear-gradient(90deg, #10b981, #059669); }
.schirmer-bar-fill.low { background: linear-gradient(90deg, #f59e0b, #ef4444); }

.schirmer-val {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  width: 80px;
  text-align: right;
}

/* Desenho Dinâmico do Olho (Canvas de Mapeamento) */
.eye-canvas-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 16px auto;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.eye-canvas {
  width: 100%;
  height: 100%;
  background: #0f1624;
  cursor: crosshair;
}

.canvas-toolbar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.canvas-tool {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.canvas-tool:hover, .canvas-tool.active {
  background: var(--color-primary);
  color: #000;
}

/* Gráfico de Histórico de Tonometria */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
  margin-top: 16px;
}

/* Layout de Prontuário Clínico Fechado/Histórico */
.history-item {
  position: relative;
  padding-left: 28px;
  margin-bottom: 24px;
}

.history-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.history-item::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 24px;
  width: 2px;
  height: calc(100% + 8px);
  background: rgba(255, 255, 255, 0.05);
}

.history-item:last-child::after {
  display: none;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.history-date {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.history-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Área de Geração de Receita */
.recipe-page {
  background: white;
  color: #333;
  width: 100%;
  max-width: 800px;
  min-height: 1000px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  padding: 60px;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  position: relative;
}

.recipe-header {
  border-bottom: 2px solid #333;
  padding-bottom: 20px;
  margin-bottom: 40px;
  text-align: center;
}

.recipe-clinic-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f172a;
}

.recipe-clinic-sub {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.recipe-title {
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 30px;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.recipe-patient-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 30px;
  font-size: 0.95rem;
}

.recipe-body {
  flex-grow: 1;
  font-size: 1.05rem;
  line-height: 1.7;
}

.recipe-item {
  margin-bottom: 24px;
  border-left: 3px solid #0f172a;
  padding-left: 14px;
}

.recipe-item-name {
  font-weight: 700;
  color: #0f172a;
}

.recipe-item-desc {
  color: #475569;
  font-style: italic;
  font-size: 0.95rem;
}

.recipe-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 30px;
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
}

.recipe-signature-line {
  width: 250px;
  border-top: 1px solid #94a3b8;
  margin: 60px auto 10px;
}

/* Responsividade Básica */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .details-layout {
    grid-template-columns: 1fr;
  }
  .eye-exam-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .main-content {
    padding: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid-full {
    grid-column: span 1;
  }
}

/* ==========================================================================
   FASE 2: UPLOAD DE FOTOS CLÍNICAS E GALERIA EVOLUTIVA
   ========================================================================== */

/* Dropzone Retangular de Fotos Reais Ampliada */
.photo-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.photo-preview-rect-wrapper {
  width: 100%;
  max-width: 480px;
  height: 260px;
  border-radius: var(--radius-md);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  padding: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.photo-preview-rect-wrapper:hover {
  border-color: var(--color-primary);
  background: rgba(0, 229, 255, 0.05);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
  transform: scale(1.01);
}

/* Diferenciação de Hover Glow para o Olho Esquerdo (Roxo) */
#photo-upload-zone-oe .photo-preview-rect-wrapper:hover {
  border-color: var(--color-secondary);
  background: rgba(168, 85, 247, 0.05);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.photo-preview-rect {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius-md) - 4px);
  object-fit: contain;
  background-color: #0f1624;
  transition: var(--transition-smooth);
}

.photo-upload-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.photo-preview-rect-wrapper:hover + .photo-upload-label,
.photo-upload-label:hover {
  color: var(--color-primary);
}

#photo-upload-zone-oe .photo-preview-rect-wrapper:hover + .photo-upload-label {
  color: var(--color-secondary);
}

.photo-remove-btn {
  margin-top: 4px;
  padding: 6px 16px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.photo-remove-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ff8888;
}

/* Galeria de Fotos Clínicas na Timeline Histórica */
.timeline-photos-container {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.timeline-photo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.timeline-photo-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline-photo-img-wrapper {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  cursor: zoom-in;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.timeline-photo-img-wrapper:hover {
  transform: scale(1.18) rotate(2deg);
  border-color: var(--color-primary);
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
  z-index: 5;
}

.timeline-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Modal de Zoom da Foto Clínica Global */
.zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 7, 12, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: zoom-out;
}

.zoom-modal.active {
  display: flex;
  opacity: 1;
}

.zoom-img {
  width: 95vw;
  height: 95vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-modal.active .zoom-img {
  transform: scale(1);
}

/* ==========================================================================
   DIRETIVAS EXCLUSIVAS DE IMPRESSÃO A4 (RECEITUÁRIO)
   ========================================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
  }
  
  .app-container {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  /* Esconder toda a interface SPA */
  .sidebar, 
  .main-content > *:not(#view-receituario), 
  .page-header, 
  .glass-card:not(#documento-receita-preview), 
  .btn, 
  button, 
  .canvas-toolbar {
    display: none !important;
  }
  
  .main-content {
    padding: 0 !important;
    background: white !important;
    overflow: visible !important;
    height: auto !important;
  }
  
  #view-receituario {
    display: block !important;
  }
  
  #view-receituario > *:not(.dashboard-layout) {
    display: none !important;
  }
  
  .dashboard-layout {
    display: block !important;
    grid-template-columns: 1fr !important;
  }
  
  .dashboard-layout > div:first-child {
    display: none !important;
  }
  
  .dashboard-layout > div:last-child {
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
  }
  
  /* Ajustar o contêiner A4 */
  .recipe-page {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    background: white !important;
    color: black !important;
  }
  
  .recipe-clinic-name {
    color: #0f172a !important;
  }
  
  .recipe-patient-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .recipe-item {
    border-left-color: #0f172a !important;
  }
  
  @page {
    size: A4 portrait;
    margin: 15mm;
  }
}

/* ==========================================
   ESTILOS ADICIONAIS: PAINEL DE AUDITORIA E COMPLIANCE
   ========================================== */
.log-row-exclusao {
  background: rgba(239, 68, 68, 0.04) !important;
  border-left: 4px solid var(--color-danger) !important;
  box-shadow: inset 0 0 15px rgba(239, 68, 68, 0.08);
}

.log-row-exclusao td {
  color: #fca3a3 !important;
}

.log-row-exclusao:hover td {
  background: rgba(239, 68, 68, 0.08) !important;
  color: #fee2e2 !important;
}

.badge-audit-cria {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-audit-edit {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-audit-del {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: audit-danger-pulse 2s infinite;
}

.badge-audit-print {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-audit-sched {
  background: rgba(0, 229, 255, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

@keyframes audit-danger-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* ==========================================
   GOOGLE CALENDAR INTEGRATION BAR & TYPE BADGES
   ========================================== */

.google-calendar-bar {
  transition: var(--transition-smooth);
}

.google-calendar-bar:hover {
  box-shadow: 0 8px 30px rgba(66, 133, 244, 0.08);
  border-color: rgba(66, 133, 244, 0.2) !important;
}

.badge-gcal-online {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-gcal-demo {
  background: rgba(0, 229, 255, 0.2) !important;
  color: #67e8f9 !important;
  border: 1px solid rgba(0, 229, 255, 0.4);
}

/* Badges Condizentes com as cores do Google Calendar */
.badge-type-consulta {
  background: rgba(66, 133, 244, 0.15) !important;
  color: #66b2ff !important;
  border: 1px solid rgba(66, 133, 244, 0.3) !important;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.badge-type-retorno {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fca5a5 !important; /* Laranja suave / Tangerina */
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* O Retorno no print tem tom amarelo quente/tangerina, ajustamos a cor para ficar idêntica */
.badge-type-retorno {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important; /* Amarelo quente */
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.badge-type-cirurgia {
  background: rgba(29, 78, 216, 0.2) !important;
  color: #93c5fd !important; /* Blueberry / Azul escuro cobrindo dia */
  border: 1px solid rgba(29, 78, 216, 0.4) !important;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

/* ==========================================
   WEEKLY INTERACTIVE CALENDAR GRID
   ========================================== */

.agenda-view-toggle button {
  font-weight: 600;
  transition: var(--transition-smooth);
}

.agenda-view-toggle button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.agenda-view-toggle button.active {
  background: var(--color-primary) !important;
  color: #000 !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.weekly-calendar-container {
  background: rgba(15, 22, 36, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-width: 800px;
}

.weekly-calendar-body {
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-sizing: border-box;
}

/* Colunas de Dia Interativas */
.weekly-day-column {
  transition: background 0.15s ease;
}

.weekly-day-column:hover {
  background: rgba(255, 255, 255, 0.02);
}

.weekly-day-column:hover::after {
  content: '➕ Agendar';
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(0, 229, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  pointer-events: none;
  opacity: 0.8;
}

/* Cards de Evento Flutuantes (Google Calendar Style) */
.weekly-event-card {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--font-body);
  font-size: 0.74rem;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, z-index 0.1s ease;
  border-left: 4px solid;
  box-sizing: border-box;
  z-index: 2;
}

.weekly-event-card:hover {
  transform: scale(1.03);
  z-index: 10 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Cores dos Cards condizentes com os Tipos */
.weekly-event-consulta {
  background: rgba(66, 133, 244, 0.22) !important;
  border-left-color: #4285F4 !important;
  color: #99c2ff !important;
}

.weekly-event-consulta:hover {
  background: rgba(66, 133, 244, 0.35) !important;
}

.weekly-event-retorno {
  background: rgba(245, 158, 11, 0.22) !important;
  border-left-color: #fbbf24 !important;
  color: #fde68a !important;
}

.weekly-event-retorno:hover {
  background: rgba(245, 158, 11, 0.35) !important;
}

.weekly-event-cirurgia {
  background: rgba(29, 78, 216, 0.32) !important;
  border-left-color: #3b82f6 !important;
  color: #bfdbfe !important;
  font-weight: 600;
}

.weekly-event-cirurgia:hover {
  background: rgba(29, 78, 216, 0.45) !important;
}

.weekly-event-title {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.weekly-event-tutor {
  font-size: 0.68rem;
  opacity: 0.85;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.weekly-event-time {
  font-size: 0.65rem;
  opacity: 0.7;
  font-weight: 500;
  margin-top: 1px;
}

/* Novos estilos para cards de agendamento expandidos - Fase 3 */
.weekly-event-exame {
  background: rgba(239, 68, 68, 0.22) !important;
  border-left-color: #ef4444 !important;
  color: #fca5a5 !important;
}

.weekly-event-exame:hover {
  background: rgba(239, 68, 68, 0.35) !important;
}

.weekly-event-vacina {
  background: rgba(16, 185, 129, 0.22) !important;
  border-left-color: #10b981 !important;
  color: #a7f3d0 !important;
}

.weekly-event-vacina:hover {
  background: rgba(16, 185, 129, 0.35) !important;
}

.weekly-event-outro {
  background: rgba(168, 85, 247, 0.22) !important;
  border-left-color: #a855f7 !important;
  color: #ddd6fe !important;
}

.weekly-event-outro:hover {
  background: rgba(168, 85, 247, 0.35) !important;
}

/* Estilos de abas/toggle de tipo de cliente no modal de agendamento */
.client-type-toggle {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
}

.client-type-toggle button {
  border: none !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  transition: var(--transition-smooth);
}

.client-type-toggle button:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.client-type-toggle button.active {
  background: var(--color-primary) !important;
  color: #000 !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.2);
}

/* Badges de tabela para as novas categorias */
.badge-type-exame {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.badge-type-vacina {
  background: rgba(16, 185, 129, 0.16) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.badge-type-outro {
  background: rgba(168, 85, 247, 0.16) !important;
  color: #c084fc !important;
  border: 1px solid rgba(168, 85, 247, 0.3) !important;
}

/* ==========================================================================
   GOOGLE AGENDA IFRAME PREMIUM STYLE
   ========================================================================== */
.gcal-iframe-wrapper {
  background: #ffffff !important;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
  transition: var(--transition-smooth);
}

.gcal-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: 0;
  background: #ffffff;
}

/* ==========================================================================
   PET GALLERY & EVOLUTION COMPARATOR (4K UHD OPTIMIZED)
   ========================================================================== */

/* Abas de Navegação */
.pet-tabs-nav {
  margin-bottom: 8px;
}

.pet-tab-btn {
  position: relative;
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 8px 16px !important;
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pet-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff !important;
}

.pet-tab-btn.active {
  background: rgba(0, 229, 255, 0.05) !important;
  color: var(--color-primary) !important;
  border-bottom: 2px solid var(--color-primary) !important;
}

/* Grid Fluido da Galeria - Otimizado para 4K */
.g-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  width: 100%;
}

/* Card de Foto Clínico */
.g-photo-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.g-photo-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 229, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.g-photo-card:hover .g-photo-img-wrapper img {
  transform: scale(1.05);
}

/* Card Selecionado */
.g-photo-card.selected {
  border-color: var(--color-primary);
  background: rgba(0, 229, 255, 0.04);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.15);
}

.g-photo-card.selected .g-photo-checkbox-indicator {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

.g-photo-card.selected .g-photo-checkbox-indicator svg {
  display: block !important;
}

/* Comparator Grid Layout */
.g-comparator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
}

@media (min-width: 1024px) {
  .g-comparator-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

/* Comparator Card & Sides */
.g-comparator-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.g-comparator-card.empty {
  opacity: 0.85;
}

.g-comparator-card.loaded {
  animation: slideDown 0.3s ease forwards;
}

.g-comparator-img-box {
  transition: border-color 0.3s ease;
}

.g-comparator-img-box:hover {
  border-color: rgba(0, 229, 255, 0.4) !important;
}

.g-comparator-img-box img {
  transition: transform 0.3s ease;
}

.g-comparator-img-box img:hover {
  transform: scale(1.02);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   FINANCIAL MODULE & CASH FLOW STYLES
   ========================================================================== */
.badge-finance-receita {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-family: var(--font-title);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-finance-despesa {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.25);
  font-family: var(--font-title);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.financial-totals-row {
  display: flex;
  justify-content: flex-end;
  gap: 32px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border-color);
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.badge-audit-fin {
  background: rgba(0, 229, 255, 0.12) !important;
  color: var(--color-primary) !important;
  border: 1px solid rgba(0, 229, 255, 0.2);
}

/* Seleção de fotos no formulário de laudos */
.laudo-photo-select-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  margin-bottom: 8px;
}

.laudo-photo-select-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.laudo-photo-select-item.selected {
  border-color: var(--color-primary);
  background: rgba(0, 229, 255, 0.05);
}

.laudo-photo-checkmark {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  color: #111827;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.laudo-photo-select-item.selected .laudo-photo-checkmark {
  opacity: 1;
  transform: scale(1);
}

/* Custom badges audit types */
.badge-audit-cria {
  background: rgba(52, 211, 153, 0.12) !important;
  color: #34d399 !important;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.badge-audit-edit {
  background: rgba(96, 165, 250, 0.12) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.badge-audit-del {
  background: rgba(248, 113, 113, 0.12) !important;
  color: #f87171 !important;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.badge-audit-print {
  background: rgba(251, 191, 36, 0.12) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge-audit-sched {
  background: rgba(167, 139, 250, 0.12) !important;
  color: #a78bfa !important;
  border: 1px solid rgba(167, 139, 250, 0.2);
}

/* Combobox de Busca Inteligente / Autocomplete nos Dropdowns */
.searchable-select-container {
  position: relative;
  width: 100%;
}

.searchable-select-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2300e5ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px !important;
}

.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 2000;
  max-height: 250px;
  overflow-y: auto;
  background: #111827 !important; /* Cor sólida de altíssimo contraste */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  display: none;
}

.searchable-select-dropdown.active {
  display: block;
}

.searchable-select-item {
  padding: 12px 14px;
  cursor: pointer;
  color: #ffffff !important;
  font-size: 0.88rem;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.searchable-select-item:last-child {
  border-bottom: none;
}

.searchable-select-item:hover {
  background: var(--color-primary) !important;
  color: #111827 !important;
  font-weight: 600;
}

.searchable-select-item.selected {
  background: rgba(0, 229, 255, 0.15) !important;
  color: var(--color-primary) !important;
  font-weight: 700;
}

.searchable-select-no-results {
  padding: 14px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  font-size: 0.85rem;
}

/* FASE 3: ESTILOS DO CALENDÁRIO FINANCEIRO INTERATIVO */
.fin-calendar-btn-day {
  border: none;
  background: none;
  font-size: 0.8rem;
  color: #fff;
  cursor: pointer;
  height: 32px;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.fin-calendar-btn-day:hover {
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-primary);
}

.fin-calendar-btn-day.empty {
  pointer-events: none;
  cursor: default;
  opacity: 0;
}

.fin-calendar-btn-day.active-start {
  background: var(--color-primary) !important;
  color: #0b0f19 !important;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
  border-radius: 4px;
}

.fin-calendar-btn-day.active-end {
  background: var(--color-secondary) !important;
  color: #fff !important;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
  border-radius: 4px;
}

.fin-calendar-btn-day.active-range {
  background: rgba(0, 229, 255, 0.15) !important;
  color: var(--color-primary) !important;
  border-radius: 0;
}

.fin-calendar-btn-day.today {
  border: 1px dashed var(--color-primary);
}

/* Novo Módulo de Termos de Consentimento (Simulação A4 em tela) */
.termo-preview-a4 {
  background: white;
  color: #333;
  width: 100%;
  max-width: 800px;
  min-height: 1000px;
  margin: 0 auto;
  padding: 40px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border-radius: 4px;
}

/* ==========================================================================
   SISTEMA DE DESIGN RESPONSIVO - OFTALMOVET
   ========================================================================== */

/* Classes do Cabeçalho Móvel (Escondido por padrão no Desktop) */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 90;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-primary);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.mobile-logo-text {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.05rem;
  background: linear-gradient(to right, #ffffff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

/* Overlay do Menu Lateral */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Contêiner de Tabelas Responsivas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table-responsive table {
  margin-bottom: 0;
}

/* ==========================================
   MEDIA QUERY: DESKTOP COMPACTO E TABLETS LARGOS
   ========================================== */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: row;
  }
  
  /* Ajuste de Grids */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* Ajuste do Editor Split */
  .editor-split-container {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  .termo-preview-a4 {
    max-width: 100%;
    margin-top: 16px;
  }
}

/* ==========================================
   MEDIA QUERY: SMARTPHONES E TABLETS MENORES
   ========================================== */
@media (max-width: 768px) {
  /* Layout Global */
  .app-container {
    flex-direction: column;
  }

  /* Mostrar Cabeçalho Móvel */
  .mobile-header {
    display: flex;
  }

  /* Ajustar Área Principal */
  .main-content {
    padding: 84px 16px 32px 16px;
    height: calc(100vh - 64px);
    margin-top: 64px;
    width: 100% !important;
    max-width: 100% !important;
  }

  .view-section {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Sidebar flutuante (Drawer) */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 30px rgba(0, 0, 0, 0.55);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  /* Cabeçalho de Páginas */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
  }

  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  /* Dashboard Cards e Grade */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  /* Fichas Clínicas e Grids de Olho (OD/OE) */
  .eye-exam-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .eye-exam-panel {
    grid-template-columns: 1fr !important;
  }

  .neuro-test-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .schirmer-tono-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  /* Formulários e Filtros */
  .filters-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filters-container input, 
  .filters-container select, 
  .filters-container button {
    width: 100% !important;
  }

  /* Prontuários e Detalhes */
  .paciente-detalhe-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Otimizações de Visualização da Folha A4 no Celular */
  .termo-preview-a4 {
    padding: 20px;
    font-size: 0.85rem;
    overflow-x: auto;
  }

  .termo-header img {
    margin-bottom: 8px;
  }

  .signature-container {
    flex-direction: column;
    gap: 24px;
    margin-top: 24px;
  }

  .signature-block {
    width: 100% !important;
  }

  /* Popups e Modais */
  .modal-container {
    width: 95% !important;
    max-height: 90vh;
    padding: 20px !important;
    overflow-y: auto;
  }

  /* Layouts de Grid e Posicionamento Mobile */
  .dashboard-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .details-layout {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .form-grid-full {
    grid-column: span 1 !important;
  }
}

/* ==========================================
   TELA DE LOGIN E PERFIL DO USUÁRIO
   ========================================== */

/* Esconder sidebar/header e expandir conteúdo se não logado */
.app-container.not-logged-in .sidebar,
.app-container.not-logged-in .mobile-header,
.app-container.not-logged-in .sidebar-overlay {
  display: none !important;
}

.app-container.not-logged-in .main-content {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  flex-grow: 1 !important;
}

/* Centralização do Login */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(10, 35, 75, 0.4), var(--bg-primary));
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  padding: 20px;
}

/* Card com Glassmorphism */
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: rgba(13, 27, 42, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 2;
  animation: loginFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 30px;
}

.login-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.login-brand {
  display: flex;
  flex-direction: column;
}

.login-brand .logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.login-brand .logo-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 30px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
  z-index: 5;
}

.input-icon-wrapper .form-input {
  padding-left: 44px !important;
}

.input-icon-wrapper .form-input.form-input-password {
  padding-right: 44px !important;
}

.input-icon-wrapper .form-input:focus + .input-icon {
  color: var(--color-primary);
}

.password-toggle-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 10;
  height: 100%;
}

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

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-top: 15px;
  margin-bottom: 15px;
  text-align: center;
  animation: shakeError 0.4s ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Barra de Usuário no rodapé da Sidebar */
.user-profile-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.btn-settings {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-settings:hover {
  color: var(--color-primary);
  background: rgba(0, 229, 255, 0.1);
}

/* Custom premium styling for SVG dashboard charts */
.chart-bar-group rect {
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}
.chart-bar-group rect:hover {
  opacity: 1 !important;
  filter: brightness(1.2);
}
#dashboard-chart-species svg circle {
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}
#dashboard-chart-species svg circle:hover {
  opacity: 1 !important;
  filter: brightness(1.15);
}

/* ==========================================================================
   TELA DE CARREGAMENTO (SPLASH SCREEN) & BOTÃO SYNC
   ========================================================================== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
}

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

.btn-sync {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-sync:hover {
  color: var(--color-primary);
  background: rgba(0, 229, 255, 0.08);
  transform: rotate(45deg);
}

.btn-sync.syncing {
  animation: spin 1.2s linear infinite;
  color: var(--color-primary);
}

/* Brilho âmbar sofisticado para destacar os campos importados alterados */
.pront-campo-alterado {
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45) !important;
  border-color: rgba(245, 158, 11, 0.7) !important;
  background-color: rgba(245, 158, 11, 0.04) !important;
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}



