/* ==========================================================
   RtlStudio — Supabase Auth UI
   Prefix: .rtl-auth-*   (no conflicts with app.css)
   Theme: VS Code dark (#1e1e1e / #252526 / #007acc)
   ========================================================== */

/* ── Utility ─────────────────────────────────────────────── */
.rtl-auth-hidden { display: none !important; }

/* ── Nav: guest buttons (Log in / Sign up) ───────────────── */
.rtl-auth-nav-guest {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 10px;
}

.rtl-auth-btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: #cccccc;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 20px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.rtl-auth-btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}

.rtl-auth-btn-primary {
  background: #0e639c;
  border: 1px solid transparent;
  color: #ffffff;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 20px;
  transition: background 0.12s;
  white-space: nowrap;
}
.rtl-auth-btn-primary:hover { background: #1177bb; }
.rtl-auth-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Nav: user avatar + dropdown wrapper ─────────────────── */
.rtl-auth-nav-user {
  position: relative;
  display: flex;
  align-items: center;
  padding-right: 10px;
}

.rtl-auth-avatar-btn {
  background: none;
  border: none;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.12s;
}
.rtl-auth-avatar-btn:hover,
.rtl-auth-avatar-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 2px #007acc;
}

.rtl-auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #3c3c3c;
}

/* Avatar fallback (initials) — shown when src is empty */
.rtl-auth-avatar-fallback {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0e639c;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  pointer-events: none;
}

/* ── Dropdown menu ───────────────────────────────────────── */
.rtl-auth-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 8px;
  width: 220px;
  background: #252526;
  border: 1px solid #454545;
  border-radius: 5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 9000;
  overflow: hidden;
  animation: rtl-auth-dropdown-in 0.1s ease;
}
@keyframes rtl-auth-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rtl-auth-dropdown-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
}

.rtl-auth-dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #3c3c3c;
}

.rtl-auth-dropdown-info {
  overflow: hidden;
}

.rtl-auth-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: #cccccc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rtl-auth-dropdown-email {
  font-size: 11px;
  color: #858585;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.rtl-auth-dropdown-sep {
  height: 1px;
  background: #3c3c3c;
  margin: 2px 0;
}

.rtl-auth-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 7px 14px;
  font-size: 13px;
  color: #cccccc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: background 0.1s;
}
.rtl-auth-dropdown-item:hover { background: rgba(255,255,255,0.07); }

.rtl-auth-dropdown-item--danger { color: #f48771; }
.rtl-auth-dropdown-item--danger:hover { background: rgba(244,135,113,0.1); }

/* ── Modal overlay ───────────────────────────────────────── */
.rtl-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: rtl-auth-fade-in 0.15s ease;
}
@keyframes rtl-auth-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Login modal ─────────────────────────────────────────── */
.rtl-auth-modal {
  background: #252526;
  border: 1px solid #454545;
  border-radius: 8px;
  padding: 36px 32px 32px;
  width: 100%;
  max-width: 360px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: rtl-auth-modal-in 0.15s ease;
}
@keyframes rtl-auth-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.rtl-auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #858585;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.rtl-auth-modal-close:hover { color: #cccccc; background: rgba(255,255,255,0.07); }

.rtl-auth-modal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.rtl-auth-modal-brand-icon {
  width: 28px;
  height: 28px;
  background: #007acc;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rtl-auth-modal-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #cccccc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.01em;
}

.rtl-auth-modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 6px;
  line-height: 1.3;
}

.rtl-auth-modal-subtitle {
  font-size: 13px;
  color: #858585;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 24px;
  line-height: 1.5;
}

/* Google sign-in button */
.rtl-auth-btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: #ffffff;
  border: none;
  border-radius: 5px;
  color: #3c4043;
  font-size: 14px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.rtl-auth-btn-google:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.rtl-auth-btn-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.rtl-auth-btn-google svg {
  flex-shrink: 0;
}

.rtl-auth-modal-tos {
  font-size: 11px;
  color: #606060;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}

/* ── Profile modal ───────────────────────────────────────── */
.rtl-auth-profile-modal {
  max-width: 420px;
  padding: 0;
  overflow: hidden;
}

.rtl-auth-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid #3c3c3c;
}

