/* ============================
   DomainWall — 全局样式
   ============================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* CSS Variables */
:root {
  --bg: #0a0a0f;
  --bg-card: #111118;
  --bg-card-hover: #16161f;
  --bg-input: #1a1a24;
  --border: #22222f;
  --border-focus: #4f46e5;
  --text-primary: #f1f1f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-subtle: rgba(99, 102, 241, 0.12);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

img { max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Container */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  max-width: 560px;
}

/* ============================
   Header
   ============================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}
.logo:hover { opacity: 1; }

.logo-icon { font-size: 1.4rem; }
.logo-text { letter-spacing: -0.3px; }

nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-loading {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ============================
   Buttons
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover { opacity: 1; }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================
   Hero
   ============================ */
.hero {
  text-align: center;
  padding: 80px 20px 60px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #f1f1f5 0%, #8888a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto 32px;
}

/* ============================
   Domains Section
   ============================ */
.domains-section {
  padding-bottom: 80px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge {
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 99px;
  font-family: var(--font-mono);
}

/* Domains Grid */
.domains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Domain Card */
.domain-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.domain-card:hover {
  border-color: #333344;
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.card-domain {
  display: flex;
  align-items: center;
}

.domain-link {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  word-break: break-all;
}
.domain-link:hover { opacity: 0.75; }

.card-title {
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-user {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-actions {
  margin-top: 4px;
}

/* ============================
   Empty & Loading States
   ============================ */
.domains-loading {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.empty-state.error { color: var(--red); }
.empty-state a { color: var(--accent); }

.profile-loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}
.profile-loading p { margin-top: 12px; }

/* ============================
   Spinner
   ============================ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner.large {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.nav-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

/* ============================
   Form Card
   ============================ */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin: 40px 0;
}

.form-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-check {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.domain-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-hint-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.char-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.form-error {
  font-size: 0.8rem;
  color: var(--red);
  display: none;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* ============================
   Profile Page
   ============================ */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 48px 0 32px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.profile-info h1 {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.profile-email {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.domain-cards-profile {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s, transform 0.2s;
}

.profile-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.profile-card-domain {
  margin-bottom: 10px;
}

.profile-card-domain .domain-link {
  font-size: 1.05rem;
}

.profile-card-title {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.profile-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Link Section */
.link-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 60px;
}

.link-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.link-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.share-url-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
}

.qr-container img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ============================
   Auth Card
   ============================ */
.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.auth-logo { font-size: 3rem; }

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ============================
   Footer
   ============================ */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.site-footer strong { color: var(--text-secondary); }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ============================
   Not Found / Error
   ============================ */
.not-found {
  text-align: center;
  padding: 80px 20px;
}

.not-found h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.not-found p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 640px) {
  .domains-grid,
  .domain-cards-profile {
    grid-template-columns: 1fr;
  }

  .profile-hero {
    flex-direction: column;
    text-align: center;
    padding: 32px 0 24px;
  }

  .form-card { padding: 24px 20px; }

  .hero { padding: 48px 0 40px; }

  .header-inner {
    gap: 8px;
  }

  .btn-ghost { display: none; }
}
