/* 
  Mind-blowing, dynamic, modern, and elegant CSS for Public Encryption Demo
  Focus: fluid animations, subtle gradients, glassmorphism, and interactive UI
  Author: Mir Mohmmad Luqman
*/

/* Reset and base setup */
*,
*::before,
*::after {
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #2f0a4f, #43246c 35%, #5b1f73 65%, #ff3366);
  color: #f0e9ff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  overflow-x: hidden;
  user-select: none;
}

/* Container with glassmorphism and parallax layers */
.container {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: rgba(255 255 255 / 0.09);
  box-shadow:
    0 8px 32px 0 rgba(31, 38, 135, 0.37),
    inset 0 0 60px rgba(255 255 255 / 0.1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 32px;
  padding: 3rem 3rem 3.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  border: 1px solid rgba(255 255 255 / 0.22);
  animation: slideInUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* Subtle floating glow background circles */
.container::before,
.container::after {
  --glow-size: 220px;
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.8;
  z-index: 0;
  pointer-events: none;
  animation: floatGlow 7s ease-in-out infinite alternate;
}

.container::before {
  width: var(--glow-size);
  height: var(--glow-size);
  background: radial-gradient(circle at center, #ff3cac 0%, transparent 70%);
  top: -60px;
  left: -60px;
  animation-delay: 0s;
}

.container::after {
  width: var(--glow-size);
  height: var(--glow-size);
  background: radial-gradient(circle at center, #784ba0 0%, transparent 70%);
  bottom: -50px;
  right: -50px;
  animation-delay: 3.5s;
}

/* Animation for container entrance */
@keyframes slideInUp {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Glow float animation */
@keyframes floatGlow {
  0% {
    transform: translateY(0) translateX(0);
  }
  100% {
    transform: translateY(12px) translateX(12px);
  }
}

/* Header styles with gradient text */
.container > h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  background: linear-gradient(90deg, #ff416c, #ff4b2b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  user-select: none;
  filter: drop-shadow(0 0 4px #ff4b2baa);
  line-height: 1.1;
  margin: 0;
}

/* Subheading / explanatory paragraph */
.container > p {
  font-weight: 400;
  font-size: 1.05rem;
  text-align: center;
  color: #e1d9f0dd;
  user-select: none;
  line-height: 1.4;
  margin-top: 0;
}

/* Label with less aggressive warning style */
label[for="privateKey"] {
  font-size: 0.9rem;
  color: #ff6b81;
  font-weight: 600;
  user-select: none;
  display: block;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
  filter: drop-shadow(0 0 2px #ff6b81cc);
}

/* Shared input and textarea styling */
/* Glass effect with subtle shadows */
textarea,
input[type="password"] {
  width: 100%;
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: #eee;
  background: rgba(0 0 0 / 0.24);
  border: 2px solid rgba(255 255 255 / 0.12);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  resize: vertical;
  box-shadow:
    inset 0 0 15px #0008,
    0 0 12px rgba(255 255 255 / 0.12);
  transition:
    border 0.3s ease,
    box-shadow 0.3s ease,
    background-color 0.3s ease,
    color 0.3s ease;
  backdrop-filter: blur(5px);
  outline-offset: 2px;
  min-height: 4.3rem;
}

/* Output textarea is readonly with subtle difference */
textarea#output {
  color: #ddd;
  background: rgba(15 15 15 / 0.3);
  cursor: not-allowed;
  user-select: text;
  min-height: 6rem;
}

/* Focus states with glowing effect */
textarea:focus,
input[type="password"]:focus {
  border-color: #ff416c;
  background: rgba(255 255 255 / 0.1);
  box-shadow:
    0 0 12px #ff416caa,
    inset 0 0 18px #ff416c66;
  color: #ffeeff;
  outline: none;
  caret-color: #ff6a85;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Buttons container for flexible responsive layout */
.buttons {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons: glass sheen with interactive 3D depth */
button {
  background: linear-gradient(145deg, #ff416c 0%, #ff4b2b 100%);
  border: none;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1rem 2.5rem;
  min-width: 130px;
  box-shadow:
    0 6px 15px #ff4b2baa,
    inset 0 -3px 6px #b72b1f,
    inset 0 3px 6px #ff6c4d;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Button subtle shimmering highlight */
button::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -40%;
  width: 150%;
  height: 200%;
  background: linear-gradient(
    60deg,
    rgba(255,255,255,0.15) 0%,
    rgba(255,255,255,0.3) 50%,
    rgba(255,255,255,0.15) 100%
  );
  transform: rotate(25deg);
  transition: opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  animation: none;
  z-index: 0;
  filter: blur(5px);
}

/* Animate the shimmer on hover */
button:hover::before,
button:focus::before {
  opacity: 1;
  animation: shimmer 1.8s infinite;
}

/* Shimmer animation */
@keyframes shimmer {
  0% {
    transform: translateX(-120%) rotate(25deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(120%) rotate(25deg);
    opacity: 0;
  }
}

/* Button press effect */
button:active {
  transform: translateY(3px) scale(0.97);
  box-shadow:
    0 3px 8px #ff4b2b88,
    inset 0 2px 5px #b72b1f;
}

/* Disabled state */
button:disabled {
  background: #6b6b6baa;
  box-shadow: none;
  cursor: not-allowed;
  color: #ddd;
  pointer-events: none;
  text-transform: none;
}

/* Footer styling */
footer {
  margin-top: 3rem;
  font-size: 0.85rem;
  text-align: center;
  color: #f0d4e3cc;
  font-weight: 500;
  letter-spacing: 0.02em;
  max-width: 520px;
  user-select: none;
  line-height: 1.4;
  padding: 0 1rem;
  font-family: "Poppins", sans-serif;
}

/* Footer links */
footer a {
  color: #ff6b81;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.25s ease;
}

footer a:hover,
footer a:focus {
  color: #ffd6dc;
  outline: none;
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 580px) {
  .container {
    padding: 2.25rem 2rem 2.5rem;
    border-radius: 24px;
  }
  .container > h1 {
    font-size: 1.9rem;
  }
  button {
    min-width: 100%;
  }
  .buttons {
    flex-direction: column;
    gap: 1rem;
  }
  textarea,
  input[type="password"] {
    min-height: 4.8rem;
    font-size: 1.05rem;
  }
}
