/* ============================================================
   YouCoder — Auth & Dashboard Styles
   Login, Register, Pricing, Dashboard pages
   ============================================================ */

/* ── Auth Page (login/register) ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--yc-nav-h) + var(--yc-space-8)) var(--yc-space-5) var(--yc-space-8);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--yc-surface-white);
  border: 1px solid var(--yc-border-light);
  border-radius: var(--yc-radius-lg);
  padding: var(--yc-space-10);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--yc-space-8);
}

.auth-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--yc-space-2);
}

.auth-header p {
  font-size: 0.9rem;
  color: var(--yc-text-secondary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--yc-space-5);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--yc-space-1);
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--yc-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input {
  padding: var(--yc-space-3) var(--yc-space-4);
  border-radius: var(--yc-radius-md);
  border: 1px solid var(--yc-border-light);
  background: var(--yc-bg);
  color: var(--yc-text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--yc-fast);
  outline: none;
}

.form-group input:focus {
  border-color: var(--yc-brand);
  box-shadow: 0 0 0 3px var(--yc-focus);
}

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

.form-error {
  background: rgba(207, 102, 102, 0.08);
  border: 1px solid rgba(207, 102, 102, 0.25);
  border-radius: var(--yc-radius-sm);
  padding: var(--yc-space-3) var(--yc-space-4);
  font-size: 0.85rem;
  color: #CF6666;
}

.form-success {
  background: rgba(90, 122, 74, 0.08);
  border: 1px solid rgba(90, 122, 74, 0.25);
  border-radius: var(--yc-radius-sm);
  padding: var(--yc-space-3) var(--yc-space-4);
  font-size: 0.85rem;
  color: var(--yc-brand);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: var(--yc-space-3) var(--yc-space-6) !important;
  font-size: 0.9rem !important;
}

.auth-footer {
  margin-top: var(--yc-space-6);
  text-align: center;
  font-size: 0.85rem;
  color: var(--yc-text-secondary);
}

.auth-footer a {
  color: var(--yc-brand);
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ── Password Strength ── */
.password-strength {
  margin-top: var(--yc-space-1);
  height: 4px;
  background: var(--yc-border-light);
  border-radius: 2px;
  overflow: hidden;
}

.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: all var(--yc-fast);
}

.strength-bar.weak { width: 25%; background: #CF6666; }
.strength-bar.fair { width: 50%; background: #D4A15A; }
.strength-bar.good { width: 75%; background: var(--yc-brand); }
.strength-bar.strong { width: 100%; background: #2B6B3E; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--yc-brand-text);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Pricing Page ── */
.pricing-page {
  padding: calc(var(--yc-nav-h) + var(--yc-space-16)) var(--yc-space-8) var(--yc-space-16);
  max-width: 1100px;
  margin: 0 auto;
}

.pricing-header {
  text-align: center;
  margin-bottom: var(--yc-space-12);
}

.pricing-header h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--yc-space-2);
}

.pricing-header p {
  color: var(--yc-text-secondary);
  font-size: 1.05rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--yc-space-4);
  margin-bottom: var(--yc-space-16);
}

.pricing-card {
  background: var(--yc-surface-white);
  border: 1px solid var(--yc-border-light);
  border-radius: var(--yc-radius-lg);
  padding: var(--yc-space-8) var(--yc-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--yc-space-6);
  position: relative;
  transition: all var(--yc-normal);
}

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

.pricing-featured {
  border-color: var(--yc-brand);
  background: var(--yc-brand-bg);
  transform: scale(1.02);
}

.pricing-featured:hover {
  border-color: var(--yc-brand-hover);
  transform: scale(1.02) translateY(-2px);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--yc-space-1) var(--yc-space-4);
  background: var(--yc-brand);
  color: var(--yc-brand-text);
  border-radius: var(--yc-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pricing-card-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--yc-space-2);
  border: none;
  padding: 0;
  color: var(--yc-text);
}

.pricing-amount {
  margin-bottom: var(--yc-space-2);
}

.price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--yc-text);
  letter-spacing: -0.03em;
}

.period {
  font-size: 0.85rem;
  color: var(--yc-text-muted);
}

.pricing-card-header p {
  font-size: 0.85rem;
  color: var(--yc-text-secondary);
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--yc-space-2);
  flex: 1;
  padding: 0;
}

.pricing-features li {
  font-size: 0.85rem;
  padding-left: 24px;
  position: relative;
  color: var(--yc-text-secondary);
}

