/* ========================================
   HEADER MODERNIZADO - IaDentalFlow
   Design profissional com gradientes e tooltips
======================================== */

:root {
  --header-height: 60px;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 60px;
  --brand-blue: #2646B3;
  --brand-teal: #60c1d9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --transition-speed: 0.3s;
}

/* Container principal do header */
.top-bar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 999;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: left var(--transition-speed) ease;
}

/* Ajuste quando a sidebar está colapsada */
body.sidebar-collapsed .top-bar {
  left: var(--sidebar-collapsed-width);
}

/* Conteúdo Real */
.top-bar .real-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 2rem;
}

/* ========== BRAND SECTION ========== */
.top-bar .brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar .brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-teal) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(38, 70, 179, 0.2);
  position: relative;
  overflow: hidden;
}

.top-bar .brand-logo::before {
  content: '';
  display: none;
}

/* Shine animation removida */
@keyframes shine { }

.top-bar .brand-logo i {
  color: #fff;
  font-size: 1.3rem;
  position: relative;
  z-index: 1;
}

.top-bar .brand-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-bar .brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-bar .brand-tagline {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== PANEL INDICATOR ========== */
.top-bar .panel-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #1e40af;
  transition: all 0.2s ease;
  cursor: help;
  position: relative;
}

.top-bar .panel-indicator:hover {
  transform: none;
  box-shadow: none;
}

.top-bar .status-dot {
  font-size: 0.5rem;
  color: #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.top-bar .indicator-text {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== ACTIONS SECTION ========== */
.top-bar .actions-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Icon Buttons */
.top-bar .icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 2px solid transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.top-bar .icon-btn:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: var(--border-color);
  color: var(--brand-blue);
  transform: translateY(-2px);
}

.top-bar .icon-btn i {
  font-size: 1.1rem;
}

/* Badge de Notificação */
.top-bar .badge-notification {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  min-width: 18px;
  text-align: center;
}

/* ========== PRODUCT SWITCHER ========== */
.top-bar .product-switcher {
  position: relative;
  display: flex;
}

.top-bar .product-switcher button {
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-teal) 100%);
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(38, 70, 179, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.top-bar .product-switcher button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.top-bar .product-switcher button:hover::before {
  width: 300px;
  height: 300px;
}

.top-bar .product-switcher button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(38, 70, 179, 0.3);
}

.top-bar .product-switcher .hidden-label {
  display: inline;
  font-weight: 600;
}

.top-bar .product-switcher .dropdown-arrow {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.top-bar .product-switcher.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Opções do dropdown */
.top-bar .product-switcher .switcher-options {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--border-color);
  overflow: hidden;
  display: none;
  z-index: 1000;
  animation: slideDown 0.3s ease;
}

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

.top-bar .product-switcher.open .switcher-options {
  display: block;
}

.top-bar .switcher-options li {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.3s ease;
  border-bottom: 1px solid #f1f5f9;
}

.top-bar .switcher-options li:last-child {
  border-bottom: none;
}

.top-bar .switcher-options li:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transform: translateX(4px);
}

.top-bar .option-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.top-bar .switcher-options li:hover .option-icon {
  transform: scale(1.1);
}

.top-bar .switcher-options li[data-service="assistenteIA"] .option-icon {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.top-bar .switcher-options li[data-service="assistenteIA"] .option-icon i {
  color: #3b82f6;
  font-size: 1.2rem;
}

.top-bar .switcher-options li[data-service="disparoMensagens"] .option-icon {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.top-bar .switcher-options li[data-service="disparoMensagens"] .option-icon i {
  color: #22c55e;
  font-size: 1.2rem;
}

.top-bar .option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-bar .option-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.top-bar .option-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Itens desativados */
.top-bar .switcher-options li.disabled {
  color: #a0a0a0;
  cursor: not-allowed;
  background-color: #fafafa;
  opacity: 0.6;
}

.top-bar .switcher-options li.disabled:hover {
  transform: none;
  background-color: #fafafa;
}

.top-bar .switcher-options li.disabled::after {
  content: '\f023';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: auto;
  color: #a0a0a0;
}

/* Switcher bloqueado */
.top-bar .product-switcher.locked button {
  background: linear-gradient(135deg, #cbd5e0 0%, #94a3b8 100%);
  box-shadow: none;
  cursor: not-allowed;
}

.top-bar .product-switcher.locked button:hover {
  transform: none;
}

/* ========== NOTIFICATION SYSTEM ========== */
.top-bar .notification-system {
  position: relative;
}

.top-bar .notification-button {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 2px solid transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.top-bar .notification-button:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: var(--border-color);
  color: var(--brand-blue);
  transform: translateY(-2px);
}

.top-bar .notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}

.top-bar .notification-badge.hidden {
  display: none;
}

/* Notification Dropdown */
.top-bar .notification-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 380px;
  max-height: 500px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--border-color);
  overflow: hidden;
  display: none;
  z-index: 1000;
  animation: slideDown 0.3s ease;
}