.rtl-auth-profile-title {
  font-size: 15px;
  font-weight: 600;
  color: #cccccc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
}

.rtl-auth-profile-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Avatar section */
.rtl-auth-profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rtl-auth-profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: #3c3c3c;
  border: 2px solid #3c3c3c;
}

.rtl-auth-profile-avatar-note {
  font-size: 11px;
  color: #606060;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  text-align: center;
}

/* Field */
.rtl-auth-profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rtl-auth-profile-label {
  font-size: 12px;
  font-weight: 500;
  color: #cccccc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
}

.rtl-auth-profile-field-row {
  display: flex;
  gap: 8px;
}

.rtl-auth-profile-input {
  flex: 1;
  background: #3c3c3c;
  border: 1px solid #555555;
  border-radius: 3px;
  color: #cccccc;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.12s;
}
.rtl-auth-profile-input:focus { border-color: #007acc; }
.rtl-auth-profile-input::placeholder { color: #606060; }

.rtl-auth-profile-msg {
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 16px;
  transition: color 0.1s;
}
.rtl-auth-profile-msg--ok  { color: #4ec9b0; }
.rtl-auth-profile-msg--err { color: #f48771; }

/* Danger zone */
.rtl-auth-danger-zone {
  border: 1px solid #5a2323;
  border-radius: 4px;
  padding: 14px 16px;
  background: rgba(244,135,113,0.04);
}

.rtl-auth-danger-zone-title {
  font-size: 12px;
  font-weight: 600;
  color: #f48771;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rtl-auth-danger-zone-desc {
  font-size: 12px;
  color: #858585;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 12px;
  line-height: 1.5;
}

.rtl-auth-btn-danger {
  background: transparent;
  border: 1px solid #f48771;
  color: #f48771;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.rtl-auth-btn-danger:hover {
  background: #f48771;
  color: #1e1e1e;
}

/* ── Welcome modal (first login) ────────────────────────── */
.rtl-auth-welcome-modal {
  background: #252526;
  border: 1px solid #454545;
  border-radius: 10px;
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: rtl-auth-modal-in 0.2s ease;
}

.rtl-auth-welcome-icon {
  margin-bottom: 18px;
  line-height: 0;
}

.rtl-auth-welcome-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 12px;
}

.rtl-auth-welcome-msg {
  font-size: 13px;
  color: #9d9d9d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 26px;
  line-height: 1.7;
}

.rtl-auth-welcome-btn {
  background: #007acc;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 9px 32px;
  cursor: pointer;
  transition: background 0.12s;
}
.rtl-auth-welcome-btn:hover { background: #1177bb; }

/* ── Delete confirm modal ────────────────────────────────── */
.rtl-auth-confirm-modal {
  background: #252526;
  border: 1px solid #5a2323;
  border-radius: 8px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  animation: rtl-auth-modal-in 0.15s ease;
}

.rtl-auth-confirm-icon {
  margin-bottom: 14px;
  line-height: 0;
}

.rtl-auth-confirm-title {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 10px;
}

.rtl-auth-confirm-desc {
  font-size: 13px;
  color: #858585;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 0 24px;
  line-height: 1.6;
}

.rtl-auth-confirm-desc strong {
  color: #cccccc;
}

.rtl-auth-confirm-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.rtl-auth-confirm-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.rtl-auth-confirm-btn--cancel {
  background: transparent;
  border: 1px solid #555555;
  color: #cccccc;
}
.rtl-auth-confirm-btn--cancel:hover {
  background: rgba(255,255,255,0.07);
  border-color: #777;
}

.rtl-auth-confirm-btn--delete {
  background: #c72e2e;
  border: 1px solid #c72e2e;
  color: #ffffff;
}
.rtl-auth-confirm-btn--delete:hover {
  background: #d94040;
  border-color: #d94040;
}
.rtl-auth-confirm-btn--delete:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Toast notification ──────────────────────────────────── */
.rtl-auth-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e1e1e;
  border: 1px solid #454545;
  border-radius: 4px;
  color: #cccccc;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 8px 16px;
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.rtl-auth-toast.rtl-auth-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.rtl-auth-toast--ok  { border-color: #4ec9b0; color: #4ec9b0; }
.rtl-auth-toast--err { border-color: #f48771; color: #f48771; }
