/* ================================================================
   ThreadCraft — Auth Pages Stylesheet
   Covers: login.html & signup.html
   Features: Dark mode, RTL, Responsive, Animations
   ================================================================ */

/* ── Google Fonts (matching brand) ─────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,600;0,700;1,600;1,700&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Brand colours — extracted from index.html */
  --clr-deep:       #1a0f1e;
  --clr-dark:       #2a1f2e;
  --clr-primary:    #4C414F;
  --clr-purple:     #7B4A6E;
  --clr-accent:     #FF6B6B;
  --clr-accent-2:   #e85555;

  /* Light theme surfaces */
  --bg-page:        #f4f1f6;
  --bg-card:        #ffffff;
  --bg-input:       #f9f7fb;
  --bg-input-focus: #ffffff;
  --border:         #e3dde8;
  --border-focus:   #4C414F;
  --text-heading:   #1a0f1e;
  --text-body:      #3d3042;
  --text-muted:     #8a7a92;
  --text-placeholder:#b5a8bc;

  /* Shared tokens */
  --radius-card:    20px;
  --radius-input:   10px;
  --radius-btn:     10px;
  --shadow-card:    0 20px 60px rgba(26,15,30,0.10), 0 4px 16px rgba(26,15,30,0.06);
  --shadow-btn:     0 6px 24px rgba(255,107,107,0.38);
  --transition:     0.24s cubic-bezier(0.4,0,0.2,1);

  /* Typography */
  --font-display:   'Cormorant Garamond', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-page:        #110a16;
  --bg-card:        #1c1124;
  --bg-input:       #241530;
  --bg-input-focus: #2c1a3a;
  --border:         #3b2750;
  --border-focus:   #7B4A6E;
  --text-heading:   #f0e8f5;
  --text-body:      #c8b8d4;
  --text-muted:     #7a6585;
  --text-placeholder:#4e3d5c;
  --shadow-card:    0 20px 60px rgba(0,0,0,0.50), 0 4px 16px rgba(0,0,0,0.30);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg-page);
  color: var(--text-body);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); }

/* ── RTL adjustments ─────────────────────────────────────────── */
[dir="rtl"] { direction: rtl; }
[dir="rtl"] .field-icon { left: auto; right: 14px; }
[dir="rtl"] .eye-btn    { right: auto; left: 14px; }
[dir="rtl"] .input-field { padding-left: 14px; padding-right: 42px; }
[dir="rtl"] .input-field.has-eye { padding-right: 42px; padding-left: 42px; }
[dir="rtl"] .auth-back  { flex-direction: row-reverse; }
[dir="rtl"] .social-row { flex-direction: row-reverse; }
[dir="rtl"] .strength-label { text-align: left; }
[dir="rtl"] .check-label { flex-direction: row-reverse; }
[dir="rtl"] .utility-bar { left: 24px; right: auto; }
[dir="rtl"] .forgot-wrap { flex-direction: row-reverse; }
[dir="rtl"] .divider-line::before,
[dir="rtl"] .divider-line::after { transform: scaleX(-1); }

/* ================================================================
   PAGE LAYOUT — Split screen
   ================================================================ */

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
}

/* ── Left/Right panel: Brand visual ─────────────────────────── */
.brand-panel {
  position: relative;
  background: linear-gradient(145deg, var(--clr-deep) 0%, var(--clr-dark) 45%, var(--clr-primary) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 60px;
  padding: 52px 52px 44px;
  overflow: hidden;
  color: #fff;
}

/* Decorative embroidery–inspired layered background */
.brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 15% 85%, rgba(255,107,107,0.18) 0%, transparent 65%),
    radial-gradient(ellipse 55% 65% at 85% 10%, rgba(123,74,110,0.22) 0%, transparent 65%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(76,65,79,0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Thread/stitch pattern overlay */
.brand-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 34px, rgba(255,255,255,0.028) 34px, rgba(255,255,255,0.028) 35px),
    repeating-linear-gradient(90deg, transparent, transparent 34px, rgba(255,255,255,0.018) 34px, rgba(255,255,255,0.018) 35px);
  pointer-events: none;
}

.brand-logo {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-logo-icon { font-size: 1.8rem; line-height: 1; }
.brand-logo-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.brand-logo-text span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-top: 2px;
}

.brand-hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  padding: 20px 0 36px;
}

.brand-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--clr-accent);
  margin-bottom: 18px;
  opacity: 0.9;
}

.brand-headline {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3.2vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 20px;
}

.brand-headline em {
  font-style: italic;
  color: var(--clr-accent);
}

.brand-desc {
  font-size: 0.88rem;
  line-height: 1.75;
  color: rgba(255,255,255,0.62);
  max-width: 340px;
  margin: 0 auto;
}

/* Floating trust cards */
.brand-trust {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.trust-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 14px 16px;
  backdrop-filter: blur(8px);
  transition: background var(--transition);
}
.trust-card:hover { background: rgba(255,255,255,0.11); }

.trust-icon { font-size: 1.3rem; margin-bottom: 6px; }
.trust-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}
.trust-sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.4;
}

/* ── Right/Left panel: Form ──────────────────────────────────── */
.form-panel {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow-y: auto;
  transition: background var(--transition);
}

/* ── Utility bar (top-right of form panel) ───────────────────── */
.utility-bar {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.util-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-body);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.util-btn:hover {
  border-color: var(--clr-accent);
  background: var(--clr-accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,107,107,0.28);
}

/* ── Auth form wrapper ───────────────────────────────────────── */
.auth-box {
  width: 100%;
  max-width: 440px;
  animation: slideUp 0.52s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* back link */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 32px;
  transition: color var(--transition);
}
.auth-back:hover { color: var(--clr-accent); }
.auth-back svg { transition: transform var(--transition); }
.auth-back:hover svg { transform: translateX(-3px); }
[dir="rtl"] .auth-back:hover svg { transform: translateX(3px); }

