/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-color: #edf2f9;
  --card-bg: #ffffff;
  --text-primary: #1e293b; /* slate-800 */
  --text-secondary: #64748b; /* slate-500 */
  --border-color: #e2e8f0; /* slate-200 */
  
  /* Primary Action Colors */
  --color-blue: #3ab7ff; /* Sky blue matching image */
  --color-blue-hover: #22a7f5;
  
  /* Tooltip colors */
  --tooltip-bg: #2c3540; /* Dark slate-gray matching image */
  --color-success: #10b981; /* Emerald green */
  --color-error: #ef4444; /* Rose red */
  
  --transition-fast: all 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 75% 20%, #f3eafd 0%, #ebf2fd 60%, #e2eafc 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Beautiful curved background lines matching the reference design */
body::before {
  content: "";
  position: absolute;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  background-image: 
    radial-gradient(circle at 50% 120%, transparent 55%, rgba(124, 58, 237, 0.03) 56%, rgba(124, 58, 237, 0.03) 57%, transparent 58%),
    radial-gradient(circle at 50% 120%, transparent 63%, rgba(59, 186, 254, 0.04) 64%, rgba(59, 186, 254, 0.04) 65%, transparent 66%);
  z-index: -1;
  pointer-events: none;
}

/* Layout Wrappers */
.page-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.card-container {
  position: relative;
  width: 100%;
  max-width: 440px;
}

/* The Password Reset Card */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 48px 40px 40px 40px;
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 20px 40px -4px rgba(0, 0, 0, 0.05),
    0 1px 3px rgba(0, 0, 0, 0.01);
  position: relative;
  width: 100%;
  transition: var(--transition-fast);
  animation: card-slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes card-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Top Right Close Button */
.close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  outline: none;
}

.close-btn:hover {
  color: #94a3b8;
  background-color: #f8fafc;
}

.close-btn svg {
  width: 18px;
  height: 18px;
}

/* Logo and Titles */
.logo-area {
  text-align: center;
  margin-bottom: 16px;
}

.logo-emoji {
  font-size: 32px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

h1 {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
}

/* Inputs and Form Layout */
.form-group {
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-container {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  transition: var(--transition-fast);
}

.input-container:focus-within {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 4px rgba(59, 183, 255, 0.15);
}

.input-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  background-color: #f8fafc;
  border-right: 1px solid var(--border-color);
  color: #cbd5e1;
  border-radius: 8px 0 0 8px;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.input-container:focus-within .input-prefix {
  color: var(--color-blue);
  border-right-color: var(--color-blue);
}

.input-field {
  border: none;
  background: transparent;
  padding: 12px 16px;
  width: 100%;
  outline: none;
  font-size: 14px;
  color: #334155;
  font-family: inherit;
}

/* Save Submit Button */
.btn-submit {
  width: 100%;
  padding: 14px;
  background-color: var(--color-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.btn-submit:hover:not(:disabled) {
  background-color: var(--color-blue-hover);
}

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

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.btn-submit.loading .btn-spinner {
  display: block;
}
.btn-submit.loading .btn-text {
  display: none;
}

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

/* Dynamic Screens */
.state-container {
  display: none;
}

.state-container.active {
  display: block;
}

/* Spinner for state-loading */
.loading-wrapper {
  text-align: center;
  padding: 20px 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #f1f5f9;
  border-top-color: var(--color-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-bottom: 12px;
}

.loading-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Success & Error screens */
.status-screen {
  text-align: center;
  padding: 10px 0;
}

.status-icon-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-bottom: 16px;
}

.status-icon-container.success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.status-icon-container.error {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.status-icon-container svg {
  width: 24px;
  height: 24px;
}

.status-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.status-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background-color: #f1f5f9;
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-fast);
}

.btn-action:hover {
  background-color: #e2e8f0;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  max-width: 340px;
  transform: translateX(100%);
  opacity: 0;
  animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: var(--transition-fast);
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-error); }

@keyframes slide-in {
  to { transform: translateX(0); opacity: 1; }
}

.toast-close {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  margin-left: auto;
}

.toast-close:hover {
  color: #94a3b8;
}

/* Floating Tooltip - Matching Reference Image */
.tooltip-box {
  position: absolute;
  left: -296px; /* Positioned to the left of the card */
  top: 140px; /* Aligned with the 'New Password' field */
  width: 270px;
  background-color: var(--tooltip-bg);
  border-radius: 6px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateX(15px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

/* Tooltip visible state */
.tooltip-box.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Right-facing Arrow pointing to New Password input */
.tooltip-arrow {
  content: '';
  position: absolute;
  right: -5px;
  top: 25px; /* Aligned vertically near top for better field integration */
  width: 10px;
  height: 10px;
  background-color: var(--tooltip-bg);
  transform: rotate(45deg);
}

.tooltip-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  margin-top: 12px;
  margin-bottom: 8px;
}

.tooltip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #94a3b8; /* Faded blue-gray */
  margin-bottom: 8px;
  transition: var(--transition-fast);
}

.tooltip-item:last-child {
  margin-bottom: 0;
}

/* Status circle indicators */
.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #475569; /* Default grey dot */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.status-dot svg {
  width: 8px;
  height: 8px;
  color: #ffffff;
  display: none;
}

/* Requirement states (unmet length error, matched item success) */
.tooltip-item.status-error .status-dot {
  background-color: var(--color-error);
}

.tooltip-item.status-error .status-dot .icon-cross {
  display: block;
}

.tooltip-item.status-success {
  color: #ffffff;
}

.tooltip-item.status-success .status-dot {
  background-color: var(--color-success);
}

.tooltip-item.status-success .status-dot .icon-check {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .card-container {
    max-width: 400px;
  }
  
  .tooltip-box {
    position: static;
    width: 100%;
    margin-bottom: 16px;
    transform: none;
    box-shadow: none;
  }
  
  .tooltip-box.visible {
    display: block;
  }
  
  .tooltip-arrow {
    display: none; /* Hide arrow on mobile when stacked */
  }
  
  .card-container {
    display: flex;
    flex-direction: column-reverse; /* Tooltip displays above the card if visible */
  }
}

@media (max-width: 480px) {
  .card {
    padding: 36px 24px;
  }
}
