/* ============================================
   TOP-BAR PROFESSIONAL - МИРОВОЙ УРОВЕНЬ
   Создано: 2025-10-31
   Вдохновлено: Apple, Notion, Linear
   ============================================ */

/* === ОСНОВА TOP-BAR === */
header.top-bar-global {
  margin-left: 280px; /* Ширина sidebar */
  width: calc(100% - 280px); /* Вычитаем ширину sidebar */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px !important;
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04),
              0 8px 24px rgba(0, 0, 0, 0.02);
  backdrop-filter: blur(20px) !important;
  position: fixed;
  top: 0;
  z-index: 1000;
  min-height: 64px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header.top-bar-global:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06),
              0 12px 32px rgba(0, 0, 0, 0.04);
}

/* === СЕКЦИИ === */
.top-bar-global .top-bar-left,
.top-bar-global .top-bar-center,
.top-bar-global .top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.top-bar-global .top-bar-left {
  flex: 0 0 240px;
}

.top-bar-global .top-bar-center {
  flex: 1;
  justify-content: center;
  max-width: 680px;
}

.top-bar-global .top-bar-right {
  flex: 0 0 240px;
  justify-content: flex-end;
}

/* === ЛОГОТИП === */
.top-bar-global .top-bar-logo-link {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.top-bar-global .top-bar-logo-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(147, 51, 234, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 12px;
}

.top-bar-global .top-bar-logo-link:hover::before {
  opacity: 1;
}

.top-bar-global .top-bar-logo-link:hover {
  transform: translateY(-1px);
}

.top-bar-global .top-bar-logo-img {
  height: 40px !important;
  max-height: 40px !important;
  width: auto !important;
  max-width: 180px !important;
  object-fit: contain !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
  transition: filter 0.3s;
}

.top-bar-global .top-bar-logo-link:hover .top-bar-global .top-bar-logo-img {
  filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.2));
}

/* === ГЛОБАЛЬНЫЙ ПОИСК === */
.top-bar-global .global-search {
  position: relative;
  width: 100%;
  max-width: 560px;
}

.top-bar-global .global-search i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 18px;
  transition: all 0.3s;
  z-index: 2;
}

.top-bar-global .top-bar-global .global-search-input {
  width: 100%;
  padding: 14px 20px 14px 52px;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 500;
  color: #1f2937;
  background: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.top-bar-global .top-bar-global .global-search-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.top-bar-global .top-bar-global .global-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12),
              0 0 0 4px rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
}

.top-bar-global .global-search:has(.top-bar-global .top-bar-global .global-search-input:focus) i {
  color: #3b82f6;
  transform: translateY(-50%) scale(1.1);
}

/* Результаты поиска */
.top-bar-global .top-bar-global .global-search-results {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12),
              0 4px 16px rgba(0, 0, 0, 0.08);
  max-height: 480px;
  overflow-y: auto;
  display: none;
  z-index: 9999;
  border: 1px solid rgba(0, 0, 0, 0.06);
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.search-section {
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}

.search-section:last-child {
  border-bottom: none;
}

