/* ==========================================================================
   OLPNA — shadcn/ui Authentication & Account Design System
   Modern SaaS Aesthetic, Accessible Tokens, Micro-Interactions & Responsive Layouts
   ========================================================================== */

:root {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;

  --card: 222.2 84% 6.5%;
  --card-foreground: 210 40% 98%;

  --popover: 222.2 84% 6.5%;
  --popover-foreground: 210 40% 98%;

  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;

  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;

  --muted: 217.2 32.6% 14.5%;
  --muted-foreground: 215 20.2% 65.1%;

  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;

  --destructive: 0 62.8% 50%;
  --destructive-foreground: 210 40% 98%;

  --success: 142.1 76.2% 43.1%;
  --success-foreground: 355.7 100% 97.3%;

  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 224.3 76.3% 48%;

  --radius: 0.625rem;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Base resets for auth pages */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.auth-body {
  font-family: var(--font-sans);
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  background-image: 
    radial-gradient(at 0% 0%, hsla(217.2, 91.2%, 59.8%, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(222.2, 84%, 15%, 0.5) 0px, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================================
   Desktop Titlebar (Frameless Drag Region & Window Controls)
   ========================================================================== */
.desktop-titlebar {
  height: 34px;
  min-height: 34px;
  background-color: #0b1120;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0 0 0 0.85rem;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-app-region: drag;
}

.titlebar-drag-region {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-app-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.titlebar-logo-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.titlebar-title {
  color: #f1f5f9;
  font-weight: 700;
}

.titlebar-sep {
  color: #475569;
  font-size: 0.6rem;
}

.titlebar-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  font-weight: 600;
}

.titlebar-comp {
  color: #94a3b8;
  font-weight: 500;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-controls {
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
}

.titlebar-btn {
  width: 46px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #94a3b8;
  border: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.titlebar-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.titlebar-btn.btn-close:hover {
  background-color: #e11d48;
  color: #ffffff;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(148, 163, 184, 0.5);
}

/* Centered Auth Card Container */
.auth-wrapper {
  width: 100%;
  max-width: 440px;
  margin: auto;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header & Brand */
.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-bottom: 0.85rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-brand:hover {
  transform: scale(1.03);
}

.auth-brand-img {
  width: auto;
  max-width: 170px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
  margin-bottom: 0.375rem;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
}

/* shadcn/ui Card Component */
.shadcn-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

/* Form Groups & Controls */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  position: relative;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label .label-link {
  font-size: 0.8125rem;
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s ease;
}

.form-label .label-link:hover {
  text-decoration: underline;
  color: #60a5fa;
}

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

.shadcn-input {
  width: 100%;
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.shadcn-input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsla(var(--ring), 0.25);
}

.shadcn-input.input-error {
  border-color: hsl(var(--destructive));
}

.shadcn-input.input-error:focus {
  box-shadow: 0 0 0 2px hsla(var(--destructive), 0.25);
}

.input-icon-btn {
  position: absolute;
  right: 0.625rem;
  background: none;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.input-icon-btn:hover {
  color: hsl(var(--foreground));
}

/* Validation Feedback */
.field-error {
  font-size: 0.8125rem;
  color: hsl(var(--destructive));
  display: none;
  margin-top: 0.125rem;
}

.field-error.visible {
  display: block;
}

/* Alert Boxes */
.shadcn-alert {
  padding: 0.875rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  line-height: 1.4;
  display: none;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.shadcn-alert.visible {
  display: flex;
}

.shadcn-alert-destructive {
  background-color: hsla(var(--destructive), 0.15);
  border: 1px solid hsla(var(--destructive), 0.4);
  color: #fca5a5;
}

.shadcn-alert-success {
  background-color: hsla(var(--success), 0.15);
  border: 1px solid hsla(var(--success), 0.4);
  color: #86efac;
}

/* Password Strength Indicator */
.password-meter {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

.meter-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  height: 4px;
}

.meter-bar {
  background-color: hsl(var(--muted));
  border-radius: 2px;
  transition: background-color 0.25s ease;
}

.meter-bar.active-weak {
  background-color: #ef4444;
}

.meter-bar.active-fair {
  background-color: #f59e0b;
}

.meter-bar.active-good {
  background-color: #3b82f6;
}

.meter-bar.active-strong {
  background-color: #10b981;
}

.meter-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  justify-content: space-between;
}

/* Checkbox control */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shadcn-checkbox {
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  border: 1px solid hsl(var(--input));
  accent-color: hsl(var(--primary));
  cursor: pointer;
}

.checkbox-label {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  user-select: none;
}

/* Buttons */
.shadcn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0 1rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
}

.shadcn-btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 2px 8px hsla(var(--primary), 0.35);
}

.shadcn-btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
  color: white;
}

.shadcn-btn-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}

.shadcn-btn-secondary:hover:not(:disabled) {
  background-color: hsl(var(--muted));
}

.shadcn-btn-outline {
  background-color: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.shadcn-btn-outline:hover:not(:disabled) {
  background-color: hsl(var(--accent));
}

.shadcn-btn-destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.shadcn-btn-destructive:hover:not(:disabled) {
  background-color: #dc2626;
}

.shadcn-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

/* Spinner Icon */
.btn-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-spinner.visible {
  display: inline-block;
}

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

/* Footer / Switch links */
.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.auth-footer a {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 500;
  margin-left: 0.25rem;
}

.auth-footer a:hover {
  text-decoration: underline;
  color: #60a5fa;
}

/* ==========================================================================
   ACCOUNT & PROFILE PAGE STYLES
   ========================================================================== */

.account-layout {
  width: 100%;
  max-width: 880px;
  margin: 2rem auto;
  animation: fadeIn 0.3s ease-out;
}

.account-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.account-user-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)), #8b5cf6);
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.user-meta-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.user-display-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.user-display-email {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  font-family: var(--font-mono);
}

.user-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.shadcn-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-primary {
  background-color: hsla(var(--primary), 0.2);
  color: #93c5fd;
  border: 1px solid hsla(var(--primary), 0.4);
}

.badge-success {
  background-color: hsla(var(--success), 0.2);
  color: #86efac;
  border: 1px solid hsla(var(--success), 0.4);
}

/* Tabs Navigation */
.shadcn-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 1.5rem;
}

.tab-trigger {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-trigger:hover {
  color: hsl(var(--foreground));
}

.tab-trigger.active {
  color: hsl(var(--primary));
  border-bottom-color: hsl(var(--primary));
  font-weight: 600;
}

.tab-content {
  display: none;
}

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

/* Grid for form rows */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .account-user-card {
    flex-direction: column;
    text-align: center;
  }
  .user-badges {
    justify-content: center;
  }
}

/* Toast Notifications Container */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.shadcn-toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success {
  border-color: hsla(var(--success), 0.5);
}

.toast-destructive {
  border-color: hsla(var(--destructive), 0.5);
}

/* ==========================================================================
   OAuth Social Buttons & Modern Auth Tabs / Dividers
   ========================================================================== */
.oauth-btn {
  width: 100%;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border-radius: calc(var(--radius) - 2px);
  background-color: hsl(var(--card));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.oauth-btn:hover:not(:disabled) {
  background-color: hsl(var(--accent));
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.oauth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.oauth-btn .google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.auth-divider span {
  padding: 0 0.75rem;
}

/* Tabs switcher: Password vs Email OTP */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  background-color: hsl(var(--muted));
  padding: 0.25rem;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 1.25rem;
  border: 1px solid hsl(var(--border));
}

.auth-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.auth-tab:hover:not(.active) {
  color: hsl(var(--foreground));
}

.auth-tab.active {
  background-color: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

.auth-tab svg {
  flex-shrink: 0;
}

