/* ==========================================================================
   Supabase Authentication UI & Modal Styles - My Engineering Toolbox™
   ========================================================================== */

/* Auth Modal Overlay */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 29, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.25rem;
  box-sizing: border-box;
}

.auth-modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* Modal Card */
.auth-modal-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f3f4f6;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.auth-modal-overlay.active .auth-modal-card {
  transform: scale(1);
}

/* Header */
.auth-modal-header {
  padding: 1.5rem 1.75rem 1rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.auth-brand-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f9fafb;
  line-height: 1.2;
}

.auth-brand-sub {
  font-size: 0.72rem;
  color: #9ca3af;
}

.auth-modal-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.4rem;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.auth-modal-close:hover {
  color: #f9fafb;
  background: rgba(255, 255, 255, 0.08);
}

/* Gating Banner Notice */
.auth-banner-notice {
  background: rgba(37, 99, 235, 0.12);
  border-bottom: 1px solid rgba(37, 99, 235, 0.25);
  padding: 0.75rem 1.75rem;
  font-size: 0.82rem;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.4;
}

/* Tab Switcher */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 1.75rem;
  gap: 1.5rem;
}

.auth-tab-btn {
  background: none;
  border: none;
  padding: 0.85rem 0;
  color: #9ca3af;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.auth-tab-btn:hover {
  color: #f3f4f6;
}

.auth-tab-btn.active {
  color: #3b82f6;
}

.auth-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #3b82f6;
  border-radius: 2px;
}

/* Form Container */
.auth-modal-body {
  padding: 1.5rem 1.75rem 1.75rem 1.75rem;
}

.auth-form-group {
  margin-bottom: 1.15rem;
}

.auth-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d1d5db;
  margin-bottom: 0.4rem;
}

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

.auth-input-wrap i {
  position: absolute;
  left: 0.9rem;
  color: #6b7280;
  font-size: 0.85rem;
}

.auth-input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.4rem;
  background: #0b1329;
  border: 1px solid #1f2937;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Submit Button */
.btn-auth-submit {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-auth-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

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

/* Sub-actions */
.auth-sub-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.8rem;
}

.auth-sub-actions a {
  color: #60a5fa;
  text-decoration: none;
  cursor: pointer;
}

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

/* Messages */
.auth-msg {
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.45rem;
}

.auth-msg.error {
  display: flex;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.auth-msg.success {
  display: flex;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Header User Widget */
.auth-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #f3f4f6;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.auth-header-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.auth-user-dropdown {
  position: relative;
  display: inline-block;
}

.auth-user-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 10px;
  width: 220px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
  display: none;
  z-index: 1000;
  padding: 0.5rem 0;
}

.auth-user-dropdown.open .auth-user-menu {
  display: block;
}

.auth-menu-header {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-menu-email {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f9fafb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu-tier {
  font-size: 0.7rem;
  color: #10b981;
  font-weight: 600;
  margin-top: 0.15rem;
  display: inline-block;
}

.auth-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  color: #d1d5db;
  font-size: 0.82rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.auth-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f9fafb;
}

.auth-menu-item.upgrade {
  color: #fbbf24;
  font-weight: 600;
}

.auth-menu-item.signout {
  color: #f87171;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0.25rem;
  padding-top: 0.65rem;
}
