/* ==========================================================================
   Profile Page Styles — Aperture22
   Scandinavian minimal, light, card-based layout.
   Inherits design tokens from /styles.css.
   ========================================================================== */

/* ── Page Layout ──────────────────────────────────────────────────────────── */

#profile-section,
#auth-section {
  width: 100%;
}

/* ── Auth Card ────────────────────────────────────────────────────────────── */

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  max-width: 400px;
  margin: 2rem auto;
  padding: var(--space-xl);
}

/* ── Auth Mode Toggle ─────────────────────────────────────────────────────── */

.auth-toggle {
  display: flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 3px;
  gap: 3px;
  margin-bottom: var(--space-lg);
}

.auth-toggle-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-toggle-btn--active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.auth-toggle-btn:hover:not(.auth-toggle-btn--active) {
  color: var(--accent-primary);
}

/* ── Form Elements ────────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: var(--space-md);
}

.form-group label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-halo);
}

.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.form-group select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-halo);
}

.form-group input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.form-help-text {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* ── Auth Error ───────────────────────────────────────────────────────────── */

.auth-password-hint {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0;
}

.auth-error {
  display: none;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-danger);
  background: rgba(193, 58, 37, 0.06);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin-bottom: var(--space-md);
}

.auth-error--reset {
  background: rgba(193, 58, 37, 0.08);
  color: var(--color-error);
  border-color: var(--color-error);
}

/* ── Password Reset Flow ──────────────────────────────────────────────────── */

#reset-section {
  width: 100%;
}

.auth-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--font-ui);
  color: var(--color-text);
  margin-bottom: var(--space-lg);
}

.forgot-password-row {
  margin: 0;
  text-align: right;
}

.forgot-password-link,
.auth-alt-link a {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--accent-primary);
  text-decoration: none;
}

.forgot-password-link:hover,
.auth-alt-link a:hover {
  text-decoration: underline;
}

.auth-alt-link {
  margin: var(--space-md) 0 0;
  text-align: center;
}

.reset-success-text {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--accent-primary);
  background: rgba(var(--accent-fill-rgb), 0.08);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  margin: 0 0 var(--space-md);
}

.reset-success-banner {
  margin-bottom: var(--space-md);
}

.reset-url-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.6rem;
  margin-bottom: var(--space-xs, 0.5rem);
}

.reset-url-box code {
  flex: 1;
  font-size: 0.78rem;
  color: var(--color-text);
  word-break: break-all;
  user-select: all;
}

.reset-url-box .btn {
  flex-shrink: 0;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.reset-beta-note {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0.4rem 0 0;
}

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

.password-input-wrap input {
  padding-right: 3.5rem;
}

.password-toggle {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-primary);
  padding: 0.2rem;
}

.password-toggle:hover {
  text-decoration: underline;
}

/* Loading spinner shown on submit buttons while an API call is in flight */
.btn--loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(17, 17, 17, 0.25);
  border-top-color: var(--accent-on);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.btn--secondary.btn--loading::after {
  border-color: var(--border);
  border-top-color: var(--text-primary);
}

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

/* ── Button Variants ──────────────────────────────────────────────────────── */

.btn--primary {
  background: var(--accent-fill);
  color: var(--accent-on);
  border-color: var(--accent-fill);
}

.btn--primary:hover {
  background: var(--accent-hover);
  opacity: 1;
}

.btn--secondary {
  background: transparent;
  color: var(--text-heading);
  border: 1px solid var(--border-input);
}

.btn--secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-fill);
  color: var(--accent-primary);
}

.btn--full {
  width: 100%;
}

/* ── Profile Welcome ──────────────────────────────────────────────────────── */

.profile-welcome {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.profile-beta-feedback-slot { margin-top: var(--space-sm); }

.profile-welcome h2 {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 400;
  color: var(--color-text);
}

/* ── Profile Card ─────────────────────────────────────────────────────────── */

.profile-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-lg);
  max-width: 640px;
  margin-inline: auto;
}

.profile-card-heading {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

/* ── Profile Info Table ───────────────────────────────────────────────────── */

.profile-info {
  display: grid;
  gap: 0;
}

.profile-info-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--space-sm);
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  align-items: baseline;
}

.profile-info-row:last-child {
  border-bottom: none;
}

.profile-info dt {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.profile-info dd {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-text);
}

/* ── Camera Bag ───────────────────────────────────────────────────────────── */

.camera-bag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.camera-bag-header .profile-card-heading {
  margin-bottom: 0;
}

.camera-bag-list {
  list-style: none;
}

.gear-group-header {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  padding: 0.75rem 0 0.4rem 0;
  margin-top: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.gear-group-header:first-child {
  margin-top: 0;
}

.camera-bag-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.6rem 0 0.6rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-text);
}

.camera-bag-item:last-child {
  border-bottom: none;
}

.gear-label {
  font-size: 0.7rem;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.camera-bag-item-name {
  flex: 1;
}

.camera-bag-empty {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding: var(--space-md) 0;
  text-align: center;
}


/* ── Upload Stats ─────────────────────────────────────────────────────────── */

.profile-stats-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

/* ── Profile Actions ──────────────────────────────────────────────────────── */

.profile-actions {
  display: flex;
  justify-content: center;
  max-width: 640px;
  margin-inline: auto;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

/* ── Beta Tester Section ──────────────────────────────────────────────────── */

#beta-tester-section {
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
}

#beta-tester-section .btn {
  display: block;
  margin: 0 auto;
}

.profile-actions .btn {
  display: block;
  margin: 0 auto;
}

/* ── Photography Profile Form ─────────────────────────────────────────────── */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.pp-save-message {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.pp-save-message--success {
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid var(--color-success);
}

.pp-save-message--error {
  color: var(--color-danger);
  background: rgba(193, 58, 37, 0.06);
  border: 1px solid var(--color-error);
}

/* ── Admin testing controls ───────────────────────────────────────────────── */

.profile-card-subtitle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}

#profile-admin-controls select {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

#admin-apply-toggles {
  margin-top: var(--space-md);
}

.profile-status-message {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  margin-top: var(--space-sm);
  color: var(--color-text-muted);
}

.profile-status-message--success {
  color: var(--color-success);
}

.profile-status-message--error {
  color: var(--color-danger);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .auth-card {
    padding: var(--space-lg);
    margin: var(--space-md) auto;
  }

  .profile-card {
    padding: var(--space-md);
  }

  .profile-info-row {
    grid-template-columns: 110px 1fr;
  }

  .camera-bag-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .reset-url-box {
    flex-direction: column;
    align-items: stretch;
  }

  .reset-url-box .btn {
    width: 100%;
  }
}

/* ── Dark Mode — hardcoded light alert surfaces ─────────────────────────── */
[data-theme="dark"] .auth-error,
[data-theme="dark"] .pp-save-message--error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--color-error);
}

[data-theme="dark"] .auth-error--reset {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.30);
  color: var(--color-error);
}

[data-theme="dark"] .btn--secondary:hover {
  background: var(--bg-secondary);
}

.camera-bag-autodetect-hint {
  margin: 8px 0 12px;
  padding: 8px 10px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-secondary);   /* 12px hint — --text-muted is 3.18:1, fails AA */
  background: var(--bg-subtle, #F9FAFB);
  border-radius: 4px;
}
[data-theme="dark"] .camera-bag-autodetect-hint {
  background: rgba(255, 255, 255, 0.04);
}

/* Base Time Zone: "Use this device's timezone" text action under the select */
.pp-inline-action {
  align-self: flex-start;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-primary);
  padding: 0.2rem 0;
}

.pp-inline-action:hover {
  text-decoration: underline;
}