/* ── Form head ───────────────────────────────────────────────── */
.form-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 13px;
  border-radius: 100px;
  border: 1px solid rgba(255,107,107,0.28);
  background: rgba(255,107,107,0.07);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-accent);
  margin-bottom: 14px;
  margin-left: auto;
  margin-right: auto;
}

.form-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 2.6vw, 2.1rem);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: 8px;
  text-align: center;
}

.form-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
  text-align: center;
}

/* ── Social Login ────────────────────────────────────────────── */
.social-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}
/* 3-col variant for signup */
.social-buttons.three-col { grid-template-columns: 1fr 1fr 1fr; }

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--bg-input);
  color: var(--text-body);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.social-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-card);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(26,15,30,0.10);
}
[data-theme="dark"] .social-btn:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.30); }

.social-btn svg { flex-shrink: 0; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  color: var(--text-placeholder);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.divider-line::before,
.divider-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Form Fields ─────────────────────────────────────────────── */
.form-fields { display: flex; flex-direction: column; gap: 16px; }

.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group { display: flex; flex-direction: column; gap: 5px; }

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  letter-spacing: 0.02em;
}
.field-label .req { color: var(--clr-accent); margin-left: 2px; }
[dir="rtl"] .field-label .req { margin-left: 0; margin-right: 2px; }

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-placeholder);
  pointer-events: none;
  transition: color var(--transition);
  display: flex;
}

.input-field {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-heading);
  transition: all var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.input-field::placeholder { color: var(--text-placeholder); }
.input-field:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3.5px rgba(76,65,79,0.10);
}
.input-field:focus + .field-icon,
.field-wrap:focus-within .field-icon { color: var(--clr-primary); }

/* error state */
.input-field.is-error { border-color: var(--clr-accent); background: rgba(255,107,107,0.05); }
.input-field.is-error:focus { box-shadow: 0 0 0 3.5px rgba(255,107,107,0.12); }

/* password eye btn */
.eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  display: flex;
  transition: color var(--transition);
}
.eye-btn:hover { color: var(--clr-primary); }

.input-field.has-eye { padding-right: 42px; }

/* field error msg */
.field-error {
  font-size: 0.72rem;
  color: var(--clr-accent);
  font-weight: 500;
  min-height: 1em;
  display: none;
}
.field-error.visible { display: block; }

/* field hint */
.field-hint {
  font-size: 0.71rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── Password Strength ───────────────────────────────────────── */
.strength-wrap { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.strength-bars { display: flex; gap: 4px; }
.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 100px;
  background: var(--border);
  transition: background 0.3s ease;
}
.strength-bar.weak   { background: #e74c3c; }
.strength-bar.fair   { background: #f39c12; }
.strength-bar.good   { background: #27ae60; }
.strength-bar.strong { background: #16a085; }

.strength-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  transition: color 0.3s;
}
[data-strength="1"] .strength-label { color: #e74c3c; }
[data-strength="2"] .strength-label { color: #f39c12; }
[data-strength="3"] .strength-label { color: #27ae60; }
[data-strength="4"] .strength-label { color: #16a085; }

/* ── Checkbox row ────────────────────────────────────────────── */
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  user-select: none;
}
.check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--clr-accent);
  margin-top: 1px;
  cursor: pointer;
}
.check-label a { color: var(--clr-accent); font-weight: 500; }
.check-label a:hover { text-decoration: underline; }

/* ── Forgot + remember row ───────────────────────────────────── */
.forgot-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}
.forgot-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--clr-accent);
  transition: opacity var(--transition);
}
.forgot-link:hover { opacity: 0.75; }

/* ── Submit button ───────────────────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(130deg, var(--clr-dark) 0%, var(--clr-primary) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, var(--clr-accent) 0%, var(--clr-purple) 100%);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn-submit > * { position: relative; z-index: 1; }
.btn-submit:hover::before { opacity: 1; }
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn);
}
.btn-submit:active { transform: translateY(0); box-shadow: none; }
.btn-submit:disabled { opacity: 0.65; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-submit.loading .btn-text { opacity: 0; }
.btn-submit .spinner {
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-submit.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth switch ─────────────────────────────────────────────── */
.auth-switch {
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-switch a {
  color: var(--clr-accent);
  font-weight: 600;
}
.auth-switch a:hover { text-decoration: underline; }

/* ── Social icons strip ──────────────────────────────────────── */
.social-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.social-strip-link {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.social-strip-link:hover {
  border-color: var(--clr-accent);
  background: var(--clr-accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,107,107,0.3);
}

/* ── Footer strip ────────────────────────────────────────────── */
.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 20px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.auth-footer a { transition: color var(--transition); }
.auth-footer a:hover { color: var(--clr-accent); }
.auth-footer span.dot { opacity: 0.3; }

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablet: hide brand panel */
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .form-panel  { min-height: 100dvh; padding: 80px 28px 40px; }
  .utility-bar { top: 16px; right: 16px; }
  [dir="rtl"] .utility-bar { right: auto; left: 16px; }
}

/* Mobile */
@media (max-width: 520px) {
  .form-panel  { padding: 72px 18px 36px; }
  .name-row    { grid-template-columns: 1fr; }
  .social-buttons { grid-template-columns: 1fr; }
  .social-buttons.three-col { grid-template-columns: 1fr; }
  .auth-box    { max-width: 100%; }
  .form-title  { font-size: 1.6rem; }
}

/* Very small */
@media (max-width: 360px) {
  .forgot-wrap { flex-direction: column; align-items: flex-start; gap: 8px; }
  [dir="rtl"] .forgot-wrap { align-items: flex-end; }
}
