/**
 * 前端註冊登入表單樣式 - 重新設計
 */

/* ============================
   Variables & Reset
   ============================ */
.cr-auth-container *,
.cr-auth-container *::before,
.cr-auth-container *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.cr-auth-container {
  --primary: #00a0e9;
  --primary-deep: #0077b6;
  --primary-light: #e6f6fd;
  --primary-ultra-light: #f0faff;
  --primary-glow: rgba(0, 160, 233, 0.15);
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --bg-sidebar: linear-gradient(165deg, #00a0e9 0%, #0068a3 60%, #004e7c 100%);
  --text: #1a2332;
  --text-secondary: #5a6a7e;
  --text-muted: #8e9bae;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'DM Sans', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================
   Auth Container
   ============================ */
.cr-auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.cr-auth-bg {
  position: absolute;
  inset: 0;
  background: #ffffff;
  overflow: hidden;
}

.cr-auth-bg::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,160,233,0.06) 0%, transparent 65%);
  border-radius: 50%;
}

.cr-auth-bg::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0,160,233,0.04) 0%, transparent 60%);
  border-radius: 50%;
}

/* ============================
   Auth Card
   ============================ */
.cr-auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 40px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
}

.cr-auth-card-wide {
  max-width: 520px;
}

/* Auth Header */
.cr-auth-header {
  background: var(--bg-sidebar);
  padding: 36px 40px 30px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.cr-auth-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.cr-auth-logo {
  margin-bottom: 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cr-auth-logo svg {
  width: 40px;
  height: 40px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cr-auth-header h2,
.cr-auth-header .cr-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  position: relative;
  margin: 0;
  color: #fff;
  border: none;
  padding: 0;
}

.cr-auth-header p {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 4px;
  position: relative;
}

/* Auth Body */
.cr-auth-body {
  padding: 36px 40px 40px;
}

.cr-auth-body .cr-form {
  background: transparent;
  padding: 0;
}

.cr-auth-body .cr-title {
  display: none; /* Title is in the header now */
}

/* Auth Tabs */
.cr-auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.cr-auth-tab {
  flex: 1;
  padding: 10px 16px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition);
}

.cr-auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.cr-auth-tab:hover:not(.active) {
  color: var(--text);
}

/* Auth Submit */
.cr-auth-submit,
.cr-auth-body .cr-submit {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0,160,233,0.35);
}

.cr-auth-submit:hover,
.cr-auth-body .cr-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,160,233,0.45);
}

/* Auth Links */
.cr-auth-links,
.cr-auth-body .cr-links,
.cr-auth-body .cr-link {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.cr-auth-links a,
.cr-auth-body .cr-links a,
.cr-auth-body .cr-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.cr-auth-links a:hover,
.cr-auth-body .cr-links a:hover,
.cr-auth-body .cr-link a:hover {
  text-decoration: underline;
}

.cr-auth-links .sep,
.cr-auth-body .cr-links span {
  margin: 0 10px;
  color: var(--border);
}

/* ============================
   Form Fields
   ============================ */
.cr-auth-body .cr-field {
  margin-bottom: 22px;
}

.cr-auth-body .cr-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
}

.cr-auth-body .cr-field label .required {
  color: var(--danger);
}

.cr-auth-body .cr-field input[type="text"],
.cr-auth-body .cr-field input[type="email"],
.cr-auth-body .cr-field input[type="password"],
.cr-auth-body .cr-field input[type="tel"],
.cr-auth-body .cr-field select {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

.cr-auth-body .cr-field input:focus,
.cr-auth-body .cr-field select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.cr-auth-body .cr-field input::placeholder {
  color: var(--text-muted);
}

.cr-auth-body .cr-field small,
.cr-auth-body .cr-field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Description */
.cr-auth-body .cr-description {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Phone / Email groups */
.cr-auth-body .cr-phone-group,
.cr-auth-body .cr-email-group,
.cr-auth-body .cr-address-group {
  display: flex;
  gap: 10px;
}

.cr-auth-body .cr-phone-group select,
.cr-auth-body .cr-country-select {
  max-width: 180px;
  min-width: 160px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238e9bae' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.cr-auth-body .cr-address-group select {
  max-width: 180px;
  min-width: 160px;
}

.cr-verify-btn {
  height: 46px;
  padding: 0 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 550;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.cr-verify-btn:hover {
  background: var(--primary-deep);
}

.cr-verify-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================
   Upload
   ============================ */
.cr-auth-body .cr-upload-grid {
  display: flex;
  gap: 14px;
}

.cr-auth-body .cr-upload-box {
  flex: 1;
  height: 120px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.cr-auth-body .cr-upload-box:hover {
  border-color: var(--primary);
  background: var(--primary-ultra-light);
  color: var(--primary);
}

.cr-auth-body .cr-upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.cr-auth-body .cr-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.cr-auth-body .cr-upload-content svg,
.cr-auth-body .cr-upload-box > svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cr-auth-body .cr-upload-box.has-file {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

/* ============================
   Checkbox
   ============================ */
.cr-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cr-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
}

.cr-checkbox-label a,
.cr-terms-link {
  color: var(--primary) !important;
  text-decoration: none;
}

.cr-checkbox-label a:hover,
.cr-terms-link:hover {
  text-decoration: underline;
}

/* ============================
   Panels (personal / business tabs)
   ============================ */
.cr-panel {
  display: none;
}

.cr-panel.active {
  display: block;
}

/* ============================
   Messages & Notices
   ============================ */
.cr-auth-body .cr-message {
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  display: none;
}

.cr-auth-body .cr-message.show {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cr-auth-body .cr-message.success {
  background: var(--success-bg);
  color: #065f46;
  border-left: 4px solid var(--success);
}

.cr-auth-body .cr-message.error {
  background: var(--danger-bg);
  color: #991b1b;
  border-left: 4px solid var(--danger);
}

.cr-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.6;
}

.cr-notice-info {
  background: var(--primary-light);
  color: var(--primary-deep);
  border-left: 4px solid var(--primary);
}

.cr-notice-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================
   Legacy Support
   ============================ */
/* Support old cr-wrapper class for existing pages not yet migrated */
.cr-wrapper {
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  font-family: var(--font-sans, 'DM Sans', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  font-size: 14px;
  color: #1a2332;
}

.cr-wrapper .cr-tabs {
  display: none; /* Old tabs hidden, replaced by cr-auth-tabs */
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 600px) {
  .cr-auth-container {
    padding: 20px 12px;
  }

  .cr-auth-card {
    border-radius: var(--radius);
  }

  .cr-auth-header {
    padding: 28px 24px 24px;
  }

  .cr-auth-body {
    padding: 28px 24px 32px;
  }

  .cr-auth-body .cr-phone-group,
  .cr-auth-body .cr-email-group,
  .cr-auth-body .cr-address-group {
    flex-direction: column;
  }

  .cr-auth-body .cr-phone-group select,
  .cr-auth-body .cr-country-select,
  .cr-auth-body .cr-address-group select {
    max-width: none;
    min-width: 100%;
  }

  .cr-auth-body .cr-upload-grid {
    flex-direction: column;
  }
}
