/* Modern Design System Design Variables */
:root {
  --font-family-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-heading: 'Outfit', sans-serif;

  /* Color Palette - Cyberpunk / Dark Mode / Gemini Theme */
  --bg-color: #0b0c16;
  --card-bg: rgba(20, 22, 41, 0.55);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-primary: #818cf8; /* Violet Indigo */
  --accent-secondary: #a78bfa; /* Light Purple */
  --accent-gradient: linear-gradient(135deg, #7a73e6 0%, #4f86f7 50%, #9d5ee5 100%);
  --accent-hover-gradient: linear-gradient(135deg, #8a83f6 0%, #5f96ff 50%, #ad6eff 100%);
  
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  
  --border-radius-lg: 24px;
  --border-radius-md: 14px;
  --border-radius-sm: 8px;

  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Ambient glow blobs in background */
.glow-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  mix-blend-mode: screen;
  pointer-events: none;
}

.blob-purple {
  width: 500px;
  height: 500px;
  background-color: #8b5cf6;
  top: -100px;
  right: -50px;
  animation: float 20s ease-in-out infinite alternate;
}

.blob-blue {
  width: 600px;
  height: 600px;
  background-color: #3b82f6;
  bottom: -150px;
  left: -100px;
  animation: float 25s ease-in-out infinite alternate-reverse;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(50px, 30px) scale(1.1);
  }
}

/* Container & Layout */
.container {
  width: 100%;
  max-width: 500px;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.card-container {
  width: 100%;
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Glassmorphic Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  padding: 40px 32px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-gradient);
}

/* Card Header */
.card-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo-wrapper {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.gemini-star {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(122, 115, 230, 0.5));
  animation: spinSlow 30s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.card-header h1 {
  font-family: var(--font-family-heading);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 90%;
}

/* Form Styling */
.vault-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.input-label {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  margin-left: 4px;
}

.helper-link {
  color: var(--accent-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
  opacity: 0.85;
}

.helper-link:hover {
  color: var(--accent-primary);
  opacity: 1;
  text-shadow: 0 0 8px rgba(129, 140, 248, 0.4);
}

.external-icon {
  transition: transform 0.2s ease;
}

.helper-link:hover .external-icon {
  transform: translate(1px, -1px);
}

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

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.input-wrapper input {
  width: 100%;
  background: rgba(13, 15, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  padding: 16px 16px 16px 48px;
  color: #fff;
  font-family: var(--font-family-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

/* Focus and State classes */
.input-wrapper input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.2);
  background: rgba(13, 15, 30, 0.85);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper input:not(:placeholder-shown) + .input-icon {
  color: var(--accent-secondary);
}

.input-wrapper input.invalid {
  border-color: var(--error-color);
}

.input-wrapper input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Toggle Password Button */
.toggle-password {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-smooth);
}

.toggle-password:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.error-text {
  font-size: 0.75rem;
  color: var(--error-color);
  margin-left: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: var(--transition-smooth);
  height: 0;
  overflow: hidden;
}

.error-text.visible {
  opacity: 1;
  transform: translateY(0);
  height: auto;
  margin-top: 4px;
}

/* Submit Button */
.submit-btn {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-md);
  padding: 16px;
  font-family: var(--font-family-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(122, 115, 230, 0.25);
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.submit-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s ease-out;
  border-radius: var(--border-radius-md);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(122, 115, 230, 0.4);
  background: var(--accent-hover-gradient);
}

.submit-btn:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.submit-btn:active {
  transform: translateY(1px);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner Loader */
.loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.hidden {
  display: none !important;
}

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

/* Footer info */
.card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 24px;
  text-align: center;
}

.storage-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-filepath {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent-secondary);
}

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

.toast {
  background: rgba(18, 19, 35, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-left: 4px solid var(--accent-primary);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 24px;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-primary);
  min-width: 320px;
  max-width: 400px;
  transform: translateX(120%);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

.toast.toast-success {
  border-left-color: var(--success-color);
}

.toast.toast-error {
  border-left-color: var(--error-color);
}

.toast.toast-warning {
  border-left-color: var(--warning-color);
}

.toast.slide-out {
  animation: slideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-success .toast-icon { color: var(--success-color); }
.toast-error .toast-icon { color: var(--error-color); }
.toast-warning .toast-icon { color: var(--warning-color); }

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.toast-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Responsive adjustment */
@media (max-width: 480px) {
  .card {
    padding: 32px 20px;
    gap: 24px;
  }
  
  .card-header h1 {
    font-size: 1.8rem;
  }
}