.search-section-title {
  padding: 8px 24px;
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-section-title i {
  font-size: 14px;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.search-item:hover {
  background: linear-gradient(90deg, #f0f9ff 0%, #e0f2fe 100%);
  padding-left: 28px;
}

.search-item-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  flex-shrink: 0;
}

.search-item:hover .search-item-icon {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.search-item-info {
  flex: 1;
  min-width: 0;
}

.search-item-name {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-meta {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results,
.search-error {
  padding: 48px 24px;
  text-align: center;
  color: #6b7280;
  font-size: 15px;
}

.search-error {
  color: #ef4444;
}

/* === ИКОНКА КНОПКА === */
.top-bar-global .top-bar-icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.top-bar-global .top-bar-icon-btn:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.top-bar-global .top-bar-icon-btn:active {
  transform: translateY(0);
}

.top-bar-global .top-bar-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

/* === ПРОФИЛЬ === */
.top-bar-global .top-bar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 14px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.top-bar-global .top-bar-profile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.03) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.top-bar-global .top-bar-profile:hover::before {
  opacity: 1;
}

.top-bar-global .top-bar-profile:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.15);
}

.top-bar-global .top-bar-avatar {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: all 0.3s;
}

.top-bar-global .top-bar-profile:hover .top-bar-global .top-bar-avatar {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.top-bar-global .top-bar-username {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  transition: color 0.3s;
}

.top-bar-global .top-bar-profile:hover .top-bar-global .top-bar-username {
  color: #3b82f6;
}

.top-bar-global .top-bar-profile i {
  font-size: 12px;
  color: #9ca3af;
  transition: all 0.3s;
}

.top-bar-global .top-bar-profile:hover i {
  color: #3b82f6;
  transform: rotate(180deg);
}

/* Dropdown меню */
.dropdown-menu {
  border: none;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12),
              0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 8px;
  margin-top: 12px;
  min-width: 220px;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-item {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dropdown-item i {
  width: 18px;
  color: #6b7280;
  transition: color 0.2s;
}

.dropdown-item:hover {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #3b82f6;
  padding-left: 20px;
}

.dropdown-item:hover i {
  color: #3b82f6;
}

.dropdown-divider {
  margin: 8px 0;
  border-top: 1px solid #f3f4f6;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  header.top-bar-global {
    margin-left: 240px !important;
    width: calc(100% - 240px) !important;
  }
}

@media (max-width: 900px) {
  header.top-bar-global {
    margin-left: 72px !important;
    width: calc(100% - 72px) !important;
  }
}

@media (max-width: 1024px) {
  header.top-bar-global {
  margin-left: 280px; /* Ширина sidebar */
  width: calc(100% - 280px); /* Вычитаем ширину sidebar */
    padding: 10px 20px;
  }
  
  .top-bar-global .top-bar-left,
  .top-bar-global .top-bar-right {
    flex: 0 0 auto;
  }
  
  .top-bar-global .global-search {
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  .top-bar-global .top-bar-username {
    display: none;
  }
  
  .top-bar-global .top-bar-global .global-search-input {
    font-size: 14px;
    padding: 12px 16px 12px 48px;
  }
  
  header.top-bar-global {
  margin-left: 280px; /* Ширина sidebar */
  width: calc(100% - 280px); /* Вычитаем ширину sidebar */
    padding: 8px 16px;
    gap: 12px;
  }
}

/* === DARK MODE === */
body.dark-theme header.top-bar-global {
  margin-left: 280px; /* Ширина sidebar */
  width: calc(100% - 280px); /* Вычитаем ширину sidebar */
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .top-bar-global .top-bar-global .global-search-input {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

body.dark-theme .top-bar-global .top-bar-global .global-search-input::placeholder {
  color: #9ca3af;
}

body.dark-theme .top-bar-global .top-bar-icon-btn {
  background: #374151;
  color: #9ca3af;
}

body.dark-theme .top-bar-global .top-bar-profile {
  background: #374151;
  border-color: #4b5563;
}

body.dark-theme .top-bar-global .top-bar-username {
  color: #f3f4f6;
}






/* ========================================
   NOTIFICATION DROPDOWN
   ======================================== */

.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  max-height: 400px;
  overflow-y: auto;
}

.notification-list {
  max-height: 350px;
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.2s;
}

.notification-item:hover {
  background: #f9fafb;
}

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

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
}

.notification-icon.new-appointment {
  background: #dbeafe;
  color: #2563eb;
}

.notification-icon.new-payment {
  background: #d1fae5;
  color: #059669;
}

.notification-icon.debt {
  background: #fee2e2;
  color: #dc2626;
}

.notification-text {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  margin-bottom: 2px;
}

.notification-subtitle {
  font-size: 12px;
  color: #6b7280;
}

.notification-time {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}
