@import url('../../../shared/design-tokens/orasage-tokens.css');
@import url('./orasage-ui.css');

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--orasage-font-sans, system-ui, -apple-system, sans-serif);
  background: var(--orasage-background, #fafaf8);
  color: var(--orasage-primary, #171717);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* 全页 flex：顶栏 + 主内容 + 页脚；底栏 nav 为 fixed，不占文档流高度 */
.orasage-auth-body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 16px);
}

.orasage-auth-body > .orasage-app-shell {
  min-height: 0 !important;
  height: 0;
  flex: 0 0 0;
  overflow: visible;
  background: transparent;
}

.orasage-auth-mobile-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--shell-border, #e7e5e4);
  background: var(--shell-bg, #fafaf8);
}

.orasage-auth-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.orasage-auth-footer {
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .orasage-auth-body {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    padding-bottom: 0;
    overflow: hidden;
  }

  .orasage-auth-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }

  .auth-page {
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: min(100%, 100%);
    padding: 1.5rem;
  }

  .orasage-auth-footer {
    margin-top: 0;
  }
}

/* —— 登录 / 注册卡（DS v1.1 — 独立 auth-* 类，避免 RGB 元组 token 在静态页失效） —— */
.auth-page {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  padding: 1.5rem 1.25rem 2rem;
}

@media (min-width: 640px) {
  .auth-page {
    align-items: center;
    padding: 2rem 1.5rem;
  }
}

.auth-card {
  width: 100%;
  max-width: 28rem;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.auth-card-header {
  padding: 2rem 1.5rem 1.25rem;
  text-align: center;
  background: #ffffff;
}

@media (min-width: 640px) {
  .auth-card-header {
    padding: 2.5rem 2rem 1.5rem;
  }
}

.auth-card-title {
  font-family: var(--orasage-font-serif, Georgia, 'Times New Roman', serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: #171717;
}

.auth-card-lead {
  margin-top: 0.625rem;
  font-size: 0.875rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: #6b7280;
}

.auth-card-body {
  padding: 0 1.5rem 1.75rem;
  border-top: 1px solid #e7e5e4;
  background: #fafaf8;
}

@media (min-width: 640px) {
  .auth-card-body {
    padding: 0 2rem 2rem;
  }
}

.auth-form {
  padding-top: 1.5rem;
}

.auth-field + .auth-field {
  margin-top: 1.25rem;
}

.auth-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: #171717;
}

.auth-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 0.875rem;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  background: #ffffff;
  color: #171717;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-input::placeholder {
  color: #a1a1aa;
}

.auth-input:hover {
  border-color: #d6d3d1;
}

.auth-input:focus {
  outline: none;
  border-color: #171717;
  box-shadow: 0 0 0 1px #171717;
}

.auth-error {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #dc2626;
}

.auth-error[hidden] {
  display: none;
}

.auth-submit {
  display: flex;
  width: 100%;
  min-height: 48px;
  margin-top: 1.5rem;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: #171717;
  color: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.auth-submit:hover {
  background: #333333;
}

.auth-submit:active {
  transform: translateY(1px);
  opacity: 0.92;
}

.auth-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fafaf8, 0 0 0 4px #171717;
}

.auth-card-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e7e5e4;
  text-align: center;
}

.auth-switch {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #6b7280;
}

.auth-switch a {
  margin-left: 0.25rem;
  color: #171717;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-switch a:hover {
  opacity: 0.75;
}

/* Legacy center page (if used) */
.center-main { max-width: 32rem; margin: 0 auto; padding: 0 0 2rem; }
.user-hero { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; }
.avatar {
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: #171717;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 600; color: #fff;
}
.user-hero h1 { font-size: 1.2rem; }
.muted { color: var(--orasage-secondary, #6b7280); font-size: 0.85rem; }
.tab-bar { display: flex; gap: 0.25rem; padding: 0 0.75rem; margin-bottom: 1rem; overflow-x: auto; }
.tab {
  flex: 1; min-width: 5.5rem; min-height: 44px;
  border: 1px solid var(--orasage-border, #e7e5e4); border-radius: 999px;
  background: #fff; color: var(--orasage-secondary, #6b7280); font-size: 0.8rem; padding: 0 0.75rem;
}
.tab.active { background: #fafaf8; border-color: #171717; color: #171717; }
.tab-panel { display: none; padding: 0 1rem; }
.tab-panel.active { display: block; }
.profile-form label { display: block; margin-bottom: 0.85rem; font-size: 0.8rem; color: var(--orasage-secondary, #6b7280); }
.card-list { display: flex; flex-direction: column; gap: 0.75rem; }
.card { border: 1px solid var(--orasage-border, #e7e5e4); border-radius: 1rem; background: #fff; padding: 1rem; }
.card h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.card .meta { font-size: 0.75rem; color: var(--orasage-secondary, #6b7280); margin-bottom: 0.5rem; }
.card p { font-size: 0.875rem; color: var(--orasage-secondary, #6b7280); }
.badge {
  display: inline-block; font-size: 0.7rem; padding: 0.15rem 0.5rem;
  border-radius: 999px; background: #f5f5f4; color: #171717; margin-right: 0.35rem;
}
.empty { text-align: center; padding: 2rem 1rem; color: var(--orasage-secondary, #6b7280); font-size: 0.9rem; }
.empty a { display: inline-block; margin-top: 0.75rem; color: #171717; text-decoration: underline; }
.loading { text-align: center; color: var(--orasage-secondary, #6b7280); padding: 2rem; }
