/* HentaiAPK Auth Modal — dark mode (matches #1d222d theme) */
.hapk-auth-nav {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.35rem;
}

.hapk-header-auth-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  border: 1px solid #1bbc9b;
  background: transparent;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s;
}

.hapk-header-auth-btn:hover {
  background: #1bbc9b;
  color: #fff;
}

.hapk-header-auth-signup {
  background: #1bbc9b;
  border-color: #1bbc9b;
  color: #fff;
}

.hapk-header-auth-signup:hover {
  background: #17a589;
  border-color: #17a589;
}

.hapk-header-profile {
  position: relative;
  margin-left: 0.35rem;
}

#header nav .menu > li.hapk-header-profile,
#header .menu > li.hapk-header-profile {
  display: flex;
  align-items: center;
}

.hapk-header-profile-trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 0.55rem;
  padding: 0.28rem 0.7rem 0.28rem 0.28rem !important;
  border-radius: 999px;
  border: 1px solid rgba(27, 188, 155, 0.35);
  background: linear-gradient(135deg, rgba(27, 188, 155, 0.14), rgba(29, 34, 45, 0.92));
  color: #fff !important;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.hapk-header-profile-trigger:hover,
.hapk-header-profile.is-open .hapk-header-profile-trigger {
  border-color: rgba(27, 188, 155, 0.65);
  background: linear-gradient(135deg, rgba(27, 188, 155, 0.24), rgba(29, 34, 45, 0.98));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.hapk-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #1bbc9b;
  box-shadow: 0 0 0 2px rgba(27, 188, 155, 0.15);
}

.hapk-header-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1bbc9b, #14917a);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hapk-header-profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.hapk-header-profile-name {
  font-size: 0.82rem;
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
}

.hapk-header-profile-label {
  font-size: 0.65rem;
  color: #9aa3b2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hapk-header-chevron {
  color: #1bbc9b;
  font-size: 0.62rem;
  transition: transform 0.15s;
  margin-left: 0.05rem;
}

.hapk-header-profile.is-open .hapk-header-chevron {
  transform: rotate(180deg);
}

.hapk-header-profile-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  width: max-content;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 12px;
  background: #252b38;
  border: 1px solid rgba(27, 188, 155, 0.22);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.48);
  z-index: 100001;
  box-sizing: border-box;
}

.hapk-header-profile-menu li {
  margin: 0;
  padding: 0;
  float: none !important;
  display: block;
  width: 100%;
}

.hapk-header-profile-menu a {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.62rem 0.75rem !important;
  border-radius: 8px;
  color: #d5d9e0 !important;
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none !important;
  background: transparent !important;
  border: none !important;
  line-height: 1.35 !important;
  position: relative;
  transition: background 0.12s, color 0.12s;
}

.hapk-header-profile-menu a::before {
  content: none !important;
  display: none !important;
  width: 0 !important;
}

#header nav .hapk-header-profile-menu li:hover a::before {
  width: 0 !important;
}

.hapk-header-profile-menu a i {
  width: 1rem;
  flex-shrink: 0;
  color: #1bbc9b;
  text-align: center;
}

.hapk-header-profile-menu a:hover,
.hapk-header-profile-menu a:focus-visible {
  background: rgba(27, 188, 155, 0.14) !important;
  color: #fff !important;
}

.hapk-header-profile-divider {
  height: 1px;
  margin: 0.35rem 0.25rem;
  background: rgba(255, 255, 255, 0.08);
}

.hapk-header-logout,
.hapk-header-logout i {
  color: #ff8a8a !important;
}

.hapk-header-logout:hover {
  background: rgba(255, 120, 120, 0.1) !important;
}

.hapk-header-profile-mobile-link {
  display: inline-flex !important;
  align-items: center;
  gap: 0.55rem;
}

.hapk-header-profile-mobile .hapk-header-avatar,
.hapk-header-profile-mobile .hapk-header-avatar-initials {
  width: 28px;
  height: 28px;
  font-size: 0.65rem;
}

@media (max-width: 900px) {
  .hapk-header-profile-meta,
  .hapk-header-chevron {
    display: none;
  }

  .hapk-header-profile-trigger {
    padding: 0.2rem !important;
    border-radius: 50%;
  }
}

/* Mobile header: menu left | logo center | search right */
.hapk-header-search-btn {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.hapk-header-search-btn:hover,
.hapk-header-search-btn:focus-visible {
  background: rgba(27, 188, 155, 0.15);
  color: #1bbc9b;
  outline: none;
}

/* Desktop: logo left, nav/profile right (theme default flex) */
@media (min-width: 901px) {
  #header .container {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  #header .logo {
    flex: none;
    order: 0;
    padding: 0 !important;
    margin: 0;
    text-align: left;
  }

  .hapk-header-search-btn {
    display: none !important;
  }

  #header nav {
    margin-left: auto !important;
    flex: none;
    order: 1;
    width: auto !important;
    min-width: 0 !important;
  }

  #header nav .menu-open {
    display: none !important;
  }

  #header nav ul.menu {
    display: block !important;
  }
}

