/* components/topbar/topbar.css */
/* Topbar Component */

/* ========================================
   TOPBAR CONTAINER
   ======================================== */

.c-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-topbar-height, 64px);
  min-height: var(--nav-topbar-height, 64px);
  background: var(--ds-color-surface);
  border-bottom: 1px solid var(--ds-color-border);
  padding: 0 var(--ds-space-l);
  flex-shrink: 0;
  position: relative;
  z-index: var(--nav-z-topbar, 50);
}

/* ========================================
   TOPBAR SECTIONS
   ======================================== */

.c-topbar__left {
  display: flex;
  align-items: center;
  gap: var(--ds-space-m);
  flex-shrink: 0;
}

.c-topbar__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 600px;
  margin: 0 var(--ds-space-l);
}

.c-topbar__right {
  display: flex;
  align-items: center;
  gap: var(--ds-space-m);
  flex-shrink: 0;
}

/* ========================================
   TOPBAR BUTTON
   ======================================== */

.c-topbar__button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-m);
  color: var(--ds-color-icon);
  cursor: pointer;
  transition: all var(--ds-duration-fast) var(--ds-ease-out);
  position: relative;
}

.c-topbar__button:hover {
  background: var(--ds-color-surface-hover);
  border-color: var(--ds-color-border);
  color: var(--ds-color-text);
}

.c-topbar__button:focus-visible {
  outline: var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);
  outline-offset: var(--ds-focus-ring-offset);
}

/* ========================================
   TOPBAR SEARCH
   ======================================== */

.c-topbar__search {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.c-topbar__search-input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 var(--ds-space-m);
  background: var(--ds-color-surface-raised);
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-m);
  font-size: var(--ds-font-size-m);
  color: var(--ds-color-text);
  transition: all var(--ds-duration-fast) var(--ds-ease-out);
}

.c-topbar__search-input::placeholder {
  color: var(--ds-color-text-weaker);
}

.c-topbar__search-input:focus {
  outline: none;
  border-color: var(--ds-color-accent);
  background: var(--ds-color-surface);
  box-shadow: 0 0 0 3px rgba(var(--ds-color-accent-rgb), 0.1);
}

.c-topbar__search--focused .c-topbar__search-input {
  border-color: var(--ds-color-accent);
  background: var(--ds-color-surface);
}

.c-topbar__search-button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ds-color-icon);
  cursor: pointer;
  transition: color var(--ds-duration-fast) var(--ds-ease-out);
}

.c-topbar__search-button:hover {
  color: var(--ds-color-accent);
}

.c-topbar__search-clear {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--ds-color-surface-raised);
  border: none;
  border-radius: var(--ds-radius-s);
  color: var(--ds-color-icon);
  cursor: pointer;
  transition: all var(--ds-duration-fast) var(--ds-ease-out);
}

.c-topbar__search-clear:hover {
  background: var(--ds-color-surface-hover);
  color: var(--ds-color-text);
}

/* ========================================
   NOTIFICATION BADGE
   ======================================== */

.c-topbar__notification-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--ds-color-danger);
  color: white;
  font-size: 11px;
  font-weight: var(--ds-font-weight-bold);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ========================================
   TOPBAR DROPDOWN
   ======================================== */

.c-topbar__dropdown {
  position: relative;
}

.c-topbar__dropdown-menu {
  position: absolute;
  top: calc(100% + var(--ds-space-s));
  right: 0;
  min-width: 200px;
  background: var(--ds-color-surface);
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-l);
  box-shadow: var(--ds-shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--ds-duration-fast) var(--ds-ease-out);
  z-index: var(--nav-z-dropdown, 100);
}

.c-topbar__dropdown--open .c-topbar__dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.c-topbar__dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--ds-space-m);
  padding: var(--ds-space-s) var(--ds-space-l);
  color: var(--ds-color-text);
  text-decoration: none;
  transition: background var(--ds-duration-fast) var(--ds-ease-out);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: var(--ds-font-size-m);
}

.c-topbar__dropdown-item:hover {
  background: var(--ds-color-surface-hover);
}

.c-topbar__dropdown-item:focus-visible {
  outline: var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);
  outline-offset: calc(var(--ds-focus-ring-offset) * -1);
}

.c-topbar__dropdown-divider {
  height: 1px;
  background: var(--ds-color-border);
  margin: var(--ds-space-xs) 0;
}

/* ========================================
   USER AVATAR
   ======================================== */

.c-topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ds-color-accent);
  color: var(--ds-color-text-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ds-font-size-s);
  font-weight: var(--ds-font-weight-semibold);
  overflow: hidden;
}

.c-topbar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (min-width: 1024px) {
  .c-topbar__button[data-cms-control-sidebar-internal-left="nav"] {
    display: none;
  }
}
/*  .c-topbar__button:not([data-cms-control-sidebar-internal-left="nav"]) {
    display: none;
  }
}*/

@media (max-width: 768px) {
  [data-cms-control-sidebar-mode="floating"] {
    display: none;
  }
  .c-topbar {
    padding: 0 var(--ds-space-m);
  }
  
  .c-topbar__center {
    display: none;
  }
  
  .c-topbar__button {
    width: 36px;
    height: 36px;
  }
  
  .c-topbar__left,
  .c-topbar__right {
    gap: var(--ds-space-s);
  }
}

@media (max-width: 480px) {
/*  .c-topbar__button:not([data-cms-control-sidebar]) {
    display: none;
  }*/
  
  .c-topbar__right .c-topbar__button:first-child,
  .c-topbar__right .c-topbar__button:nth-child(2) {
    display: flex;
  }
}

/* ========================================
   DARK THEME
   ======================================== */

[data-theme="dark"] .c-topbar {
  background: var(--ds-color-surface);
  border-bottom-color: var(--ds-color-border);
}

[data-theme="dark"] .c-topbar__search-input {
  background: var(--ds-color-surface-raised);
  border-color: var(--ds-color-border);
}

[data-theme="dark"] .c-topbar__search-input:focus {
  background: var(--ds-color-surface);
  border-color: var(--ds-color-accent);
}

[data-theme="dark"] .c-topbar__dropdown-menu {
  background: var(--ds-color-surface);
  border-color: var(--ds-color-border);
  box-shadow: var(--ds-shadow-xl);
}

/* ========================================
   PRINT
   ======================================== */

@media print {
  .c-topbar {
    display: none;
  }
}