/* =========================================================
   WIRTZ HUB · TOPBAR
   Barra superior premium · minimalista · responsive · dark safe
   Foto de perfil integrada
   Fuente base: ATF Franklin Gothic
   ========================================================= */

/* =========================================================
   TOPBAR BASE
   ========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: var(--topbar-height);
  padding: 0 12px;

  border-bottom: 1px solid rgba(0, 0, 0, 0.16);
  background: color-mix(in srgb, var(--panel-solid) 96%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.035),
    0 10px 28px rgba(0, 0, 0, 0.035);

  font-family:
    "ATF Franklin Gothic",
    "Franklin Gothic Medium",
    "Arial Narrow",
    Arial,
    sans-serif;

  animation: topbarEnter 0.28s ease both;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    min-height var(--transition),
    padding var(--transition);
}

html[data-theme="dark"] .topbar {
  border-bottom-color: rgba(255, 255, 255, 0.13);
  background: rgba(8, 8, 8, 0.92);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.035),
    0 10px 28px rgba(0, 0, 0, 0.28);
}

/* =========================================================
   LADO IZQUIERDO
   ========================================================= */

.topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar__title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.topbar__title span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.topbar__title h1 {
  max-width: clamp(190px, 44vw, 640px);
  margin: 0;

  color: var(--text-strong);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.05;
  letter-spacing: -0.035em;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .topbar__title h1 {
  color: rgba(255, 255, 255, 0.94);
}

html[data-theme="dark"] .topbar__title span {
  color: rgba(255, 255, 255, 0.52);
}

/* =========================================================
   LADO DERECHO · FORMATO LINEAL
   ========================================================= */

.topbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;

  min-width: 0;
  flex: 0 1 auto;

  color: var(--text);
}

.topbar__divider {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 20px;
  min-width: 20px;

  color: rgba(0, 0, 0, 0.26);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;

  pointer-events: none;
  user-select: none;
}

html[data-theme="dark"] .topbar__divider {
  color: rgba(255, 255, 255, 0.22);
}

/* =========================================================
   BOTONES LINEALES
   ========================================================= */

.topbar__icon-btn,
.topbar__action,
.topbar__user {
  font-family:
    "ATF Franklin Gothic",
    "Franklin Gothic Medium",
    "Arial Narrow",
    Arial,
    sans-serif;
}

.topbar__icon-btn,
.topbar__action {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-height: 31px;
  padding: 0 8px;

  border: 0;
  border-radius: 9px;
  background: transparent;

  color: var(--text);
  font-size: 10.5px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;

  cursor: pointer;
  outline: none;

  transition:
    background var(--transition),
    color var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.topbar__icon-btn {
  width: 31px;
  min-width: 31px;
  padding: 0;
}

.topbar__icon-btn:hover,
.topbar__action:hover {
  background: rgba(0, 0, 0, 0.055);
  color: var(--text-strong);
}

html[data-theme="dark"] .topbar__icon-btn,
html[data-theme="dark"] .topbar__action {
  color: rgba(255, 255, 255, 0.74);
}

html[data-theme="dark"] .topbar__icon-btn:hover,
html[data-theme="dark"] .topbar__action:hover {
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.96);
}

.topbar__icon-btn:active,
.topbar__action:active,
.topbar__user:active {
  transform: scale(0.96);
}

.topbar__icon-btn:focus-visible,
.topbar__action:focus-visible,
.topbar__user:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text-strong) 18%, transparent);
}

/* Botón salir minimalista */
.topbar__action--danger {
  color: var(--text-strong);
}

.topbar__action--danger:hover {
  background: rgba(230, 0, 0, 0.08);
  color: #e60000;
}

html[data-theme="dark"] .topbar__action--danger {
  color: rgba(255, 255, 255, 0.84);
}

html[data-theme="dark"] .topbar__action--danger:hover {
  background: rgba(230, 0, 0, 0.16);
  color: #ff4b4b;
}

/* =========================================================
   USUARIO LINEAL + FOTO
   ========================================================= */

.topbar__user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  min-height: 32px;
  max-width: 280px;

  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;

  color: var(--text);

  line-height: 1;
  white-space: nowrap;
  overflow: hidden;

  cursor: pointer;
  outline: none;

  transition:
    background var(--transition),
    color var(--transition),
    opacity var(--transition),
    transform var(--transition);
}

