/* ========================================================
   Header Actions & Authentication UI
   ======================================================== */
.header {
  position: relative !important;
  padding-top: 26px !important;
}

.header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  flex-shrink: 0 !important;
}

.header-actions .divider {
  display: none !important;
}

.header-auth {
  position: absolute !important;
  top: 6px !important;
  right: max(4.5vw, 24px) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  z-index: 20 !important;
}

/* 1. Logged out state */
.header-auth .auth-login {
  min-height: 24px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--green, #243f30);
  background: transparent;
  border: 1px solid var(--line, #e4e5dc);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}
.header-auth .auth-login:hover {
  background: var(--cream, #f8f7f2);
  border-color: #cbd2c7;
}

.header-auth .auth-register {
  min-height: 24px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: var(--green, #243f30);
  border: 1px solid var(--green, #243f30);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}
.header-auth .auth-register:hover {
  background: #3c5942;
  border-color: #3c5942;
}

/* 2. Logged in state (User Square Menu) */
.header-user-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cream, #f8f7f2);
  border: 1px solid var(--line, #e4e5dc);
  padding: 2px 4px 2px 8px;
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  line-height: 1;
}
.header-user-menu:hover {
  border-color: #cbd2c7;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.header-user-greeting {
  font-size: 11.5px;
  color: var(--muted, #757970);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}
.header-user-greeting strong {
  color: var(--green, #243f30);
  font-weight: 600;
}

.header-user-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff !important;
  background: var(--green, #243f30);
  border: 1px solid var(--green, #243f30);
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
  min-height: auto;
}
.header-user-btn:hover {
  background: #3c5942;
  border-color: #3c5942;
}

.header-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted, #757970);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
  min-height: auto;
}
.header-logout-btn:hover {
  color: var(--green, #243f30);
  background: #edf0e8;
}

/* 3. Auth Dialog (Login & Register Modal) */
#auth-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px;
  border: 1px solid var(--line, #e4e5dc);
  border-radius: 0;
  color: var(--ink, #293c30);
  background: #fff;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
#auth-dialog::backdrop {
  background: rgba(24, 40, 30, 0.55);
  backdrop-filter: blur(2px);
}
#auth-dialog .dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
#auth-dialog .dialog-header span {
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--green, #243f30);
}
#auth-dialog h2 {
  margin: 10px 0 8px;
  font-size: 28px;
  color: var(--green, #243f30);
}
#auth-description {
  font-size: 14px;
  color: var(--muted, #757970);
  margin-bottom: 20px;
}
#auth-form {
  display: grid;
  gap: 16px;
}
#auth-form label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink, #293c30);
}
#auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #cbd2c7;
  border-radius: 0;
  background: #fff;
  color: var(--ink, #293c30);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s;
}
#auth-form input:focus {
  border-color: var(--green, #243f30);
  outline: none;
}
#auth-form .auth-notice {
  margin: 0;
  color: var(--muted, #757970);
  font-size: 13px;
  line-height: 1.6;
}
#auth-status {
  margin: 0;
  padding: 10px 14px;
  background: #fdf0ed;
  color: #b33924;
  border: 1px solid #f6c8bf;
  border-radius: 0;
  font-size: 13.5px;
}
.auth-submit {
  width: 100%;
  min-height: 46px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 0;
  background: var(--green, #243f30);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}
.auth-submit:hover {
  background: #3c5942;
}
.auth-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted, #757970);
}
.auth-switch button {
  padding: 4px 6px;
  font-weight: 600;
  color: var(--green, #243f30);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 992px) {
  .header-actions {
    gap: 10px;
  }
}

@media (max-width: 800px) {
  .header {
    padding-top: 34px !important;
  }
  .header-auth {
    top: 6px !important;
    right: 20px !important;
  }
}

@media (max-width: 600px) {
  .header-user-greeting {
    display: none;
  }
  #auth-dialog {
    padding: 20px;
  }
}
