/* =====================================================
   AR Consultório Veterinário - Estilos Principais
   ===================================================== */

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

:root {
  --primary: #1a6b3c;
  --primary-dark: #144f2d;
  --primary-light: #2a9055;
  --primary-pale: #e8f5ee;
  --accent: #f0a500;
  --accent-dark: #d08800;
  --danger: #e53e3e;
  --danger-light: #fff5f5;
  --warning: #f6ad55;
  --success: #48bb78;
  --info: #4299e1;
  --text-dark: #1a202c;
  --text-medium: #4a5568;
  --text-light: #718096;
  --border: #e2e8f0;
  --bg-light: #f7fafc;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --sidebar-width: 260px;
  --header-height: 65px;
}

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

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.6;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* ===== TOAST NOTIFICATIONS ===== */
.vet-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 360px;
  border-left: 4px solid var(--success);
  font-size: 0.9rem;
  font-weight: 500;
}
.vet-toast.show { transform: translateY(0); opacity: 1; }
.vet-toast-success { border-color: var(--success); }
.vet-toast-success i { color: var(--success); }
.vet-toast-error { border-color: var(--danger); }
.vet-toast-error i { color: var(--danger); }
.vet-toast-info { border-color: var(--info); }
.vet-toast-info i { color: var(--info); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,107,60,0.3); }
.btn-secondary { background: var(--bg-light); color: var(--text-medium); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: white; border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #c53030; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title i { color: var(--primary); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: white;
  transition: all 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.1); }
.form-control::placeholder { color: #a0aec0; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

/* ===== CHECKBOX GROUPS ===== */
.check-group-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-medium);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}
.check-item:hover { border-color: var(--primary); background: var(--primary-pale); }
.check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.check-item input[type="checkbox"]:checked + span { color: var(--primary); font-weight: 600; }
.check-item span { font-size: 0.85rem; color: var(--text-medium); }

/* Radio groups */
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}
.radio-item:hover { border-color: var(--primary); }
.radio-item input[type="radio"] { accent-color: var(--primary); }
.radio-item input[type="radio"]:checked ~ span { color: var(--primary); font-weight: 600; }
.radio-item:has(input:checked) { border-color: var(--primary); background: var(--primary-pale); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 4px;
}
.badge-success { background: #c6f6d5; color: #276749; }
.badge-danger { background: #fed7d7; color: #9b2c2c; }
.badge-warning { background: #fefcbf; color: #744210; }
.badge-info { background: #bee3f8; color: #2a69ac; }
.badge-primary { background: var(--primary-pale); color: var(--primary-dark); }
.badge-secondary { background: var(--bg-light); color: var(--text-medium); }

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead th {
  background: var(--bg-light);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-pale); }
.data-table tbody td { padding: 13px 16px; color: var(--text-dark); vertical-align: middle; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.active .modal-box { transform: scale(1); }
.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-xl { max-width: 1100px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title i { color: var(--primary); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== LAYOUT SIDEBAR ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
}

.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  padding: 8px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.12); color: white; }
.nav-item.active { background: rgba(255,255,255,0.2); color: white; font-weight: 600; }
.nav-item .badge-nav {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 10px;
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
}
.sidebar-user .logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s;
}
.sidebar-user .logout-btn:hover { background: rgba(255,255,255,0.15); color: white; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
}
.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--text-light);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-medium);
  padding: 6px;
  border-radius: 6px;
}
.hamburger-btn:hover { background: var(--bg-light); }

.page-content { padding: 28px; flex: 1; }
.page-content.full-pad { padding: 24px; }

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.green { background: var(--primary-pale); color: var(--primary); }
.stat-icon.blue { background: #ebf8ff; color: #2b6cb0; }
.stat-icon.orange { background: #fffaf0; color: #c05621; }
.stat-icon.purple { background: #faf5ff; color: #553c9a; }
.stat-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}
.stat-label { font-size: 0.82rem; color: var(--text-light); margin-top: 3px; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: all 0.2s;
}
.search-bar:focus-within { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(26,107,60,0.1); }
.search-bar i { color: var(--text-light); }
.search-bar input {
  border: none;
  background: none;
  outline: none;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  flex: 1;
  min-width: 0;
}
.search-bar input::placeholder { color: #a0aec0; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state i { font-size: 3.5rem; color: #cbd5e0; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-medium); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; }

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title i { color: var(--primary); }

/* ===== PATIENT CARD ===== */
.patient-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all 0.2s;
  cursor: pointer;
}
.patient-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.patient-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.patients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  backdrop-filter: blur(2px);
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DIVIDER SECTION ===== */
.form-section {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}
.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-light);
}
.pagination-btns { display: flex; gap: 6px; }
.page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger-btn {
    display: flex;
  }
  .page-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .check-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .modal-box {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    max-height: 95vh;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ===== OVERLAY MOBILE ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ===== PRINT ===== */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
