/* Global fixed header and its responsive behavior */

/* Global header include */
.app-global-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 4500;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  column-gap: 16px;
  row-gap: 0;
  margin: 0;
  padding: 10px 36px 10px;
  background: rgba(4, 6, 12, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.app-global-header-left {
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: auto;
}

.app-site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f4f6ff;
}

.app-site-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 8px 16px rgba(12, 16, 28, 0.18);
}

.app-site-brand-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-site-brand-text {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.app-main-nav-stack {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  justify-items: center;
  gap: 0;
}

.app-main-nav-brand {
  margin: 0;
  color: #f5f7ff;
  font-size: 1.03rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-main-nav {
  position: static;
  transform: none;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  padding: 6px;
  border: 0;
  backdrop-filter: blur(8px);
}

.app-main-nav-item {
  border: 0;
  border-radius: 999px;
  color: #8f95a6;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1;
  padding: 9px 16px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  opacity: 1;
}

.app-main-nav-item:hover {
  color: #d6dae7;
}

.app-main-nav-item.is-active {
  background: transparent;
  color: #8b5cf6;
  opacity: 1;
}

.app-global-user-chip {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.app-global-header .brand {
  color: #e5e9f8;
}

.app-global-header .project-top-info .project-title {
  font-size: 1.2rem;
  line-height: 1.1;
}

.app-global-credit-pill {
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: #12131a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c6cad7;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.app-global-credit-pill:hover {
  border-color: rgba(255, 176, 31, 0.4);
}

.app-global-credit-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffb01f;
  box-shadow: 0 0 0 3px rgba(255, 176, 31, 0.1);
}

.app-global-login-btn {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  height: 34px;
  padding: 0 18px;
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}

.app-global-login-btn:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.app-global-login-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.app-global-login-btn.is-hidden {
  display: none;
}

/* ── Login Modal ── */
.app-login-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-login-modal.is-hidden {
  display: none;
}

.app-login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.app-login-dialog {
  position: relative;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #0f1320;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 36px 32px 32px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.app-login-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(200, 210, 230, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.app-login-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2efff;
}

.app-login-logo {
  margin-bottom: 16px;
}

.app-login-logo img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.app-login-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #e2efff;
}

.app-login-subtitle {
  margin: 0 0 28px;
  font-size: 0.85rem;
  color: rgba(180, 200, 230, 0.6);
}

.app-login-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-login-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #e2efff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.app-login-provider-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.app-login-provider-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.app-login-provider-btn svg {
  flex-shrink: 0;
}

.app-login-error {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: #f87171;
}

.app-login-error.is-hidden {
  display: none;
}

.app-global-upgrade-btn {
  min-height: 33px;
  padding: 0 25px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.24);
}

.app-global-upgrade-btn:hover {
  filter: brightness(1.05);
}

.app-profile-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-profile-trigger {
  position: relative;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #ffffff;
  font-family: inherit;
  cursor: pointer;
  box-shadow: none;
  line-height: 0;
}

.app-profile-trigger-fallback {
  position: absolute;
  inset: 2px;
  display: grid;
  place-items: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #151823;
}

.app-profile-trigger-avatar {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  border-radius: inherit;
  border: 0;
  object-fit: cover;
  background: transparent;
}

.app-profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 252px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(14, 16, 24, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  display: grid;
  gap: 4px;
}

.app-profile-menu-header {
  display: grid;
  gap: 4px;
  padding: 6px 8px 10px;
}

.app-profile-queue-card {
  display: block;
  margin: 0 0 6px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(16, 18, 27, 0.92);
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.app-profile-queue-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-profile-queue-card-label {
  color: #8e95a8;
  font-size: 0.76rem;
  font-weight: 500;
}

.app-profile-queue-card-ratio {
  color: #f5f7ff;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.app-profile-queue-card.is-loading {
  border-color: rgba(139, 92, 246, 0.22);
}

.app-profile-queue-card.is-loading .app-profile-queue-card-ratio {
  opacity: 0.82;
}

.app-profile-queue-card.is-error {
  border-color: rgba(255, 141, 162, 0.2);
  background:
    linear-gradient(180deg, rgba(138, 39, 61, 0.2), rgba(88, 29, 47, 0.14)),
    rgba(16, 18, 27, 0.92);
}

.app-profile-menu-name {
  color: #f4f6ff;
  font-size: 0.92rem;
  font-weight: 600;
}

.app-profile-menu-caption {
  color: #8e95a8;
  font-size: 0.76rem;
}

.app-profile-menu-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: #e6e9f5;
  font-family: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.app-profile-menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.app-profile-menu-item.is-danger {
  color: #ffb8d0;
}

.app-profile-menu-divider {
  display: block;
  width: 100%;
  height: 1px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.08);
}

.app-header-back-text {
  width: auto;
  height: auto;
  padding: 0;
  color: #f2f4ff;
  font-size: 0.98rem;
}

@media (max-height: 1200px) {
  .app-global-header {
    padding: 10px 20px;
  }

  .app-main-nav
  {
    padding: 4px;
  }

  .app-site-brand-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
  }

  .app-site-brand-text {
    font-size: 0.95rem;
  }

  .app-main-nav-item {
    font-size: 0.95rem;
    padding: 8px 13px;
  }

  .app-global-credit-pill {
    min-height: 30px;
    padding: 0 12px;
    font-size: 0.75rem;
  }

  .app-global-credit-dot {
    width: 8px;
    height: 8px;
  }

  .app-global-upgrade-btn {
    min-height: 30px;
    padding: 0 20px;
    font-size: 0.8rem;
  }

  .app-profile-trigger {
    width: 34px;
    height: 34px;
  }

  .app-profile-trigger-fallback {
    font-size: 0.78rem;
  }
}

@media (max-width: 1160px) {
  .app-main-nav-item {
    font-size: 0.75rem;
    padding: 8px 8px;
  }
}

@media (max-width: 980px) {
  .app-global-header {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 10px;
    padding: 10px 14px 10px;
  }

  .app-global-header-left {
    grid-column: 1;
    grid-row: 1;
    width: auto;
  }

  .app-site-brand-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    padding: 5px;
  }

  .app-site-brand-text {
    font-size: 0.95rem;
  }

  .app-main-nav-stack {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    gap: 6px;
  }

  .app-main-nav {
    width: min(100%, 980px);
    justify-content: center;
    overflow-x: auto;
    padding: 5px;
  }

  .app-global-user-chip {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    gap: 10px;
  }

  .app-global-login-btn {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }

  .app-global-credit-pill {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.82rem;
  }

  .app-global-upgrade-btn {
    min-height: 38px;
    padding: 0 16px;
    font-size: 0.86rem;
  }

  .app-profile-trigger {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 760px) {
  .app-global-credit-pill {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.78rem;
    gap: 6px;
  }

  .app-global-credit-dot {
    width: 7px;
    height: 7px;
  }

  .app-profile-menu {
    width: min(250px, calc(100vw - 24px));
  }

  .app-global-header
  {
    row-gap: 5px;
    padding: 10px 14px 5px;
  }

  .page.page-home {
    width: calc(100% - 24px);
    padding-top: 90px;
    padding-bottom: 38px;
  }

  .app-global-login-btn {
    height: 25px;
    padding: 0 18px;
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: filter 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
  }
}

.page {
  padding-top: 60px;
}

.page.page-project {
  padding-top: 60px;
}

@media (max-height: 1200px) {
  .page {
    padding-top: 52px;
  }

  .page.page-project {
    padding-top: 52px;
  }
}

@media (max-width: 980px) {
  .page,
  .page.page-project {
    padding-top: 78px;
  }
}
