/**
 * Auth UI Styles
 * Styling for authentication forms, account view, and usage progress bars
 */

/* Auth Container - Wrapper for login/signup/account views */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Auth Card - Main form container */
.auth-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 10px 40px -10px rgba(99, 102, 241, 0.1);
}

.auth-card h2 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #f1f5f9;
  text-align: center;
}

.auth-card .subtitle {
  color: #94a3b8;
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

/* Auth Form - Login/Signup forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-form input {
  padding: 12px 14px;
  font-size: 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #f1f5f9;
  transition: all 0.2s ease;
}

.auth-form input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-form input::placeholder {
  color: #64748b;
}

/* Primary auth button */
.auth-btn {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.auth-btn:active:not(:disabled) {
  transform: translateY(0);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Auth link - Switch between login/signup */
.auth-link-container {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.auth-link-container span {
  color: #94a3b8;
  font-size: 0.9rem;
}

.auth-link {
  color: #6366f1;
  cursor: pointer;
  font-weight: 500;
  margin-left: 4px;
  transition: color 0.2s ease;
}

.auth-link:hover {
  color: #818cf8;
  text-decoration: underline;
}

/* Auth Error Message */
.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 12px;
  color: #fca5a5;
  font-size: 0.9rem;
  text-align: center;
  animation: shake 0.4s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

/* Account View Styles */
.account-container {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 16px;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.account-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #f1f5f9;
}

.account-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.account-back-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #f1f5f9;
}

/* User Info Card */
.user-info-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.user-info-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
}

.user-details h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #f1f5f9;
}

.user-details p {
  margin: 4px 0 0 0;
  font-size: 0.85rem;
  color: #64748b;
}

/* Usage Section */
.usage-section {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.usage-section h3 {
  margin: 0 0 16px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.usage-section h3 svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

/* Usage Progress Bar */
.usage-item {
  margin-bottom: 16px;
}

.usage-item:last-child {
  margin-bottom: 0;
}

.usage-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.usage-label span:first-child {
  font-size: 0.9rem;
  color: #94a3b8;
}

.usage-label span:last-child {
  font-size: 0.8rem;
  font-weight: 500;
  color: #f1f5f9;
}

.progress-bar {
  height: 8px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background-color 0.3s ease;
  position: relative;
}

/* Progress bar color states based on percentage */
.progress-fill.low {
  background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
}

.progress-fill.medium {
  background: linear-gradient(90deg, #eab308 0%, #facc15 100%);
}

.progress-fill.high {
  background: linear-gradient(90deg, #f97316 0%, #fb923c 100%);
}

.progress-fill.critical {
  background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Logout Button */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.logout-btn svg {
  width: 18px;
  height: 18px;
}

/* Loading spinner for auth forms */
.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-loading .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Token limit warning */
.limit-warning {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.limit-warning svg {
  width: 20px;
  height: 20px;
  color: #fbbf24;
  flex-shrink: 0;
}

.limit-warning p {
  margin: 0;
  font-size: 0.85rem;
  color: #fcd34d;
}

/* ============================================
   GOOGLE AUTHENTICATION STYLES
   ============================================ */

/* Google Sign-In Button Container */
.google-signin-container {
  margin: 8px 0;
  display: flex;
  justify-content: center;
}

/* Google's rendered button will fill this container */
#google-signin-button,
#google-signup-button {
  width: 100%;
}

/* Fallback button when Google script isn't loaded */
.google-signin-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.google-signin-fallback:hover {
  background: #334155;
  border-color: rgba(148, 163, 184, 0.3);
}

.google-signin-fallback svg {
  flex-shrink: 0;
}

/* Divider between Google and email auth */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: #64748b;
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.2);
}

.auth-divider span {
  padding: 0 12px;
}