/* ─── Auth Page Styles ────────────────────────────────────────── */
/* Login & Signup — tema oscuro, mismo estilo que el resto */

:root {
  --bg: #0f1117;
  --bg2: #161b22;
  --bg3: #1c2230;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-subtle: #484f58;
  --green: #238636;
  --green-light: #3fb950;
  --yellow: #d29922;
  --yellow-light: #e3b341;
  --red: #da3633;
  --red-light: #f85149;
  --blue: #1f6feb;
  --blue-light: #58a6ff;
  --purple: #8957e5;
  --pink: #ec4899;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg2: #f6f8fa;
  --bg3: #eaeef2;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-subtle: #8b949e;
}

.auth-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ─── Nav ──────────────────────────────────────────────────── */
.auth-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

[data-theme="light"] .auth-nav {
  background: var(--bg2);
}

.auth-nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}
.nav-logo-img { width: 24px; height: 24px; }

.auth-nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-nav-user {
  font-size: 0.85rem;
  color: var(--blue-light);
  font-weight: 600;
}

.auth-nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s;
  white-space: nowrap;
}

.auth-nav-btn:hover { border-color: var(--blue-light); }

.auth-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 0.15s;
  white-space: nowrap;
}

.auth-nav-link:hover {
  color: var(--blue-light);
}

/* ─── Main card ───────────────────────────────────────────── */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  animation: fadeUp 0.4s ease;
}

[data-theme="light"] .auth-card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.auth-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-card-header .icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.auth-card-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.auth-card-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.form-input-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.9rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.form-input::placeholder {
  color: var(--text-subtle);
}

.form-input.error {
  border-color: #f85149;
}

.form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.15);
}

/* Password toggle */
.password-toggle {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.9rem;
  line-height: 1;
}

.password-toggle:hover {
  color: var(--text-muted);
}

/* Error message */
.form-error {
  font-size: 0.775rem;
  color: #f85149;
  margin-top: 0.2rem;
  display: none;
}

.form-error.visible {
  display: block;
}

/* Global error alert */
.auth-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
}

.auth-alert.error {
  display: block;
  background: rgba(218, 54, 51, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #f85149;
}

.auth-alert.success {
  display: block;
  background: rgba(35, 134, 54, 0.12);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: #3fb950;
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 0.8rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f6feb, #8957e5);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(31, 111, 235, 0.25);
  white-space: nowrap;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(31, 111, 235, 0.4);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ─── Footer link ─────────────────────────────────────────── */
.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--blue-light);
  text-decoration: none;
  font-weight: 600;
}

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

/* ─── Password strength ──────────────────────────────────── */
.password-strength {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.ps-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}

