/* Login Page - Dark Theme Matching Landing Page */

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #18181b;
  --bg-elevated: #1f1f23;
  --bg-hover: #27272a;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);

  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.5);

  --gradient-start: #8b5cf6;
  --gradient-end: #ec4899;
}

html {
  height: 100%;
  background-color: #09090b;
}

body {
  height: 100%;
  background-color: #09090b;
}

/* Dark background with gradient */
.bg-pattern {
  background: linear-gradient(180deg, #18181b 0%, #09090b 100%) !important;
  background-color: #09090b !important;
  background-attachment: fixed !important;
  position: relative;
}

.bg-pattern::before {
  content: '';
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 1200px;
  height: 800px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(139, 92, 246, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 30% 40%, rgba(236, 72, 153, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(59, 130, 246, 0.12) 0%, transparent 50%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

/* Grid pattern overlay - matches landing page */
.bg-pattern::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.bg-primary-dark-op {
  background: transparent !important;
}

/* Center the card properly */
.hero-static {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Back to home link - outside card */
.auth-back-link {
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-back-link a {
  color: var(--text-secondary) !important;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-back-link a:hover {
  color: var(--text-primary) !important;
}

/* Language selector */
.auth-lang-selector {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
}

.auth-card-header {
  position: static;
}

.auth-lang-selector details {
  position: relative;
}

.auth-lang-selector summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.auth-lang-selector summary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.auth-lang-selector summary::-webkit-details-marker {
  display: none;
}

.auth-lang-selector summary img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.auth-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  min-width: 140px;
  padding: 6px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 100;
}

.auth-lang-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary) !important;
  transition: all 0.15s ease;
}

.auth-lang-menu a:hover {
  background: var(--bg-hover);
  color: var(--text-primary) !important;
}

.auth-lang-menu a img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

/* Card header with logo */
.auth-card-header {
  position: relative;
  padding-top: 0.5rem;
}

.text-white {
  color: var(--text-secondary) !important;
  transition: color 0.2s ease;
}

.text-white:hover {
  color: var(--text-primary) !important;
}

/* Login card - dark solid style */
.login-card {
  border-radius: 24px;
  border: 1px solid var(--border-default) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  background: #111113 !important;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.login-card .block-content {
  background: #111113 !important;
  border-radius: 24px;
  padding: 2rem !important;
  padding-top: 1rem !important;
  position: relative;
}

/* Brand wordmark */
.brand-wordmark--light {
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  display: inline-flex;
  letter-spacing: -0.02em;
}

.brand-wordmark--light span {
  display: inline;
}

.brand-gradient {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.brand-neutral {
  color: #fafafa !important;
  -webkit-text-fill-color: #fafafa !important;
}

/* Sign in text */
.text-muted {
  color: var(--text-secondary) !important;
}

.text-uppercase.fw-bold {
  letter-spacing: 0.1em;
}

/* Form inputs - dark style */
.login-form .input-group {
  display: flex;
}

.login-form .form-control {
  border: 1px solid var(--border-default);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  box-shadow: none;
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  height: 48px;
  font-size: 0.9375rem;
  padding-left: 1rem;
  transition: all 0.2s ease;
}

.login-form .form-control::placeholder {
  color: var(--text-tertiary) !important;
}

.login-form .form-control:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
  background-color: var(--bg-tertiary) !important;
}

.login-form .input-group-text {
  border: 1px solid var(--border-default);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background-color: var(--bg-tertiary) !important;
  color: var(--text-tertiary) !important;
  padding: 0 1rem;
  display: flex;
  align-items: center;
}

/* Checkbox */
.form-check-input {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-default) !important;
}

.form-check-input:checked {
  background-color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}

.form-check-label {
  color: var(--text-secondary) !important;
}

/* Links */
.login-card a:not(.brand-wordmark) {
  color: var(--accent-secondary) !important;
  transition: color 0.2s ease;
}

.login-card a:not(.brand-wordmark):hover {
  color: var(--accent-primary) !important;
}

/* Alert */
.login-card .alert {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1) !important;
  color: #f87171 !important;
}

.login-card .alert-warning {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1) !important;
  color: #fbbf24 !important;
}

/* Divider */
.login-divider {
  border: 0;
  border-top: 1px solid var(--border-default);
  margin: 1.5rem 0;
}

/* Primary Sign In button - gradient style */
.login-card .btn-hero.btn-primary {
  border-radius: 9999px;
  padding: 0.875rem 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  min-width: 180px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)) !important;
  border: none !important;
  box-shadow: 0 0 20px var(--accent-glow);
  transition: all 0.2s ease;
  color: #fff !important;
}

.login-card .btn-hero.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
  color: #fff !important;
}

/* Sign Up button - secondary style */
.login-card .btn-success {
  background-color: var(--bg-tertiary) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  min-height: 44px;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: none;
}

.login-card .btn-success:hover {
  background-color: var(--bg-hover) !important;
  border-color: var(--border-strong) !important;
  transform: translateY(-2px);
}

/* Google button - dark style */
.gsi-material-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  width: 100%;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.gsi-material-button:hover {
  transform: translateY(-2px);
  background-color: var(--bg-hover) !important;
  border-color: var(--border-strong);
}

.gsi-material-button-state {
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.gsi-material-button-content-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 1;
}

