/* ───────────────────────────────────────────────────────────────────────
   Musicalia.io — Auth Modal Styles
   Used by auth-modal.js for the login/register <dialog>.
   Design tokens from theme.css / homepage inline CSS.
   ─────────────────────────────────────────────────────────────────────── */

/* Backdrop */
dialog#auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* Dialog box */
dialog#auth-dialog {
  max-width: 400px;
  width: calc(100% - 32px);
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--bg, #f8fafc);
  color: var(--text, #0f1724);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  font-family: "Quicksand", system-ui, sans-serif;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  overflow: hidden;
}

dialog#auth-dialog[open] {
  display: flex;
  flex-direction: column;
}

/* Close button */
.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted, #586279);
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  z-index: 1;
}
.auth-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Inner content */
.auth-body {
  padding: 28px 28px 24px;
}

/* Tab switcher */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--panel-border, rgba(0,0,0,0.08));
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted, #586279);
  transition: background 0.15s, color 0.15s;
}
.auth-tab[aria-selected="true"] {
  background: var(--btn-primary-bg, #1166c1);
  color: #fff;
}
.auth-tab:not([aria-selected="true"]):hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Form panels */
.auth-panel {
  display: none;
}
.auth-panel.active {
  display: block;
}

/* Form elements */
.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text, #0f1724);
}
.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-border, rgba(0,0,0,0.15));
  font-family: inherit;
  font-size: 14px;
  color: var(--text, #0f1724);
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--btn-primary-bg, #1166c1);
  box-shadow: 0 0 0 3px rgba(17, 102, 193, 0.15);
}
.auth-field input.error {
  border-color: #dc2626;
}

/* Error message */
.auth-error {
  display: none;
  color: #dc2626;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}
.auth-error.visible {
  display: block;
}

/* Success message */
.auth-success {
  display: none;
  color: #16a34a;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}
.auth-success.visible {
  display: block;
}

/* Primary submit button */
.auth-submit {
  width: 100%;
  padding: 11px 0;
  border-radius: 8px;
  border: 1px solid var(--btn-primary-border, #1e64af);
  background: var(--btn-primary-bg, #1166c1);
  color: var(--btn-primary-text, #fff);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.auth-submit:hover:not(:disabled) {
  background: var(--btn-primary-bg-hover, #0e56a8);
  transform: translateY(-1px);
}
.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted, #586279);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--panel-border, rgba(0,0,0,0.1));
}

/* Google Sign-In button wrapper */
.auth-google-wrap {
  display: flex;
  justify-content: center;
}

/* Forgot password link */
.auth-forgot {
  display: block;
  text-align: right;
  font-size: 13px;
  color: var(--btn-primary-bg, #1166c1);
  text-decoration: none;
  margin-top: -6px;
  margin-bottom: 14px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.auth-forgot:hover {
  text-decoration: underline;
}

/* Forgot-password sub-panel */
.auth-forgot-panel {
  display: none;
}
.auth-forgot-panel.active {
  display: block;
}
.auth-back {
  background: none;
  border: none;
  color: var(--btn-primary-bg, #1166c1);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.auth-back:hover {
  text-decoration: underline;
}

/* Spinner */
.auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ── User dropdown (when logged in) ────────────────────────────────── */
.auth-user-menu {
  position: relative;
  display: inline-flex;
}
.auth-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-border, rgba(0,0,0,0.08));
  background: transparent;
  color: var(--text, #0f1724);
  font-family: "Quicksand", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.auth-user-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
.auth-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--btn-primary-bg, #1166c1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.auth-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--panel-border, rgba(0,0,0,0.08));
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 2100;
  padding: 6px 0;
  font-family: "Quicksand", sans-serif;
}
.auth-user-dropdown.open {
  display: block;
}
.auth-user-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: var(--text, #0f1724);
  cursor: pointer;
  font-family: inherit;
}
.auth-user-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
.auth-user-dropdown-info {
  padding: 10px 16px 8px;
  font-size: 12px;
  color: var(--muted, #586279);
  border-bottom: 1px solid var(--panel-border, rgba(0,0,0,0.08));
}

/* ── Toast notification ────────────────────────────────────────────── */
.auth-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  border-radius: 10px;
  font-family: "Quicksand", sans-serif;
  font-size: 14px;
  font-weight: 600;
  z-index: 3000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.auth-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.auth-toast.success {
  background: #16a34a;
  color: #fff;
}
.auth-toast.error {
  background: #dc2626;
  color: #fff;
}
.auth-toast.info {
  background: #1166c1;
  color: #fff;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 440px) {
  dialog#auth-dialog {
    max-width: 100%;
    width: 100%;
    border-radius: 14px 14px 0 0;
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    max-height: 92vh;
    overflow-y: auto;
  }
  .auth-body {
    padding: 24px 20px 20px;
  }
}

/* ── TEMPORARY: email/password auth hidden until mail server is live ──
   To re-enable: remove this entire block.
   ─────────────────────────────────────────────────────────────────── */
.auth-tabs,
#auth-register-panel,
#auth-forgot-panel,
#auth-forgot-btn,
#auth-login-panel .auth-field,
#auth-login-panel .auth-submit,
#auth-login-panel .auth-divider {
  display: none !important;
}

/* Show a "Sign in" heading in place of the tabs */
#auth-login-panel::before {
  content: 'Sign in to Musicalia';
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text, #0f1724);
  text-align: center;
  margin-bottom: 20px;
}

#auth-login-panel .auth-google-wrap {
  margin-top: 0;
}
/* ── END TEMPORARY ─────────────────────────────────────────────────── */
