/* ========== Login & Register ========== */
/* ========== Form Section ========== */
.demo-form-section {
  padding: 3rem 0 4rem;
}

.demo-layout {
  display: grid;
  gap: 2rem;
}

/* Left: Form Card */
.demo-form-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  order: 2;
}

.demo-form-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.demo-form-subheading {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}
.required-star {
  color: var(--red);
}

.demo-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.form-label {
  font-size: 0.875rem;
  font-weight: 500;
}
.form-input {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--foreground);
  background: var(--background);
}
.form-input::placeholder {
  color: var(--muted-foreground);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08);
}
.form-input--error {
  border-color: var(--red);
}
.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Form Alert (server-side) */
.form-alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.form-alert--error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.form-alert--success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* Error Message */
.form-error {
  font-size: 0.75rem;
  color: var(--red);
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s, opacity 0.2s, margin 0.2s;
  opacity: 0;
}
.form-error--visible {
  max-height: 1.5rem;
  opacity: 1;
  margin-top: 0.25rem;
}

/* Submit Button */
.demo-submit-btn {
  margin-top: 0.5rem;
  width: 100%;
}

/* Success State */
.demo-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: 1rem;
}
.demo-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}
.demo-success-title {
  font-size: 1.5rem;
  font-weight: 700;
}
.demo-success-desc {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  line-height: 1.75;
  max-width: 24rem;
}

/* ========== Right: Info ========== */
.demo-info {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  order: 1;
}

.demo-info-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.demo-info-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Info list */
.demo-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.demo-info-list li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--foreground);
}
.demo-info-list li svg {
  color: var(--green);
  flex-shrink: 0;
}

/* Contacts */
.demo-info-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.demo-info-contact-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.demo-info-contact-item svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* Trust card */
.demo-info-card--trust {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: transparent;
  color: var(--primary-foreground);
  text-align: center;
}
.demo-trust-avatars {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.demo-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.demo-trust-text {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
}
.demo-trust-text strong {
  color: #fff;
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
  .demo-hero {
    padding: 4rem 0;
  }
  .demo-hero-title {
    font-size: 2.5rem;
  }
  .demo-layout {
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2.5rem;
  }
  .demo-form-card {
    order: 1;
  }
  .demo-info {
    order: 2;
  }
  .demo-form-card {
    padding: 2.5rem;
  }
}

/* ========== Register Page ========== */

/* Layout */
.register-page {
  min-height: calc(100vh);
  display: flex;
}

/* Left Brand Panel */
.register-brand {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 0 0 42%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--primary-foreground);
  padding: 3rem;
  position: relative;
  overflow: hidden;
}
.register-brand::before {
  content: '';
  position: absolute;
  right: -6rem;
  top: -6rem;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}
.register-brand::after {
  content: '';
  position: absolute;
  left: -3rem;
  bottom: -4rem;
  width: 16rem;
  height: 16rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
}

.register-brand-content {
  position: relative;
  z-index: 1;
  max-width: 28rem;
}
.register-brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 2.5rem;
}
.register-brand-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
}
.register-brand-logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.register-brand-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 1rem;
}
.register-brand-desc {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2.5rem;
}

.register-brand-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.register-brand-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.register-brand-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.register-brand-feature-text h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}
.register-brand-feature-text p {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

/* Right Form Panel */
.register-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow-y: auto;
}

.register-form-wrapper {
  max-width: 28rem;
  margin: 0 auto;
  width: 100%;
}

.register-mobile-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.register-mobile-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--primary);
  border-radius: var(--radius);
  color: #fff;
}
.register-mobile-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.register-form-heading {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.375rem;
}
.register-form-subheading {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
}
.register-form-subheading a {
  color: var(--primary);
  font-weight: 500;
}
.register-form-subheading a:hover {
  text-decoration: underline;
}

/* Form */
.register-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.form-label {
  font-size: 0.875rem;
  font-weight: 500;
}
.required-star {
  color: var(--red);
}
.form-input {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--foreground);
  background: var(--background);
}
.form-input::placeholder {
  color: var(--muted-foreground);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08);
}
.form-input--error {
  border-color: var(--red);
}
.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.form-error {
  font-size: 0.75rem;
  color: var(--red);
  min-height: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s, opacity 0.2s, margin 0.2s;
  opacity: 0;
}
.form-error--visible {
  max-height: 1.5rem;
  opacity: 1;
  margin-top: 0.25rem;
}

/* Password field with toggle */
.form-input-wrapper {
  position: relative;
}
.form-input-wrapper .form-input {
  width: 100%;
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.password-toggle:hover {
  color: var(--foreground);
}

/* Password strength */
.password-strength {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.password-strength-bar {
  flex: 1;
  height: 0.25rem;
  border-radius: 9999px;
  background: var(--border);
  transition: background 0.3s;
}
.password-strength-bar.active-weak { background: var(--red); }
.password-strength-bar.active-medium { background: var(--amber); }
.password-strength-bar.active-strong { background: var(--green); }

.password-strength-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.375rem;
}

/* SMS code row */
.sms-row {
  display: flex;
  gap: 0.75rem;
}
.sms-row .form-input {
  flex: 1;
}
.sms-btn {
  white-space: nowrap;
  padding: 0.625rem 1rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
  min-width: 7.5rem;
  text-align: center;
}
.sms-btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--primary-foreground);
}
.sms-btn:disabled {
  border-color: var(--border);
  color: var(--muted-foreground);
  cursor: not-allowed;
}

/* Agreement */
.form-agreement {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.form-agreement input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  margin-top: 0.2rem;
  flex-shrink: 0;
  cursor: pointer;
}
.form-agreement a {
  color: var(--primary);
  font-weight: 500;
}
.form-agreement a:hover {
  text-decoration: underline;
}

/* Submit */
.register-submit-btn {
  margin-top: 0.5rem;
  width: 100%;
}

/* Divider */
.register-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.register-divider::before,
.register-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Social login */
.register-social {
  display: flex;
  justify-content: center;
  gap: 1rem;
}
.register-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--background);
}
.register-social-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Success State */
.register-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 0;
  gap: 1rem;
}
.register-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}
.register-success-title {
  font-size: 1.5rem;
  font-weight: 700;
}
.register-success-desc {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  line-height: 1.75;
  max-width: 24rem;
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
  .register-form-panel {
    padding: 3rem 2.5rem;
  }
  .register-mobile-logo {
    display: none;
  }
  .register-brand {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .register-form-panel {
    padding: 3rem 4rem;
  }
}

/* ========== Login Page (extends Register styles) ========== */

/* Remember / Forget */
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: -0.5rem;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.login-forget {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.login-forget:hover {
  color: var(--primary);
}

/* Captcha Canvas */
.captcha-canvas {
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  height: 2.75rem;
  width: 120px;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.captcha-canvas:hover {
  border-color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--foreground);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  white-space: nowrap;
}

.toast--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast--success {
  background: #16a34a;
}

.toast--error {
  background: #dc2626;
}

.toast--info {
  background: var(--foreground);
}

/* ws-toast — used by message center */
.ws-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.ws-toast.show { opacity: 1; }

/* Mobile adjustments */
@media (max-width: 640px) {
  .login-options {
    font-size: 0.8125rem;
  }

  .captcha-canvas {
    width: 100px;
    height: 2.5rem;
  }
}