.gsi-material-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gsi-material-button-contents {
  text-transform: none;
  color: var(--text-primary) !important;
}

.google-logo {
  width: 20px;
  height: 20px;
}

/* GitHub button - dark style */
.login-card a.btn-alt-secondary,
.login-card a.btn-alt-secondary:hover,
.login-card a.btn-alt-secondary:focus {
  background-color: var(--bg-tertiary) !important;
  border: 1px solid var(--border-default) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  min-height: 44px;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: none;
  text-decoration: none;
}

.login-card a.btn-alt-secondary:hover {
  background-color: var(--bg-hover) !important;
  border-color: var(--border-strong) !important;
  transform: translateY(-2px);
}

/* Register view styles */
#register-view .form-label {
  color: var(--text-primary) !important;
  font-weight: 500;
  font-size: 0.875rem;
}

#register-view .form-control {
  background-color: var(--bg-tertiary) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 12px !important;
  color: var(--text-primary) !important;
  height: 44px;
}

#register-view .form-control:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
}

#register-view .form-text {
  color: var(--text-tertiary) !important;
}

#register-view .btn-primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)) !important;
  border: none !important;
  border-radius: 12px;
  box-shadow: 0 0 20px var(--accent-glow);
}

#register-view .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

#register-view .btn-alt-secondary {
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  border: none;
}

#register-view .btn-alt-secondary:hover {
  color: var(--text-primary) !important;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 0;
  right: 0;
  padding: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  pointer-events: none;
}

.invoice-toast {
  min-width: 320px;
  max-width: 420px;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: 0 25px 45px rgba(15,23,42,0.25), 0 0 0 1px rgba(255,255,255,0.04);
  transform: translateX(28px);
  opacity: 0;
  pointer-events: auto;
  transition: transform 0.35s cubic-bezier(0.21, 0.61, 0.35, 1), opacity 0.35s ease, filter 0.35s ease;
}

.invoice-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.invoice-toast.is-hiding {
  opacity: 0;
  transform: translateX(32px);
  filter: blur(0.5px);
}

.invoice-toast__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.invoice-toast__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.invoice-toast__title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.invoice-toast__message {
  font-weight: 500;
  white-space: pre-line;
  line-height: 1.45;
}

.invoice-toast__close {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.65);
  font-size: 1rem;
  line-height: 1;
  margin-top: 0.15rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.invoice-toast__close:hover,
.invoice-toast__close:focus {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.invoice-toast--success {
  background: linear-gradient(135deg, rgba(20,83,45,0.94), rgba(34,197,94,0.92));
  box-shadow: 0 25px 55px rgba(34,197,94,0.32), 0 0 0 1px rgba(255,255,255,0.08);
}

.invoice-toast--success .invoice-toast__icon {
  background: rgba(15,118,110,0.4);
}

.invoice-toast--error {
  background: linear-gradient(135deg, rgba(127,29,29,0.94), rgba(220,38,38,0.9));
  box-shadow: 0 25px 55px rgba(248,113,113,0.34), 0 0 0 1px rgba(255,255,255,0.08);
}

.invoice-toast--error .invoice-toast__icon {
  background: rgba(185,28,28,0.4);
}

.invoice-toast--warning {
  background: linear-gradient(135deg, rgba(120,53,15,0.95), rgba(245,158,11,0.92));
  box-shadow: 0 25px 55px rgba(245,158,11,0.34), 0 0 0 1px rgba(255,255,255,0.08);
}

.invoice-toast--warning .invoice-toast__icon {
  background: rgba(217,119,6,0.4);
}

.invoice-toast--info {
  background: linear-gradient(135deg, rgba(30,64,175,0.94), rgba(14,165,233,0.92));
  box-shadow: 0 25px 55px rgba(59,130,246,0.32), 0 0 0 1px rgba(255,255,255,0.08);
}

.invoice-toast--info .invoice-toast__icon {
  background: rgba(37,99,235,0.4);
}

@media (prefers-reduced-motion: reduce) {
  .invoice-toast {
    transition: none;
    transform: none;
    opacity: 1;
  }

  .invoice-toast.is-hiding {
    opacity: 0;
    transform: none;
  }
}

/* Setup form - dark theme */
#setup-form .form-control {
  border: 1px solid var(--border-default);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  box-shadow: none;
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  height: 48px;
  font-size: 0.9375rem;
  padding-left: 1rem;
  transition: all 0.2s ease;
}

#setup-form .form-control::placeholder {
  color: var(--text-tertiary) !important;
}

#setup-form .form-control:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
  background-color: var(--bg-tertiary) !important;
}

#setup-form .input-group-text {
  border: 1px solid var(--border-default);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background-color: var(--bg-tertiary) !important;
  color: var(--text-tertiary) !important;
  padding: 0 1rem;
  display: flex;
  align-items: center;
}

#setup-form .form-label {
  color: var(--text-secondary) !important;
}

#setup-form .form-text {
  color: var(--text-tertiary) !important;
}

/* Responsive */
@media (max-width: 767px) {
  .hero-static {
    min-height: 100vh;
  }

  .login-card .block-content {
    padding: 1.5rem !important;
  }

  .invoice-toast {
    min-width: 280px;
    max-width: calc(100vw - 2rem);
  }
}