.top-bar .notification-system.open .notification-dropdown {
  display: block;
}

.top-bar .notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.top-bar .notification-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.top-bar .mark-read-btn {
  background: transparent;
  border: none;
  color: var(--brand-blue);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.top-bar .mark-read-btn:hover {
  background: rgba(38, 70, 179, 0.1);
  transform: scale(1.1);
}

.top-bar .notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.top-bar .notification-list::-webkit-scrollbar {
  width: 6px;
}

.top-bar .notification-list::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.top-bar .notification-list::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.top-bar .notification-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.top-bar .notification-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 0.75rem;
  position: relative;
}

.top-bar .notification-item:hover {
  background: #f8fafc;
}

.top-bar .notification-item.unread {
  background: #eff6ff;
  border-left: 3px solid var(--brand-blue);
}

.top-bar .notification-item.unread:hover {
  background: #dbeafe;
}

.top-bar .notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.top-bar .notification-item.info .notification-icon {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #2563eb;
}

.top-bar .notification-item.warning .notification-icon {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #d97706;
}

.top-bar .notification-item.success .notification-icon {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #059669;
}

.top-bar .notification-item.error .notification-icon {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #dc2626;
}

.top-bar .notification-content {
  flex: 1;
  min-width: 0;
}

.top-bar .notification-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.top-bar .notification-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.top-bar .notification-time {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.top-bar .notification-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.top-bar .notification-empty i {
  font-size: 2.5rem;
  color: #cbd5e0;
  margin-bottom: 0.75rem;
  display: block;
}

.top-bar .notification-empty p {
  margin: 0;
  font-size: 0.9rem;
}

/* ========== TOOLTIPS ========== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 10000;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  border: 6px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 10001;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== SKELETON LOADER ========== */
.top-bar .skeleton-screen {
  display: none;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 2rem;
}

.top-bar .skeleton {
  background: #e2e8f0;
  background-image: linear-gradient(90deg, #e2e8f0 0%, #f8fafc 50%, #e2e8f0 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.top-bar .skeleton-brand {
  width: 180px;
  height: 40px;
  border-radius: 10px;
}

.top-bar .skeleton-indicator {
  width: 150px;
  height: 36px;
  border-radius: 20px;
}

.top-bar .skeleton-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.top-bar .skeleton-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.top-bar .skeleton-switcher {
  width: 140px;
  height: 40px;
  border-radius: 10px;
}

.top-bar .skeleton-notification {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

/* Controle de exibição */
body.logging-out .top-bar .real-content {
  display: none;
}

body.logging-out .top-bar .skeleton-screen {
  display: flex;
}

body:not(.logging-out) .top-bar .skeleton-screen {
  display: none;
}

body:not(.logging-out) .top-bar .real-content {
  display: flex;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .top-bar .brand-tagline {
    display: none;
  }
  
  .top-bar .user-name {
    display: none;
  }
  
  .top-bar .panel-indicator {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .top-bar {
    padding: 0 1rem;
    left: var(--sidebar-collapsed-width);
  }
  
  .top-bar .real-content {
    gap: 0.5rem;
  }
  
  .top-bar .brand-info {
    display: none;
  }
  
  .top-bar .actions-section {
    gap: 0.5rem;
  }
  
  .top-bar .product-switcher .hidden-label {
    display: none;
  }
  
  .top-bar .panel-indicator .indicator-text {
    display: none;
  }
  
  .top-bar .notification-dropdown {
    width: 320px;
    right: -10px;
  }
  
  [data-tooltip]::after {
    font-size: 0.75rem;
    padding: 6px 10px;
    white-space: normal;
    max-width: 180px;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 0 0.75rem;
  }
  
  .top-bar .icon-btn:first-child {
    display: none;
  }
  
  .top-bar .panel-indicator {
    padding: 0.4rem 0.6rem;
  }
}

/* Ajuste no body */
body.has-top-bar {
  padding-top: var(--header-height);
}

/* ========================================
   FIM DO HEADER MODERNIZADO
======================================== */
