/* =========================================================
   DRIVE DEVBLK · TOPBAR
   Imagen · Dark · Cyberpunk · Responsive
   ========================================================= */

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

  isolation: isolate;

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

  width: 100%;
  min-width: 0;
  min-height: var(--topbar-height);
  padding: 10px 20px;

  overflow: visible;

  border-bottom: 1px solid var(--accent-border);

  background:
    linear-gradient(
      90deg,
      rgba(5, 8, 12, 0.98),
      rgba(5, 9, 14, 0.94)
    );
}

/* =========================================================
   IMAGEN DE FONDO
   ========================================================= */

.app-topbar__background {
  position: absolute;
  inset: 0;
  z-index: -3;

  overflow: hidden;

  pointer-events: none;

  background-image:
    linear-gradient(
      90deg,
      rgba(5, 8, 12, 0.98) 0%,
      rgba(5, 8, 12, 0.90) 32%,
      rgba(5, 8, 12, 0.48) 62%,
      rgba(5, 8, 12, 0.22) 82%,
      rgba(5, 8, 12, 0.42) 100%
    ),
    linear-gradient(
      180deg,
      rgba(2, 5, 8, 0.12),
      rgba(2, 5, 8, 0.60)
    ),
    var(--topbar-background-image);

  background-repeat:
    no-repeat,
    no-repeat,
    no-repeat;

  background-position:
    center,
    center,
    right center;

  background-size:
    cover,
    cover,
    auto 100%;
}

.app-topbar__background::before {
  position: absolute;
  inset: 0;

  content: "";

  pointer-events: none;

  background:
    linear-gradient(
      90deg,
      rgba(0, 229, 255, 0.03),
      transparent 34%,
      rgba(255, 48, 91, 0.04)
    );
}

.app-topbar__background::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;

  height: 1px;

  content: "";

  background:
    linear-gradient(
      90deg,
      transparent,
      var(--accent),
      transparent
    );
}

/* =========================================================
   AMBIENTE
   ========================================================= */

.app-topbar__ambient {
  position: absolute;
  inset: 0;
  z-index: -2;

  overflow: hidden;

  pointer-events: none;
}

.app-topbar__ambient::before {
  position: absolute;
  top: -48px;
  right: 17%;

  width: 210px;
  height: 150px;

  border: 1px solid rgba(0, 229, 255, 0.07);
  border-radius: 50%;

  content: "";
}

.app-topbar__ambient::after {
  position: absolute;
  top: 0;
  right: 0;

  width: 42%;
  height: 100%;

  content: "";

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(0, 229, 255, 0.025)
    );
}

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

.app-topbar__left {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;

  min-width: 0;
}

.app-topbar__heading {
  display: flex;
  flex-direction: column;
  gap: 1px;

  min-width: 0;
}

.app-topbar__eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;

  color: var(--accent);

  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.app-topbar__eyebrow > span {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: var(--success);

  animation:
    topbar-status-pulse
    2s
    ease-in-out
    infinite;
}

.app-topbar__heading h1 {
  overflow: hidden;

  color: var(--text);

  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;

  text-shadow:
    0
    2px
    10px
    rgba(0, 0, 0, 0.72);
}

.app-topbar__heading p {
  overflow: hidden;

  color: var(--text-muted);

  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;

  text-shadow:
    0
    1px
    4px
    rgba(0, 0, 0, 0.9);
}

/* =========================================================
   LADO DERECHO
   ========================================================= */

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

  min-width: 0;
}

/* =========================================================
   BOTÓN MENÚ
   SIEMPRE VISIBLE
   ========================================================= */

.app-topbar__menu-button {
  display: inline-flex;
  flex: 0 0 auto;

  width: 44px;
  min-width: 44px;
  height: 44px;

  border-color: var(--line-strong);

  color: var(--text-muted);

  background: rgba(8, 13, 19, 0.9);
}

.app-topbar__menu-button:hover:not(:disabled) {
  border-color: var(--accent-border);

  color: var(--accent);

  background: var(--accent-soft);
}

.app-topbar__menu-button[aria-expanded="true"] {
  border-color: var(--accent);

  color: var(--accent);

  background: var(--accent-soft);
}

/* =========================================================
   BUSCADOR
   ========================================================= */

.app-topbar__search {
  position: relative;

  display: flex;
  flex: 0 1 360px;
  align-items: center;
  gap: 9px;

  width: 360px;
  min-width: 220px;
  height: 44px;
  padding: 0 12px;

  overflow: hidden;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);

  color: var(--text-muted);

  cursor: text;

  background:
    linear-gradient(
      145deg,
      rgba(8, 13, 19, 0.92),
      rgba(5, 9, 14, 0.94)
    );

  transition:
    width var(--transition-slow),
    border-color var(--transition),
    background-color var(--transition),
    box-shadow var(--transition);
}

