/* ============================================================
   Remarkable Sounds — Auth UI
   ============================================================ */

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

/* Ensure the HTML `hidden` attribute always wins over any display value */
[hidden] { display: none !important; }

:root {
  --brand:       #6C3BF5;
  --brand-dark:  #5529d4;
  --brand-light: #ede9fe;
  --accent:      #F5A623;
  --bg:          #0d0d14;
  --bg-card:     #16161f;
  --bg-input:    #1f1f2e;
  --border:      #2a2a3d;
  --text:        #f0eeff;
  --text-muted:  #8b87a9;
  --error:       #f87171;
  --success:     #34d399;
  --radius:      12px;
  --radius-sm:   8px;
  --transition:  0.18s ease;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---------- Layout ---------- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

/* ---------- Header nav ---------- */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-auth-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.header-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
}

.header-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.header-btn--primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.header-btn--ghost {
  border-color: transparent;
  color: var(--text-muted);
}
.header-btn--ghost:hover {
  color: var(--error);
  border-color: transparent;
  background: rgba(248,113,113,0.08);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.header-username {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
}
.header-username:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------- Auth container ---------- */
.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition), border-bottom-color var(--transition);
  border-bottom: 2px solid transparent;
  position: relative;
  bottom: -1px;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ---------- Tab panels ---------- */
.tab-panel {
  display: none;
  padding: 2rem;
}

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

.panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.panel-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.optional {
  font-weight: 400;
  opacity: 0.6;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder { color: #4a4868; }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(108, 59, 245, 0.2);
}

input.invalid { border-color: var(--error) !important; }

/* ---------- Password toggle ---------- */
.password-wrapper { position: relative; }

.password-wrapper input { padding-right: 2.5rem; }

.toggle-password {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0;
  transition: color var(--transition);
}

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

.eye-icon { width: 18px; height: 18px; }

/* ---------- Password strength ---------- */
.password-strength {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  height: 1rem;
}

.strength-weak   { color: #f87171; }
.strength-fair   { color: var(--accent); }
.strength-strong { color: var(--success); }

/* ---------- Role cards ---------- */
.role-fieldset {
  border: none;
  margin-bottom: 1.5rem;
}

.role-legend {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.role-card { cursor: pointer; }

.role-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.role-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  text-align: center;
}

.role-card:hover .role-card-inner {
  border-color: #4a4a7a;
  background: #1e1e30;
}

.role-card input[type="radio"]:checked + .role-card-inner {
  border-color: var(--brand);
  background: rgba(108, 59, 245, 0.1);
  box-shadow: 0 0 0 3px rgba(108, 59, 245, 0.2);
}

.role-icon {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.role-card input[type="radio"]:checked + .role-card-inner .role-icon {
  color: var(--brand);
}

.role-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.role-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}

.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  background: transparent;
  border: none;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}

.link-btn:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.form-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}

.form-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}

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

/* ---------- Auth divider (between form and Google button) ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Google Sign-In button container ---------- */
.google-btn-container {
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}

/* The GIS library renders its own iframe; ensure it fills the width */
.google-btn-container > div,
.google-btn-container iframe {
  width: 100% !important;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .auth-card { border-radius: 0; border-left: none; border-right: none; }
  .tab-panel { padding: 1.5rem; }
  .form-row { grid-template-columns: 1fr; }
  .role-cards { grid-template-columns: 1fr 1fr; }
  .site-header { padding: 1rem; }
  .header-username { display: none; }
}