.ps-bar.active.weak { background: #f85149; }
.ps-bar.active.medium { background: #e3b341; }
.ps-bar.active.strong { background: #3fb950; }

.ps-text {
  font-size: 0.7rem;
  color: var(--text-subtle);
  margin-top: 0.2rem;
}

/* ─── Auth divider ───────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  font-size: 0.8rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Auth Providers Stack ───────────────────────────────── */
.auth-providers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg2);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    white-space: nowrap;
}
.btn-provider svg {
    flex-shrink: 0;
}
.btn-provider:hover {
    background: var(--bg3);
    border-color: var(--blue-light);
}
.btn-proton:hover { border-color: #6D4AFF; }
.btn-metamask:hover { border-color: #E2761B; }
.btn-hub:hover { border-color: #38bdf8; }

.auth-alert.info {
    background: rgba(56,189,248,0.1);
    border: 1px solid rgba(56,189,248,0.2);
    color: #38bdf8;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-nav { padding: 0.75rem 1.25rem; }
  .auth-nav-links { gap: 0.5rem; }
  .auth-main { padding: 1.5rem 1rem; }
  .auth-card { max-width: 100%; padding: 2rem 1.5rem; }
  .ffw-acct-dropdown { right: 0; left: auto; min-width: 180px; max-width: calc(100vw - 1rem); }
}

@media (max-width: 480px) {
  .auth-nav { padding: 0.65rem 0.85rem; flex-wrap: wrap; gap: 0.5rem; max-width: 100vw; }
  .auth-nav-links { flex-wrap: wrap; gap: 0.35rem; }
  .auth-main { padding: 1rem 0.75rem; }
  .auth-card { padding: 1.25rem 1rem; border-radius: 10px; max-width: 100%; }
  .auth-card-header h1 { font-size: 1.3rem; word-break: break-word; }
  .btn-submit { padding: 0.7rem; font-size: 0.95rem; }
  .auth-providers { gap: 0.4rem; }
  .btn-provider { padding: 0.6rem 0.75rem; font-size: 0.85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .auth-nav-logo { font-size: 0.9rem; }
  .ffw-acct-dropdown { min-width: 150px; font-size: 0.75rem; }
}

/* ─── Inline-style replacements ───────────────────────────────── */
.form-inline {
  display: inline;
}

.btn-text-only {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

.btn-create-user {
  padding: 0.6rem 1.2rem;
  white-space: nowrap;
}

.form-group-end {
  align-self: flex-end;
}

.avatar-camera-icon {
  width: 14px;
  height: 14px;
}

.file-upload-hidden {
  display: none;
}

/* ─── Language toggle ──────────────────────────────────────────── */
.lang-toggle {
  position: relative;
  display: inline-flex;
  margin-left: 0.25rem;
}

/* ─── Theme toggle ──────────────────────────────────────────────── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-left: 0.25rem;
  line-height: 1;
}
.theme-toggle-btn:hover {
  border-color: var(--blue-light);
  background: rgba(31, 111, 235, 0.08);
}

.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.lang-toggle-btn:hover { border-color: var(--blue-light); color: var(--text); background: rgba(31, 111, 235, 0.08); }
.lang-toggle-btn .arrow { font-size: 0.5rem; opacity: 0.6; transition: transform 0.2s; }
.lang-toggle.open .lang-toggle-btn { border-color: var(--blue-light); color: var(--text); background: rgba(31, 111, 235, 0.12); }
.lang-toggle.open .arrow { transform: rotate(180deg); }
.lang-toggle-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem;
  min-width: 160px;
  z-index: 999;
  display: none;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
.lang-toggle.open .lang-toggle-dropdown { display: block; }
.lang-toggle-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
.lang-toggle-option:hover { color: var(--text); background: var(--bg3); }
.lang-toggle-option.active { color: var(--blue-light); font-weight: 700; background: rgba(31, 111, 235, 0.08); }

html[dir="rtl"] .auth-nav-links { flex-direction: row-reverse; }
html[dir="rtl"] .lang-toggle-dropdown { right: auto; left: 0; }
html[dir="rtl"] .ffw-acct-dropdown { right: auto; left: 0; }
html[dir="rtl"] .lang-toggle-option { text-align: right; }

@media (max-width: 1024px) {
  .lang-toggle-btn { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
  .lang-toggle-btn .lang-code { display: none; }
  .lang-toggle-dropdown { min-width: 150px; right: auto; left: 0; }
}

/* ─── Account Switcher ─────────────────────────────────────────── */
#ffw-account-switcher { position: relative; display: inline-flex; align-items: center; }
.ffw-acct-btn { cursor: pointer; font-size: 1.1rem; padding: 0.2rem 0.45rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg2); color: var(--text); }
.ffw-acct-btn:hover { background: var(--bg3); }
.ffw-acct-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 0.35rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; min-width: 180px; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.ffw-acct-dropdown.open { display: block; }
.ffw-acct-item { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.82rem; display: flex; align-items: center; justify-content: space-between; color: var(--text); }
.ffw-acct-item:hover { background: var(--bg3); }
.ffw-acct-item:first-child { border-radius: 8px 8px 0 0; }
.ffw-acct-item:last-child { border-radius: 0 0 8px 8px; }
.ffw-acct-logout { border-top: 1px solid var(--border); color: #f87171; font-weight: 600; }
.ffw-acct-rm { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.75rem; padding: 0.1rem 0.3rem; }
.ffw-acct-rm:hover { color: #f87171; }
.ffw-acct-sub { padding-left: 2rem; color: var(--blue-light, #58a6ff); font-weight: 500; }
.ffw-acct-sub:hover { background: var(--bg3); }


/* ─── Add Account Sub-Menu ─────────────────────────────────────── */
.ffw-acct-sub-wrap {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(31,111,235,0.03);
  animation: ffwSubIn 0.15s ease-out;
}
@keyframes ffwSubIn { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 100px; } }

.ffw-acct-sub {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  padding-left: 1rem !important;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text) !important;
  transition: background 0.15s, padding-left 0.15s;
  border-left: 3px solid transparent;
}
.ffw-acct-sub:hover {
  background: var(--bg3);
  padding-left: 1.25rem !important;
}
.ffw-acct-sub-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.ffw-acct-sub-ph { border-left-color: transparent; }
.ffw-acct-sub-ph:hover { border-left-color: #38bdf8; }
.ffw-acct-sub-ph .ffw-acct-sub-icon { background: rgba(56,189,248,0.15); }
.ffw-acct-sub-manual { color: var(--text-muted) !important; }
.ffw-acct-sub-manual:hover { border-left-color: var(--border); }
.ffw-acct-sub-manual .ffw-acct-sub-icon { background: rgba(148,163,184,0.1); }
.ffw-acct-sub-text { white-space: nowrap; }

/* ─── PH Account Picker ────────────────────────────────────────── */
.ph-picker-wrap { position: relative; display: inline-flex; align-items: center; }
.ffw-ph-dropdown { display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 0.35rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; min-width: 200px; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.ffw-ph-dropdown.open { display: block; }
.ffw-ph-item { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.82rem; display: flex; align-items: center; justify-content: space-between; color: var(--text); white-space: nowrap; }
.ffw-ph-item:hover { background: var(--bg3); }
.ffw-ph-item:first-child { border-radius: 8px 8px 0 0; }
.ffw-ph-item:last-child { border-radius: 0 0 8px 8px; }
.ffw-ph-divider { height: 1px; background: var(--border); margin: 0; padding: 0; cursor: default; }
.ffw-ph-divider:hover { background: var(--border); }
.ffw-ph-add { color: var(--blue-light, #58a6ff); font-weight: 600; }
.ffw-ph-rm { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.75rem; padding: 0.1rem 0.3rem; }
.ffw-ph-rm:hover { color: #f87171; }
html[dir="rtl"] .ffw-ph-dropdown { left: auto; right: 50%; transform: translateX(50%); }