@media (max-width: 900px) {
  #header .container {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    padding: 0 8px !important;
    gap: 0;
  }

  #header .logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    padding: 0 !important;
    margin: 0;
    text-align: center;
    min-width: 0;
  }

  #header .logo a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  #header .logo a img {
    max-width: 100%;
    height: auto;
    max-height: 38px;
  }

  #header nav {
    grid-column: 1;
    grid-row: 1;
    margin: 0 !important;
    justify-self: start;
    width: 48px;
    min-width: 48px;
  }

  #header nav .menu-open {
    float: none;
    display: block;
    margin: 0;
    padding: 0;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
  }

  .hapk-header-tools {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    margin-left: 0;
  }

  .hapk-header-search-btn {
    display: inline-flex;
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
  }

  /* Slide drawer from left */
  #menu-mobile {
    left: 0 !important;
    right: auto !important;
    transform: translate3d(-100%, 0, 0) !important;
  }

  body.toggle-nav #menu-mobile {
    transform: translate3d(0, 0, 0) !important;
  }

  .toggle-nav .wrapper-inside > * {
    transform: translate3d(80%, 0, 0) !important;
  }
}

/* Mobile search dropdown below header */
.hapk-mobile-search {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #252b38;
  border-bottom: 2px solid #1bbc9b;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.hapk-mobile-search[hidden] {
  display: none !important;
}

.hapk-mobile-search-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
}

.hapk-mobile-search-inner form {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  background: #151a24;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.hapk-mobile-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #fff;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
}

.hapk-mobile-search-input::placeholder {
  color: #9aa3b2;
}

.hapk-mobile-search-submit {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  margin: 3px;
  border: none;
  border-radius: 50%;
  background: #1bbc9b;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hapk-mobile-search-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 901px) {
  .hapk-mobile-search {
    display: none !important;
  }
}

/* Mobile drawer account section */
#menu-mobile .hapk-mobile-account {
  float: none;
  margin: 0;
  padding: 0;
}

#menu-mobile .hapk-mobile-account > a {
  display: none;
}

.hapk-mobile-account-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 15px;
  background: linear-gradient(135deg, rgba(27, 188, 155, 0.12), rgba(29, 34, 45, 0.5));
  border-bottom: 1px solid rgba(27, 188, 155, 0.2);
}

.hapk-mobile-account-card .hapk-header-avatar,
.hapk-mobile-account-card .hapk-header-avatar-initials {
  width: 40px;
  height: 40px;
  font-size: 0.8rem;
}

.hapk-mobile-account-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.hapk-mobile-account-info strong {
  color: #fff;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hapk-mobile-account-info span {
  color: #9aa3b2;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hapk-mobile-account-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hapk-mobile-account-nav li {
  margin: 0;
  float: none;
}

.hapk-mobile-account-nav a {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 15px !important;
  color: #fff !important;
  font-size: 14px !important;
  border-top: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.hapk-mobile-account-nav a i {
  width: 1.1rem;
  color: #1bbc9b;
  text-align: center;
}

.hapk-mobile-account-nav a:hover {
  background: rgba(27, 188, 155, 0.1);
}

.hapk-mobile-account-logout a,
.hapk-mobile-account-logout a i {
  color: #ff8a8a !important;
}

#menu-mobile .hapk-auth-nav-mobile {
  padding: 0.75rem 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hapk-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

.hapk-auth-overlay[hidden] {
  display: none !important;
}

.hapk-auth-modal {
  position: relative;
  width: min(400px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.35rem 1.25rem;
  border-radius: 12px;
  background: #1d222d;
  border: 1px solid rgba(27, 188, 155, 0.25);
  border-bottom: 2px solid #1bbc9b;
  color: #d5d9e0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.hapk-auth-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: none;
  background: transparent;
  color: #888;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.hapk-auth-close:hover { color: #fff; }

.hapk-auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  text-align: center;
  color: #fff;
  font-weight: 700;
}

.hapk-auth-subtitle {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: #9aa3b2;
  line-height: 1.45;
}

.hapk-auth-google-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.hapk-google-btn-mount {
  min-height: 44px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.hapk-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.78rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hapk-auth-divider::before,
.hapk-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.hapk-auth-form {
  display: none;
  flex-direction: column;
  gap: 0.7rem;
}

.hapk-auth-form.is-active {
  display: flex;
}

.hapk-auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: #b8c0cc;
  font-weight: 600;
}

.hapk-auth-form input[type="text"],
.hapk-auth-form input[type="email"],
.hapk-auth-form input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #151a24;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 400;
  box-sizing: border-box;
}

.hapk-auth-form input:focus {
  outline: none;
  border-color: #1bbc9b;
  box-shadow: 0 0 0 2px rgba(27, 188, 155, 0.15);
}

.hapk-auth-form input[type="checkbox"] {
  accent-color: #1bbc9b;
}

.hapk-auth-remember {
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem !important;
  font-size: 0.85rem !important;
  font-weight: 400 !important;
  color: #9aa3b2 !important;
}

.hapk-auth-submit {
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: #1bbc9b;
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  margin-top: 0.15rem;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}

.hapk-auth-submit:hover {
  background: #17a589;
}

.hapk-auth-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.hapk-auth-error {
  color: #ff7b7b;
  font-size: 0.85rem;
  min-height: 1.1em;
  margin-bottom: 0.35rem;
  text-align: center;
}

.hapk-auth-switch {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: #9aa3b2;
}

.hapk-auth-switch-btn {
  border: none;
  background: none;
  padding: 0;
  color: #1bbc9b;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.hapk-auth-switch-btn:hover {
  color: #2dd4b0;
  text-decoration: underline;
}

.hapk-auth-nav-mobile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0;
}

.hapk-auth-nav-mobile .hapk-header-auth-btn {
  width: 100%;
  text-align: center;
}

@media (max-width: 600px) {
  .hapk-auth-nav { gap: 0.3rem; }
  .hapk-header-auth-btn { padding: 0.4rem 0.6rem; font-size: 0.78rem; }
  .hapk-header-profile-name { display: none; }
}