.feature-yes::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--yc-brand);
  font-weight: 600;
}

.feature-no::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: var(--yc-text-muted);
  font-weight: 600;
}

/* ── Pricing FAQ ── */
.pricing-faq {
  max-width: 680px;
  margin: 0 auto;
}

.pricing-faq h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--yc-space-6);
  text-align: center;
}

.faq-item {
  padding: var(--yc-space-4) 0;
  border-bottom: 1px solid var(--yc-border-light);
}

.faq-item h4 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: var(--yc-space-1);
}

.faq-item p {
  font-size: 0.85rem;
  color: var(--yc-text-secondary);
  line-height: 1.6;
}

/* ── Dashboard Page ── */
.dashboard-page {
  padding: calc(var(--yc-nav-h) + var(--yc-space-10)) var(--yc-space-8) var(--yc-space-16);
  max-width: 860px;
  margin: 0 auto;
}

.dashboard-header {
  margin-bottom: var(--yc-space-8);
}

.dashboard-header h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--yc-space-1);
}

.dashboard-header p {
  font-size: 0.9rem;
  color: var(--yc-text-secondary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--yc-space-4);
  margin-bottom: var(--yc-space-8);
}

.dashboard-card {
  background: var(--yc-surface-white);
  border: 1px solid var(--yc-border-light);
  border-radius: var(--yc-radius-md);
  padding: var(--yc-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--yc-space-2);
}

.card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--yc-text-muted);
}

.card-tier {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-tier.tier-free { color: var(--yc-text-muted); }
.card-tier.tier-pro { color: var(--yc-brand); }
.card-tier.tier-enterprise { color: #8B5CF6; }

.card-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--yc-text);
}

.card-details {
  font-size: 0.8rem;
  color: var(--yc-text-secondary);
  line-height: 1.5;
}

.dashboard-actions {
  display: flex;
  gap: var(--yc-space-3);
  margin-bottom: var(--yc-space-8);
}

/* ── Device list ── */
.device-list {
  display: flex;
  flex-direction: column;
  gap: var(--yc-space-2);
  margin-top: var(--yc-space-2);
}

.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--yc-space-2) 0;
  border-bottom: 1px solid var(--yc-border-light);
  font-size: 0.8rem;
}

.device-item:last-child { border-bottom: none; }

.device-name {
  color: var(--yc-text);
  font-weight: 500;
}

.device-seen {
  color: var(--yc-text-muted);
  font-size: 0.75rem;
}

/* ── Pro Features (free users) ── */
.dashboard-features {
  background: var(--yc-surface-white);
  border: 1px solid var(--yc-border-light);
  border-radius: var(--yc-radius-md);
  padding: var(--yc-space-6);
}

.dashboard-features h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--yc-space-4);
}

.features-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--yc-space-2);
}

.feature-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--yc-space-2) var(--yc-space-3);
  border-radius: var(--yc-radius-sm);
  background: var(--yc-bg);
  font-size: 0.85rem;
}

.feature-name {
  color: var(--yc-text-secondary);
}

.feature-locked {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--yc-text-muted);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto var(--yc-space-12);
  }
  .pricing-featured {
    transform: none;
  }
  .pricing-featured:hover {
    transform: translateY(-2px);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .auth-card {
    padding: var(--yc-space-6);
  }
  .pricing-page {
    padding: calc(var(--yc-nav-h) + var(--yc-space-10)) var(--yc-space-5);
  }
  .dashboard-page {
    padding: calc(var(--yc-nav-h) + var(--yc-space-8)) var(--yc-space-5);
  }
}

/* ── Device Unbind Button ──────────────────────────────────────── */
.device-unbind-btn {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--yc-radius-sm);
  border: 1px solid rgba(207, 102, 102, 0.3);
  background: transparent;
  color: #CF6666;
  cursor: pointer;
  transition: all var(--yc-fast);
  font-family: inherit;
  white-space: nowrap;
}

.device-unbind-btn:hover {
  background: rgba(207, 102, 102, 0.08);
  border-color: #CF6666;
}

.device-unbind-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   PRICING — Billing Toggle (月/年切换开关)
   ============================================================ */
.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--yc-space-4);
  margin-bottom: var(--yc-space-10);
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--yc-text-muted);
  transition: color var(--yc-fast);
  cursor: pointer;
  user-select: none;
}

