/* CSS Custom Properties for easy theming */
:root {
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: rgba(31, 38, 135, 0.15);
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7c7c9a;
  --blur-amount: 20px;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base styles */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif, "Noto Color Emoji", "Apple Color Emoji";
  font-optical-sizing: auto;
  font-weight: 400;
  background: linear-gradient(135deg, #e0e5ec 0%, #f5f7fa 50%, #e8ecf3 100%);
  color: var(--text-primary);
  display: flex;
  flex-flow: column;
  align-items: center;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

/* Animated background */
.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea15 0%, #764ba210 50%, #f093fb10 100%);
}

.background::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
}

/* Floating animated blobs */
.background-blob-1 {
  position: absolute;
  top: -10%;
  right: -5%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.4) 0%, rgba(118, 75, 162, 0.3) 100%);
  filter: blur(80px);
  animation: float1 20s ease-in-out infinite;
}

.background-blob-2 {
  position: absolute;
  bottom: -15%;
  left: -10%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.3) 0%, rgba(245, 87, 108, 0.2) 100%);
  filter: blur(100px);
  animation: float2 25s ease-in-out infinite;
}

.background-blob-3 {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 400px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
  filter: blur(120px);
  animation: float3 30s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 50px) scale(1.1); }
  66% { transform: translate(20px, -30px) scale(0.95); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.98); }
}

@keyframes float3 {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.1) translateY(-20px); }
}

/* Glass noise texture overlay */
.background::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Main container */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 800px;
  padding: 40px 20px;
  margin: auto 0;
  animation: fadeInUp 0.8s var(--transition-smooth);
}

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

/* Typography */
h1 {
  margin: 0 0 16px 0;
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  letter-spacing: -0.02em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 8s ease infinite;
  background-size: 200% 200%;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.text-cta {
  max-width: 500px;
  font-size: 1.1rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text-secondary);
  margin: 0 0 40px 0;
  opacity: 0;
  animation: fadeIn 0.8s var(--transition-smooth) 0.2s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Model badge */
.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin-bottom: 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  animation: fadeIn 0.8s var(--transition-smooth) 0.1s forwards;
  opacity: 0;
}

.model-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

/* Glass card input container */
.input-container {
  position: relative;
  width: 100%;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeInUp 0.8s var(--transition-smooth) 0.3s forwards;
}

#prompt-input {
  width: 100%;
  height: 70px;
  padding: 0 80px 0 28px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow:
    0 8px 32px var(--glass-shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--text-primary);
  transition: all 0.3s var(--transition-smooth);
}

#prompt-input::placeholder {
  color: var(--text-muted);
}

#prompt-input:focus {
  outline: none;
  border-color: rgba(102, 126, 234, 0.5);
  box-shadow:
    0 8px 32px var(--glass-shadow),
    0 0 0 4px rgba(102, 126, 234, 0.15),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Generate button */
#generate-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  background: var(--primary-gradient);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.3s var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#generate-btn:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

#generate-btn:active:not(:disabled) {
  transform: translateY(-50%) scale(0.98);
}

#generate-btn:disabled {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  cursor: not-allowed;
  box-shadow: none;
}

#generate-btn svg {
  width: 20px;
  height: 20px;
  transition: all 0.3s var(--transition-smooth);
}

#generate-btn svg.arrow {
  opacity: 1;
  transform: translateX(0);
}

#generate-btn:hover:not(:disabled) svg.arrow {
  transform: translateX(3px);
}

#generate-btn.generating:disabled svg.arrow {
  opacity: 0;
  transform: scale(0.5);
}

#generate-btn svg.loader {
  position: absolute;
  opacity: 0;
  transform: scale(0.5);
  animation: rotator 1.2s linear infinite;
}

#generate-btn.generating:disabled svg.loader {
  opacity: 1;
  transform: scale(1);
}

#generate-btn svg.loader circle {
  stroke-dasharray: 50;
  stroke-dashoffset: 0;
  transform-origin: center;
  animation: dash 1.2s ease-in-out infinite;
}

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

@keyframes dash {
  0% { stroke-dashoffset: 50; }
  50% { stroke-dashoffset: 12; }
  100% { stroke-dashoffset: 50; }
}

/* Output container */
.output-container {
  width: 100%;
  min-height: 100px;
  display: flex;
  flex-flow: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  animation: fadeIn 0.8s var(--transition-smooth) 0.5s forwards;
}

.response-box {
  display: flex;
  flex-flow: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
}

/* Enhanced prompt cards - Glassmorphism */
.enhanced-prompt {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow:
    0 8px 32px var(--glass-shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: slideInUp 0.5s var(--transition-smooth);
  transition: all 0.3s var(--transition-smooth);
}

.enhanced-prompt:hover {
  transform: translateY(-4px);
  box-shadow:
    0 12px 40px rgba(31, 38, 135, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.enhanced-prompt p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Copy button */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary-gradient);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.copy-btn:active {
  transform: translateY(0);
}

/* Status message */
#status-message {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 12px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  transition: all 0.3s var(--transition-smooth);
}

#status-message:empty {
  display: none;
}

#status-message a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

#status-message a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 0;
  margin-top: auto;
  font-size: 0.9rem;
  opacity: 0;
  animation: fadeIn 0.8s var(--transition-smooth) 0.7s forwards;
}

.footer p,
.footer a {
  margin: 0;
  color: var(--text-secondary);
}

.footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s var(--transition-smooth);
  padding: 8px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
}

.footer a:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateY(-2px);
}

.footer a svg {
  width: 8px;
  height: 12px;
  transition: transform 0.3s var(--transition-smooth);
}

.footer a svg path {
  fill: currentColor;
}

.footer a:hover svg {
  transform: translateX(3px);
}

.footer p a {
  padding: 0;
  background: none;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #667eea;
  font-weight: 500;
}

.footer p a:hover {
  text-decoration: underline;
  transform: none;
  background: none;
}

/* Responsive design */
@media screen and (max-width: 600px) {
  body {
    padding: 16px;
  }

  .container {
    padding: 20px 0;
  }

  h1 {
    font-size: 2.2rem;
  }

  .text-cta {
    font-size: 1rem;
    margin-bottom: 30px;
  }

  #prompt-input {
    height: 60px;
    padding: 0 70px 0 20px;
    font-size: 1rem;
    border-radius: 16px;
  }

  #generate-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .enhanced-prompt {
    padding: 20px;
    border-radius: 16px;
  }

  .enhanced-prompt p {
    font-size: 1rem;
  }

  .footer {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .footer p {
    order: 2;
  }
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .background-blob-1,
  .background-blob-2,
  .background-blob-3 {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.3);
    --text-primary: #000000;
    --text-secondary: #333333;
  }
}

/* Print styles */
@media print {
  .background,
  #generate-btn,
  .copy-btn,
  .footer {
    display: none;
  }

  body {
    background: white;
  }

  .enhanced-prompt {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
