/* ─────────────────────────────────────────────────────────
   WanChat — Login page styles
   ───────────────────────────────────────────────────────── */

/* ── Variables ───────────────────────────────────────────── */
:root {
  --bg:          #0E0A12;
  --bg-panel:    #130E18;
  --bg-card:     #17101E;
  --bg-input:    #130D18;

  --accent:      #E8245C;
  --accent-2:    #4A8FD4;
  --accent-glow: rgba(232, 36, 92, 0.15);

  --border:      rgba(232, 36, 92, 0.12);
  --border-focus:rgba(232, 36, 92, 0.42);

  --text:        #EDE8F0;
  --text-muted:  #6B5A70;
  --text-dim:    #3A2840;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;

  --font-display: 'Syne', sans-serif;
  --font-ui:      'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Animated background ─────────────────────────────────── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 18% 38%, rgba(232, 36, 92, 0.09)  0%, transparent 65%),
    radial-gradient(ellipse 55% 45% at 82% 65%, rgba(74, 143, 212, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 45% 35% at 55% 5%,  rgba(232, 36, 92, 0.05)  0%, transparent 55%);
  animation: mesh-shift 22s ease-in-out infinite alternate;
}

@keyframes mesh-shift {
  0%   { transform: scale(1)    translate(0,    0);    opacity: 1;   }
  30%  { transform: scale(1.04) translate(-1%,  2%);   opacity: 0.8; }
  65%  { transform: scale(0.97) translate(2%,  -1%);   opacity: 0.9; }
  100% { transform: scale(1.03) translate(-0.5%, 1%);  opacity: 1;   }
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(232, 36, 92, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 143, 212, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 80%);
}

/* ── Page layout (centré) ────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 28px;
}

/* ── Brand ───────────────────────────────────────────────── */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-logo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.brand-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 18px rgba(232, 36, 92, 0.5)) drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}

.logo-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1.5px solid rgba(232, 36, 92, 0.35);
  animation: ring-pulse 3.2s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1);    }
  50%       { opacity: 0.8; transform: scale(1.10); box-shadow: 0 0 20px rgba(232, 36, 92, 0.25); }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(130deg, #EDE8F0 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-top: -8px;
}

/* ── Form card ───────────────────────────────────────────── */
.form-card {
  width: 100%;
  max-width: 420px;
  background: rgba(18, 12, 24, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(232, 36, 92, 0.12);
  border-radius: var(--r-lg);
  padding: 40px 36px 32px;
  box-shadow:
    0 0 0 1px rgba(232, 36, 92, 0.05),
    0 24px 72px rgba(0, 0, 0, 0.60),
    0 4px 16px rgba(0, 0, 0, 0.40);
  animation: fade-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

/* ── Form header ─────────────────────────────────────────── */
.form-header { margin-bottom: 36px; }

.form-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1.08;
  margin-bottom: 10px;
}

.form-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.55;
}

/* ── Fields ──────────────────────────────────────────────── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.field-wrap {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  pointer-events: none;
  transition: color 0.2s ease;
  z-index: 1;
}

.field-wrap:focus-within .field-icon {
  color: var(--accent);
}

.field-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px 12px 38px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
  z-index: 1;
}

.field-wrap.has-toggle .field-input {
  padding-right: 40px;
}

.field-input::placeholder {
  color: var(--text-dim);
  font-weight: 300;
}

input[type="password"].field-input {
  font-size: 10px;
  letter-spacing: 0.2em;
}

.field-input:focus {
  border-color: var(--border-focus);
  background: rgba(11, 17, 30, 0.95);
}

.field-input:focus ~ .field-glow {
  opacity: 1;
}

.field-glow {
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--r-md) + 1px);
  box-shadow: 0 0 0 3px rgba(232, 36, 92, 0.10);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 0;
}

/* ── Password toggle ─────────────────────────────────────── */
.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 2;
}

.toggle-pw:hover { color: var(--text-muted); }
.toggle-pw svg   { width: 15px; height: 15px; }

/* ── Form options ────────────────────────────────────────── */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-wrap input[type="checkbox"] { display: none; }

.checkbox-custom {
  width: 15px;
  height: 15px;
  border: 1.5px solid rgba(232, 36, 92, 0.30);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, border-color 0.18s;
}

.checkbox-wrap input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-wrap input:checked + .checkbox-custom::after {
  content: '';
  display: block;
  width: 8px;
  height: 5px;
  border-left: 2px solid #0E0A12;
  border-bottom: 2px solid #0E0A12;
  transform: rotate(-45deg) translateY(-1px);
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-muted);
}

.forgot-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.65;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.forgot-link:hover { opacity: 1; }

/* ── Primary button ──────────────────────────────────────── */
.btn-primary {
  position: relative;
  width: 100%;
  background: linear-gradient(130deg, var(--accent-2) 0%, var(--accent) 100%);
  border: none;
  border-radius: var(--r-md);
  padding: 13px 24px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 28px rgba(232, 36, 92, 0.35),
    0 2px 8px  rgba(74, 143, 212, 0.20);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-18deg);
  transition: left 0.5s ease;
  pointer-events: none;
}

.btn-primary:hover .btn-shimmer { left: 160%; }

.btn-arrow {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow { transform: translateX(3px); }

/* ── Form footer ─────────────────────────────────────────── */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.footer-text {
  font-size: 13.5px;
  color: var(--text-muted);
}

.btn-secondary {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(232, 36, 92, 0.30);
  padding-bottom: 1px;
  transition: opacity 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  opacity: 0.75;
  border-bottom-color: rgba(232, 36, 92, 0.75);
}

/* ── Shared animations ───────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  .brand-logo-wrap { width: 80px;  height: 80px;  }
  .brand-logo      { width: 80px;  height: 80px;  }
  .brand-name      { font-size: 26px; }
  .brand-tagline   { font-size: 12px; }
  .form-card       { padding: 24px 18px 20px; border-radius: var(--r-md); }
  .form-title      { font-size: 26px; }
  .form-subtitle   { font-size: 13px; }
  .form-header     { margin-bottom: 24px; }
  .form-options    { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page            { padding: 20px 14px; gap: 16px; }
  .btn-primary     { padding: 12px 20px; font-size: 14px; }
}