.toggle-label.active {
  color: var(--yc-text);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--yc-border);
  border-radius: 26px;
  transition: background var(--yc-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  background: var(--yc-surface-white);
  border-radius: 50%;
  transition: transform var(--yc-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--yc-brand);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-save-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--yc-radius-full);
  background: var(--yc-brand-bg);
  color: var(--yc-brand);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── Price subtitle (e.g. "$8.25/month — Save 31%") ── */
.price-sub {
  font-size: 0.8rem;
  color: var(--yc-brand);
  font-weight: 500;
  line-height: 1.4;
}

/* ============================================================
   PRICING — Coming Soon Button (Enterprise)
   ============================================================ */
.btn-coming-soon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--yc-space-2);
  width: 100%;
  padding: var(--yc-space-3) var(--yc-space-6);
  border-radius: var(--yc-radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--yc-surface);
  border: 1px solid var(--yc-border-light);
  color: var(--yc-text-muted);
  cursor: not-allowed;
  opacity: 0.7;
  font-family: inherit;
  transition: none;
}

/* ============================================================
   PRICING — Feature Comparison Table
   ============================================================ */
.pricing-comparison {
  max-width: 780px;
  margin: var(--yc-space-16) auto 0;
}

.pricing-comparison h3 {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--yc-space-6);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.comparison-table th,
.comparison-table td {
  padding: var(--yc-space-3) var(--yc-space-4);
  border-bottom: 1px solid var(--yc-border-light);
  text-align: center;
}

.comparison-table th {
  font-weight: 600;
  background: var(--yc-surface);
  border-bottom: 2px solid var(--yc-border);
}

.comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--yc-text);
}

.col-pro {
  background: rgba(90, 122, 74, 0.04);
}

.comparison-table tr:hover td {
  background: var(--yc-hover);
}

.comparison-table tr:hover td.col-pro {
  background: rgba(90, 122, 74, 0.08);
}

/* ============================================================
   PRICING — Enterprise Card (Subdued)
   ============================================================ */
.pricing-card-enterprise {
  opacity: 0.85;
}

.pricing-card-enterprise .pricing-features .feature-yes::before {
  color: var(--yc-text-muted);
  opacity: 0.6;
}

/* ============================================================
   DASHBOARD — Subscription Type Badge (Monthly/Annual)
   ============================================================ */
.card-sub-type {
  margin-top: var(--yc-space-1);
}

.sub-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--yc-radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sub-type-monthly {
  background: var(--accent-bg, #ddf4ff);
  color: var(--accent, #2f81f7);
}

.sub-type-yearly {
  background: var(--yc-brand-bg);
  color: var(--yc-brand);
}

/* ============================================================
   PRICING — Responsive additions
   ============================================================ */
@media (max-width: 768px) {
  .billing-toggle {
    gap: var(--yc-space-3);
    flex-wrap: wrap;
  }
  .toggle-save-badge {
    width: 100%;
    text-align: center;
  }
  .comparison-table {
    font-size: 0.8rem;
  }
  .comparison-table th,
  .comparison-table td {
    padding: var(--yc-space-2) var(--yc-space-2);
  }
}

/* ============================================================
   REGISTER — Step Indicator (两步注册流程)
   ============================================================ */
.register-steps {
  margin-bottom: var(--yc-space-8);
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--yc-space-3);
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--yc-surface);
  border: 2px solid var(--yc-border-light);
  color: var(--yc-text-muted);
  transition: all var(--yc-fast);
  flex-shrink: 0;
}

.step-dot.active {
  background: var(--yc-brand);
  border-color: var(--yc-brand);
  color: var(--yc-brand-text);
}

.step-dot.completed {
  background: var(--yc-brand);
  border-color: var(--yc-brand);
  color: var(--yc-brand-text);
}

.step-line {
  width: 60px;
  height: 2px;
  background: var(--yc-border-light);
  transition: background var(--yc-fast);
}

.step-line.active {
  background: var(--yc-brand);
}

.step-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.step-label {
  font-size: 0.75rem;
  color: var(--yc-text-muted);
  font-weight: 500;
  transition: color var(--yc-fast);
}

.step-label.active {
  color: var(--yc-text);
  font-weight: 600;
}

/* ── Register form hint ── */
.form-hint {
  font-size: 0.78rem;
  color: var(--yc-text-muted);
  margin-top: var(--yc-space-1);
  line-height: 1.4;
}

/* ── Back button (Change email) ── */
.btn-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--yc-text-muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  padding: var(--yc-space-2) 0;
  transition: color var(--yc-fast);
  text-align: center;
  width: 100%;
}

.btn-link:hover {
  color: var(--yc-brand);
}