.topbar__user:hover {
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .topbar__user:hover {
  background: rgba(255, 255, 255, 0.065);
}

.topbar__avatar {
  display: inline-grid;
  place-items: center;

  width: 30px;
  height: 30px;
  min-width: 30px;

  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background:
    linear-gradient(
      135deg,
      rgba(230, 0, 0, 0.08),
      rgba(0, 0, 0, 0.035)
    );

  color: var(--text-strong);

  overflow: hidden;

  font-size: 10px;
  font-weight: 950;
  letter-spacing: -0.035em;

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 8px 18px rgba(0, 0, 0, 0.055);

  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    filter var(--transition);
}

.topbar__user:hover .topbar__avatar {
  transform: translateY(-1px);
  border-color: rgba(230, 0, 0, 0.38);
  filter: saturate(1.08);
}

html[data-theme="dark"] .topbar__avatar {
  border-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(
      135deg,
      rgba(230, 0, 0, 0.2),
      rgba(255, 255, 255, 0.055)
    );

  color: rgba(255, 255, 255, 0.92);

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.055) inset,
    0 8px 18px rgba(0, 0, 0, 0.24);
}

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

.topbar__avatar--photo {
  padding: 0;
  background: rgba(0, 0, 0, 0.035);
}

.topbar__avatar .icon {
  width: 13px;
  height: 13px;
}

.topbar__user-info {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  min-width: 0;
  overflow: hidden;
}

.topbar__user-name {
  max-width: 145px;

  color: var(--text-strong);
  font-size: 10.8px;
  font-weight: 900;

  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__user-separator {
  color: rgba(0, 0, 0, 0.24);
  font-size: 10px;
  font-weight: 700;
}

.topbar__user-role {
  max-width: 112px;

  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;

  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .topbar__user-name {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .topbar__user-role {
  color: rgba(255, 255, 255, 0.5);
}

html[data-theme="dark"] .topbar__user-separator {
  color: rgba(255, 255, 255, 0.22);
}

/* =========================================================
   ICONOS
   ========================================================= */

.topbar .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.15;
}

/* =========================================================
   ESTADOS GLOBALES
   ========================================================= */

:root[data-sidebar="hidden"] #sidebarToggleBtn i {
  opacity: 0.82;
}

:root[data-rightbar="hidden"] #rightbarToggleBtn {
  opacity: 0.72;
}

/* =========================================================
   RESPONSIVE · TABLET
   ========================================================= */

@media (max-width: 980px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 80;

    min-height: 46px;
    padding: 6px 9px;

    border-bottom-color: rgba(0, 0, 0, 0.12);
  }

  .topbar__title h1 {
    max-width: clamp(160px, 42vw, 390px);
    font-size: 14px;
  }

  .topbar__title span {
    font-size: 8.5px;
  }

  .topbar__user {
    max-width: 225px;
  }

  .topbar__user-name {
    max-width: 108px;
  }

  .topbar__user-role {
    max-width: 84px;
  }
}

@media (max-width: 820px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;

    min-height: 46px;
    padding: 6px 8px;
  }

  .topbar__left {
    width: auto;
    min-width: 0;
  }

  .topbar__right {
    width: auto;
    max-width: 48vw;

    justify-content: flex-end;

    overflow-x: auto;
    overflow-y: hidden;

    padding-bottom: 0;

    scrollbar-width: none;
  }

  .topbar__right::-webkit-scrollbar {
    display: none;
  }

  .topbar__title span {
    display: none;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 196px);
    font-size: 13.5px;
  }

  .topbar__icon-btn,
  .topbar__action,
  .topbar__user {
    min-height: 31px;
  }

  .topbar__user {
    flex: 0 0 auto;
  }
}