.app-topbar__search:hover {
  border-color: rgba(0, 229, 255, 0.35);
}

.app-topbar__search:focus-within,
.app-topbar__search.is-open {
  border-color: var(--accent);

  background: rgba(5, 10, 15, 0.98);

  box-shadow:
    0
    0
    0
    3px
    rgba(0, 229, 255, 0.08);
}

.app-topbar__search-icon {
  width: 17px;
  min-width: 17px;
  height: 17px;

  color: var(--text-soft);

  stroke-width: 1.8;

  transition:
    color var(--transition);
}

.app-topbar__search:focus-within
.app-topbar__search-icon,
.app-topbar__search.is-open
.app-topbar__search-icon {
  color: var(--accent);
}

.app-topbar__search input {
  flex: 1 1 auto;

  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0;

  border: 0;
  outline: 0;

  color: var(--text);

  font-size: 11px;
  font-weight: 500;

  background: transparent;
}

.app-topbar__search input::placeholder {
  color: var(--text-soft);

  opacity: 1;
}

.app-topbar__search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.app-topbar__search-code {
  color: #46525f;

  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.07em;

  pointer-events: none;
}

.app-topbar__search.has-value
.app-topbar__search-code {
  display: none;
}

.app-topbar__search-close {
  display: none;
  align-items: center;
  justify-content: center;

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

  border: 0;
  border-radius: 7px;

  color: var(--text-muted);

  background: transparent;
}

.app-topbar__search-close:hover {
  color: var(--text);

  background: var(--surface-soft);
}

.app-topbar__search-close svg {
  width: 16px;
  height: 16px;
}

/* =========================================================
   BOTÓN SUBIR
   ========================================================= */

.app-topbar__upload {
  position: relative;

  flex: 0 0 auto;

  min-height: 44px;

  overflow: hidden;
}

.app-topbar__upload svg {
  width: 17px;
  height: 17px;
}

/* =========================================================
   BOTÓN LOGOUT
   ========================================================= */

.app-topbar__logout {
  flex: 0 0 auto;

  width: 44px;
  min-width: 44px;
  height: 44px;

  border-color: var(--line-strong);

  color: var(--text-muted);

  background: rgba(8, 13, 19, 0.9);
}

.app-topbar__logout:hover:not(:disabled) {
  border-color: var(--danger-border);

  color: var(--danger);

  background: var(--danger-soft);
}

.app-topbar__logout.is-loading svg {
  animation:
    topbar-spin
    0.7s
    linear
    infinite;
}

/* =========================================================
   OVERLAY DEL SIDEBAR
   ========================================================= */

.app-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;

  display: none;

  width: 100%;
  height: 100%;
  padding: 0;

  border: 0;

  opacity: 0;

  background: rgba(2, 5, 8, 0.8);

  backdrop-filter: blur(4px);

  animation:
    topbar-overlay-in
    170ms
    ease
    forwards;
}

body.sidebar-open
.app-sidebar-overlay {
  display: block;
}

/* =========================================================
   RESPONSIVE · 1280 PX
   ========================================================= */

@media (max-width: 1280px) {
  .app-topbar {
    gap: 16px;

    padding:
      10px
      17px;
  }

  .app-topbar__search {
    flex-basis: 300px;

    width: 300px;
  }

  .app-topbar__background {
    background-position:
      center,
      center,
      right center;

    background-size:
      cover,
      cover,
      auto 100%;
  }
}

/* =========================================================
   RESPONSIVE · 1080 PX
   ========================================================= */

@media (max-width: 1080px) {
  .app-topbar__search {
    flex-basis: 240px;

    width: 240px;
    min-width: 190px;
  }

  .app-topbar__search-code {
    display: none;
  }

  .app-topbar__heading p {
    max-width: 300px;
  }
}

/* =========================================================
   RESPONSIVE · 900 PX
   ========================================================= */

@media (max-width: 900px) {
  .app-topbar {
    min-height: 68px;

    padding:
      9px
      14px;
  }

  .app-topbar__heading h1 {
    font-size: 17px;
  }

  .app-topbar__heading p {
    display: none;
  }

  .app-topbar__background {
    background-position:
      center,
      center,
      right center;

    background-size:
      cover,
      cover,
      auto 100%;
  }
}

/* =========================================================
   RESPONSIVE · 760 PX
   ========================================================= */

