/**
 * Topbar Component Styles
 * Glass effect header with 3D elements
 */

/* ═══════════════════════════════════════════════════════════════════
   TOPBAR BASE - GLASS EFFECT
   ═══════════════════════════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-6);

  /* Glass effect */
  background: rgba(var(--color-surface-rgb, 15, 23, 42), 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 30px rgba(var(--shadow-color, 0, 0, 0), 0.2),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 var(--space-4);
    gap: var(--space-3);
    height: 60px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   TOPBAR LOGO - MOBILE ONLY (pe desktop e în sidebar)
   ═══════════════════════════════════════════════════════════════════ */
.topbar-logo.topbar-logo-mobile {
  display: none; /* Ascuns pe desktop */
  align-items: center;
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: none;
  transition: all 0.3s ease;
}

.topbar-logo.topbar-logo-mobile:hover {
  transform: translateY(-2px);
  box-shadow: none;
}

.topbar-logo.topbar-logo-mobile img {
  height: 32px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Pe mobil - afiseaza logo-ul */
@media (max-width: 1024px) {
  .topbar-logo.topbar-logo-mobile {
    display: flex;
    padding: var(--space-2);
  }

  .topbar-logo.topbar-logo-mobile img {
    height: 28px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE MENU BUTTON - HIDDEN (using bottom nav instead)
   ═══════════════════════════════════════════════════════════════════ */
.topbar-menu-btn {
  display: none !important;
}

/* Mobile Login Button (replaces hamburger) */
.topbar-login-btn {
  display: none;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: var(--font-semibold);
  white-space: nowrap;
  box-shadow:
    0 6px 18px rgba(14, 165, 233, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
}

.topbar-login-btn:hover {
  background: rgba(14, 165, 233, 0.9);
  border-color: rgba(14, 165, 233, 0.9);
  color: #fff;
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════
   SEARCH - GLASS INPUT
   ═══════════════════════════════════════════════════════════════════ */
.topbar-search {
  flex: 1;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-10) 0 var(--space-10);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  transition: all 0.25s ease;
  box-shadow:
    inset 2px 2px 6px rgba(0, 0, 0, 0.15),
    inset -1px -1px 4px rgba(255, 255, 255, 0.03);
}

.search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(14, 165, 233, 0.5);
  box-shadow:
    0 0 0 3px rgba(14, 165, 233, 0.15),
    inset 2px 2px 6px rgba(0, 0, 0, 0.1);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-shortcut {
  position: absolute;
  right: var(--space-3);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  pointer-events: none;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
  .search-shortcut {
    display: none;
  }

  .topbar-search {
    display: none;
  }

  .topbar-login-btn {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   ACTIONS - GLASS BUTTONS
   ═══════════════════════════════════════════════════════════════════ */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.topbar-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all 0.25s ease;
  text-decoration: none;
  box-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--color-text);
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topbar-btn svg {
  width: 20px;
  height: 20px;
}

/* 3D Icon Button - pentru Home pe mobil */
.topbar-btn-3d {
  width: 44px;
  height: 44px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow:
    3px 3px 10px rgba(59, 130, 246, 0.4),
    -1px -1px 6px rgba(255, 255, 255, 0.05),
    inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.topbar-btn-3d:hover {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  color: #fff;
  box-shadow:
    0 6px 20px rgba(59, 130, 246, 0.5),
    inset 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.topbar-btn-3d:active {
  box-shadow:
    inset 2px 2px 5px rgba(0, 0, 0, 0.3),
    inset -1px -1px 3px rgba(255, 255, 255, 0.1);
  transform: scale(0.95);
}

.topbar-btn-3d svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Badge - Glass style */
.topbar-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-bold);
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border-radius: var(--radius-full);
  border: 2px solid rgba(var(--color-surface-rgb, 15, 23, 42), 0.9);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

.topbar-badge:empty,
.topbar-badge[data-count="0"] {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   USER AVATAR - GLASS FRAME
   ═══════════════════════════════════════════════════════════════════ */
.topbar-user {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: var(--space-2);
  padding: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  transition: all 0.25s ease;
  box-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.topbar-user:hover {
  border-color: rgba(14, 165, 233, 0.5);
  box-shadow:
    0 0 0 3px rgba(14, 165, 233, 0.15),
    2px 2px 8px rgba(0, 0, 0, 0.15);
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}

@media (max-width: 640px) {
  .topbar-user {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE: LOGO + HOME ICON 3D
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Ascunde hamburger-ul */
  .topbar-menu-btn {
    display: none !important;
  }

  /* Ascunde butoanele de notificări și mesaje */
  .topbar-btn#btnNotificari,
  .topbar-btn#btnMesaje {
    display: none !important;
  }

  /* Ascunde search-ul complet */
  .topbar-search {
    display: none !important;
  }

  /* Ascunde avatar pe mobil */
  .topbar-user {
    display: none !important;
  }

  /* Ascunde butoanele din topbar pe mobil (lasă doar logo) */
  .topbar-home-btn {
    display: none !important;
  }

  .topbar-actions {
    display: none !important;
  }

  /* Topbar layout pe mobil */
  .topbar {
    justify-content: space-between;
    padding: 0 var(--space-3);
  }

  /* Logo vizibil pe mobil cu frame portocaliu */
  .topbar-logo.topbar-logo-mobile {
    display: flex !important;
  }
}



/* ═══════════════════════════════════════════════════════════════════
   TOPBAR DROPDOWNS — notificări / mesaje / cont
   Panouri ancorate sub butonul lor. Ascunse până când JS pune `.open`.
   (Butoanele din topbar sunt oricum vizibile doar pe desktop.)
   ═══════════════════════════════════════════════════════════════════ */
.topbar-action {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: min(340px, calc(100vw - 32px));
  max-height: min(440px, calc(100vh - 90px));
  overflow: hidden auto;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: var(--radius-xl, 16px);
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  /* stare închisă */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: var(--z-dropdown, 1200);
}
.topbar-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.topbar-dropdown--user { width: 236px; }

.topbar-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar-dropdown-head > span {
  font-weight: var(--font-semibold, 600);
  font-size: 14px;
  color: var(--color-text, #e2e8f0);
}
.topbar-dropdown-all {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-primary, #0ea5e9);
  text-decoration: none;
}
.topbar-dropdown-all:hover { text-decoration: underline; }

.topbar-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* rând gol / stare de încărcare */
.dropdown-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--color-text-muted, #94a3b8);
  font-size: 13.5px;
  text-align: center;
}
.dropdown-empty i { font-size: 26px; opacity: .6; }

/* notificări */
.notification-item {
  display: flex;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-lg, 12px);
  cursor: default;
  transition: background .15s ease;
}
.notification-item:hover { background: rgba(255, 255, 255, 0.05); }
.notification-item.unread { background: rgba(14, 165, 233, 0.10); }
.notification-icon {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.14);
  color: var(--color-primary, #0ea5e9);
  font-size: 17px;
}
.notification-content { min-width: 0; }
.notification-text {
  margin: 0;
  font-size: 13.2px;
  line-height: 1.4;
  color: var(--color-text, #e2e8f0);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notification-time {
  font-size: 11.5px;
  color: var(--color-text-muted, #94a3b8);
}

/* mesaje */
.topbar-msg-item {
  display: flex;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  transition: background .15s ease;
}
.topbar-msg-item:hover { background: rgba(255, 255, 255, 0.05); }
.topbar-msg-item.unread { background: rgba(14, 165, 233, 0.10); }
.topbar-msg-avatar {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.topbar-msg-body { min-width: 0; flex: 1; }
.topbar-msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.topbar-msg-name {
  font-size: 13.2px; font-weight: 600;
  color: var(--color-text, #e2e8f0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-msg-time { flex: 0 0 auto; font-size: 11px; color: var(--color-text-muted, #94a3b8); }
.topbar-msg-preview {
  margin: 2px 0 0;
  font-size: 12.6px; line-height: 1.35;
  color: var(--color-text-muted, #94a3b8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* meniul contului */
.topbar-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-lg, 12px);
  color: var(--color-text, #e2e8f0);
  text-decoration: none;
  font-size: 13.6px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.topbar-menu-link i { font-size: 18px; color: var(--color-text-muted, #94a3b8); }
.topbar-menu-link:hover { background: rgba(255, 255, 255, 0.06); }
.topbar-menu-link--danger { color: #fb7185; }
.topbar-menu-link--danger i { color: #fb7185; }
.topbar-menu-link--danger:hover { background: rgba(251, 113, 133, 0.12); }

@media (prefers-reduced-motion: reduce) {
  .topbar-dropdown { transition: opacity .12s ease, visibility .12s; transform: none; }
  .topbar-dropdown.open { transform: none; }
}

/* SVG-uri inline în dropdown-uri (pagina nu are fontul Phosphor) */
.notification-icon svg { width: 17px; height: 17px; }
.dropdown-empty svg { width: 26px; height: 26px; opacity: .55; }
.topbar-menu-link svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--color-text-muted, #94a3b8); }
.topbar-menu-link--danger svg { color: #fb7185; }