/* =========================================================
   RESPONSIVE · MOBILE
   ========================================================= */

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;

    min-height: 44px;
    gap: 6px;
    padding: 5px 7px;
  }

  .topbar__left {
    gap: 6px;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 182px);
    font-size: 13px;
    letter-spacing: -0.03em;
  }

  .topbar__divider {
    display: none;
  }

  .topbar__action span {
    display: none;
  }

  .topbar__action {
    width: 31px;
    min-width: 31px;
    height: 31px;
    min-height: 31px;
    padding: 0;
  }

  .topbar__icon-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.04);
  }

  html[data-theme="dark"] .topbar__icon-btn {
    background: rgba(255, 255, 255, 0.06);
  }

  .topbar__right {
    max-width: 124px;
    gap: 4px;
  }

  .topbar__user {
    width: 31px;
    min-width: 31px;
    max-width: 31px;
    height: 31px;
    min-height: 31px;
    padding: 0;
  }

  .topbar__avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .topbar__user-info {
    display: none;
  }

  .topbar .icon {
    width: 13px;
    height: 13px;
  }
}

@media (max-width: 420px) {
  .topbar {
    min-height: 43px;
    padding: 5px 6px;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 166px);
    font-size: 12.5px;
  }

  .topbar__right {
    max-width: 112px;
  }

  .topbar__icon-btn {
    width: 31px;
    min-width: 31px;
    height: 31px;
    min-height: 31px;
  }

  .topbar__action {
    width: 29px;
    min-width: 29px;
    height: 29px;
    min-height: 29px;
  }

  .topbar__user {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    min-height: 30px;
  }

  .topbar__avatar {
    width: 27px;
    height: 27px;
    min-width: 27px;
  }
}

@media (max-width: 340px) {
  .topbar__title h1 {
    max-width: calc(100vw - 152px);
    font-size: 12px;
  }

  .topbar__right {
    max-width: 100px;
  }
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes topbarEnter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar,
  .topbar *,
  .topbar *::before,
  .topbar *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}/* =========================================================
   TOPBAR · HORA USUARIO
   Hora/minutos elegante junto al rol
   ========================================================= */

.topbar__user-time {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 40px;

  color: var(--text-strong);

  font-size: 9.4px;
  font-weight: 950;
  letter-spacing: 0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;

  opacity: 0.86;

  white-space: nowrap;
}

.topbar__user-time::before {
  content: "";

  width: 5px;
  height: 5px;
  margin-right: 6px;

  border-radius: 999px;
  background: #16a34a;

  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

html[data-theme="dark"] .topbar__user-time {
  color: rgba(255, 255, 255, 0.86);
}

html[data-theme="dark"] .topbar__user-time::before {
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
}

.topbar__user-separator--time {
  opacity: 0.72;
}

/* Ajuste ancho por nueva hora */
.topbar__user {
  max-width: 340px;
}

.topbar__user-name {
  max-width: 135px;
}

.topbar__user-role {
  max-width: 98px;
}

/* =========================================================
   RESPONSIVE · HORA TOPBAR
   ========================================================= */

@media (max-width: 980px) {
  .topbar__user {
    max-width: 290px;
  }

  .topbar__user-name {
    max-width: 96px;
  }

  .topbar__user-role {
    max-width: 76px;
  }

  .topbar__user-time {
    min-width: 38px;
    font-size: 9px;
  }
}

@media (max-width: 820px) {
  .topbar__user-time,
  .topbar__user-separator--time {
    display: none;
  }

  .topbar__user {
    max-width: 225px;
  }
}

@media (max-width: 560px) {
  .topbar__user-time,
  .topbar__user-separator--time {
    display: none;
  }
}/* =========================================================
   TOPBAR · ACCESOS MENSAJES / NOTIFICACIONES
   ========================================================= */

.topbar__action--compact {
  padding-inline: 8px;
}

.topbar__action--notification {
  position: relative;
}

.topbar__badge {
  position: absolute;
  top: 6px;
  right: 6px;

  width: 6px;
  height: 6px;

  border-radius: 999px;
  background: #e60000;

  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--panel-solid) 96%, transparent),
    0 0 0 5px rgba(230, 0, 0, 0.1);

  opacity: 0;
  transform: scale(0.7);

  pointer-events: none;

  transition:
    opacity var(--transition),
    transform var(--transition);
}

/* 
   Cuando conectes notificaciones reales,
   agregás la clase .has-alert al botón:
   notificationsTopbarBtn.classList.add("has-alert")
*/

.topbar__action--notification.has-alert .topbar__badge {
  opacity: 1;
  transform: scale(1);
}