@media (max-width: 760px) {
  .app-topbar {
    position: sticky;

    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      auto;
    align-items: center;
    gap: 8px;

    min-height: 66px;
    padding:
      9px
      12px;

    overflow: visible;
  }

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

  .app-topbar__heading {
    min-width: 0;
  }

  .app-topbar__eyebrow {
    display: none;
  }

  .app-topbar__heading h1 {
    max-width: 170px;

    font-size: 16px;
  }

  .app-topbar__right {
    gap: 7px;
  }

  .app-topbar__search {
    flex: 0 0 42px;

    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0 11px;

    cursor: pointer;
  }

  .app-topbar__search input,
  .app-topbar__search-code {
    position: absolute;

    width: 1px;
    min-width: 1px;
    height: 1px;
    padding: 0;

    overflow: hidden;

    opacity: 0;
    pointer-events: none;
  }

  .app-topbar__search.is-open,
  .app-topbar__search:focus-within {
    position: absolute;
    top: 8px;
    right: 12px;
    left: 12px;
    z-index: 40;

    width: auto;
    min-width: 0;
    height: 50px;
    padding:
      0
      9px
      0
      14px;

    cursor: text;

    border-color: var(--accent);

    background:
      linear-gradient(
        145deg,
        rgba(7, 12, 18, 0.995),
        rgba(3, 7, 11, 0.995)
      );

    box-shadow:
      0
      10px
      34px
      rgba(0, 0, 0, 0.52),
      0
      0
      0
      1px
      rgba(0, 229, 255, 0.07);
  }

  .app-topbar__search.is-open input,
  .app-topbar__search:focus-within input {
    position: static;

    display: block;
    flex: 1 1 auto;

    width: 100%;
    min-width: 0;
    height: 48px;

    overflow: visible;

    opacity: 1;
    pointer-events: auto;
  }

  .app-topbar__search.is-open
  .app-topbar__search-close,
  .app-topbar__search:focus-within
  .app-topbar__search-close {
    display: inline-flex;
  }

  .app-topbar__search.is-open
  .app-topbar__search-code,
  .app-topbar__search:focus-within
  .app-topbar__search-code {
    display: none;
  }

  .app-topbar__upload {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
  }

  .app-topbar__upload > span:not(.button__scanline) {
    display: none;
  }

  .app-topbar__menu-button,
  .app-topbar__logout {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .app-topbar__background {
    background-image:
      linear-gradient(
        90deg,
        rgba(5, 8, 12, 0.96) 0%,
        rgba(5, 8, 12, 0.68) 55%,
        rgba(5, 8, 12, 0.32) 100%
      ),
      linear-gradient(
        180deg,
        rgba(2, 5, 8, 0.08),
        rgba(2, 5, 8, 0.50)
      ),
      var(--topbar-background-image);

    background-position:
      center,
      center,
      right center;

    background-size:
      cover,
      cover,
      auto 100%;
  }
}

/* =========================================================
   RESPONSIVE · 520 PX
   ========================================================= */

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

    padding:
      8px
      10px;
  }

  .app-topbar__left {
    gap: 8px;
  }

  .app-topbar__heading h1 {
    max-width: 125px;

    font-size: 15px;
  }

  .app-topbar__right {
    gap: 6px;
  }

  .app-topbar__menu-button,
  .app-topbar__logout,
  .app-topbar__upload,
  .app-topbar__search {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .app-topbar__search {
    padding: 0 10px;
  }

  .app-topbar__search.is-open,
  .app-topbar__search:focus-within {
    top: 7px;
    right: 10px;
    left: 10px;

    height: 48px;
  }

  .app-topbar__search.is-open input,
  .app-topbar__search:focus-within input {
    height: 46px;
  }

  .app-topbar__background {
    background-position:
      center,
      center,
      right center;

    background-size:
      cover,
      cover,
      auto 100%;
  }
}

/* =========================================================
   RESPONSIVE · 420 PX
   ========================================================= */

@media (max-width: 420px) {
  .app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .app-topbar__left {
    flex: 1 1 auto;

    overflow: hidden;
  }

  .app-topbar__heading h1 {
    max-width: 110px;
  }

  .app-topbar__right {
    flex: 0 0 auto;
  }
}

/* =========================================================
   RESPONSIVE · 370 PX
   ========================================================= */

@media (max-width: 370px) {
  .app-topbar__heading {
    display: none;
  }

  .app-topbar__left {
    flex: 0 0 auto;
  }

  .app-topbar__right {
    margin-left: auto;
  }
}

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

@keyframes topbar-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes topbar-status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

@keyframes topbar-overlay-in {
  to {
    opacity: 1;
  }
}

/* =========================================================
   MOVIMIENTO REDUCIDO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .app-topbar__eyebrow > span,
  .app-topbar__logout.is-loading svg {
    animation: none;
  }

  .app-topbar__search,
  .app-sidebar-overlay {
    transition: none;
  }
}/* =========================================================
   TOPBAR · BOTÓN SALIR TRANSPARENTE
   ========================================================= */

.app-topbar__logout {
  background: transparent !important;

  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.app-topbar__logout:hover:not(:disabled) {
  border-color: var(--danger-border);

  color: var(--danger);

  background: rgba(255, 82, 99, 0.08) !important;
}

.app-topbar__logout.is-loading {
  background: transparent !important;
}