html[data-theme="dark"] .topbar__badge {
  background: #ff4b4b;
  box-shadow:
    0 0 0 2px rgba(8, 8, 8, 0.96),
    0 0 0 5px rgba(255, 75, 75, 0.16);
}

/* Hover más ejecutivo para accesos rápidos */

.topbar__action--compact:hover {
  background: rgba(230, 0, 0, 0.065);
  color: var(--text-strong);
}

html[data-theme="dark"] .topbar__action--compact:hover {
  background: rgba(230, 0, 0, 0.15);
  color: rgba(255, 255, 255, 0.96);
}

/* =========================================================
   RESPONSIVE · AJUSTE POR NUEVOS ICONOS
   ========================================================= */

@media (max-width: 980px) {
  .topbar__action--compact span {
    display: none;
  }

  .topbar__action--compact {
    width: 31px;
    min-width: 31px;
    height: 31px;
    min-height: 31px;
    padding: 0;
  }

  .topbar__user {
    max-width: 250px;
  }
}

@media (max-width: 820px) {
  .topbar__right {
    max-width: 206px;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 270px);
  }
}

@media (max-width: 560px) {
  .topbar__right {
    max-width: 168px;
    gap: 4px;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 218px);
  }

  .topbar__action--compact {
    width: 31px;
    min-width: 31px;
    height: 31px;
    min-height: 31px;
    padding: 0;
  }

  .topbar__badge {
    top: 5px;
    right: 5px;
    width: 5px;
    height: 5px;
  }
}

@media (max-width: 420px) {
  .topbar__right {
    max-width: 158px;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 204px);
  }

  .topbar__action--compact {
    width: 29px;
    min-width: 29px;
    height: 29px;
    min-height: 29px;
  }
}

@media (max-width: 340px) {
  .topbar__right {
    max-width: 148px;
  }

  .topbar__title h1 {
    max-width: calc(100vw - 190px);
  }
}/* =========================================================
   TOPBAR · TEXTO MÁS GRANDE
   Agregar al FINAL de topbar.css
   ========================================================= */

.topbar {
  min-height: 54px;
  padding-inline: 15px;
}

.topbar__title {
  gap: 4px;
}

.topbar__title span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.topbar__title h1 {
  max-width: clamp(220px, 46vw, 720px);

  font-size: 18px;
  font-weight: 950;
  line-height: 1.05;
}

.topbar__icon-btn,
.topbar__action {
  min-height: 35px;

  padding-inline: 10px;

  font-size: 12px;
  font-weight: 850;
}

.topbar__icon-btn {
  width: 35px;
  min-width: 35px;

  padding: 0;
}

.topbar__user {
  min-height: 36px;
  max-width: 380px;

  gap: 10px;
  padding-inline: 7px;
}

.topbar__avatar {
  width: 33px;
  height: 33px;
  min-width: 33px;

  font-size: 11px;
}

.topbar__user-name {
  max-width: 155px;

  font-size: 12.5px;
  font-weight: 900;
}

.topbar__user-role {
  max-width: 115px;

  font-size: 10.5px;
  font-weight: 850;
}

.topbar__user-time {
  min-width: 44px;

  font-size: 10.5px;
}

.topbar__divider {
  width: 23px;
  min-width: 23px;

  font-size: 12px;
}

.topbar .icon {
  width: 15px;
  height: 15px;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 980px) {
  .topbar {
    min-height: 50px;
  }

  .topbar__title h1 {
    font-size: 16px;
  }

  .topbar__title span {
    font-size: 9px;
  }

  .topbar__icon-btn,
  .topbar__action {
    min-height: 33px;

    font-size: 11px;
  }

  .topbar__user-name {
    max-width: 110px;

    font-size: 11.5px;
  }

  .topbar__user-role {
    max-width: 85px;

    font-size: 9.5px;
  }

  .topbar__user-time {
    font-size: 9.5px;
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 560px) {
  .topbar {
    min-height: 47px;
  }

  .topbar__title h1 {
    font-size: 14px;
  }

  .topbar__icon-btn,
  .topbar__action {
    width: 33px;
    min-width: 33px;
    height: 33px;
    min-height: 33px;
  }

  .topbar__avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
}