/* ================================
   K2O SIMPLIFY FEATURE
   "Sometimes you just need things to work"
   ================================ */

/* ================================
   SIMPLIFY BUTTON
   ================================ */

.simplify-btn {
  position: absolute;
  bottom: auto;
  right: auto;
  z-index: 1000;

  padding: 0.9rem 1.4rem;

  /* Cyan-dominant, matches site theme */
  background: rgba(13, 17, 23, 0.95);
  color: #00d4ff;
  border: 1px solid #00d4ff;
  border-radius: 6px;

  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;

  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: pulse-magic 3s ease-in-out infinite;

  /* Cyan glow - site theme */
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2),
              0 0 30px rgba(0, 212, 255, 0.1);
}

.simplify-btn:hover {
  transform: translateY(-2px);
  background: rgba(0, 212, 255, 0.1);
  border-color: #00d4ff;
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3),
              0 0 40px rgba(0, 212, 255, 0.2);
}

.simplify-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.2);
}

.simplify-btn.hidden {
  /* Simple and reliable - display:none cannot be overridden by inline styles */
  display: none !important;
}

@keyframes pulse-magic {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2),
                0 0 30px rgba(0, 212, 255, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3),
                0 0 40px rgba(0, 212, 255, 0.2),
                0 0 0 10px rgba(0, 212, 255, 0);
  }
}


/* ================================
   EMBEDDED SIMPLIFY SECTION
   Form grows in-place, pushes content
   ================================ */

.simplify-section {
  /* Position - in document flow */
  position: relative;
  z-index: 1;

  /* Box Model - grows from 0 */
  width: 100%;
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;

  /* Animation - grows vertically */
  opacity: 0;
  transition:
    max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s ease,
    padding 0.4s ease;
}

.simplify-section.hidden {
  visibility: hidden;
  pointer-events: none;
}

/* Active state - form grows and pushes content */
.simplify-section.active {
  max-height: 800px;
  padding: 3rem 0;
  opacity: 1;
}

/* Glow borders when active */
.simplify-section.active {
  border-top: 1px solid rgba(0, 212, 255, 0.3);
  border-bottom: 1px solid rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.02);
}

/* Form wrapper for centering */
.simplify-form-wrapper {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;

  transform: translateY(20px);
  opacity: 0;
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s,
    opacity 0.4s ease 0.2s;
}

.simplify-section.active .simplify-form-wrapper {
  transform: translateY(0);
  opacity: 1;
}

/* Keep form visible in simplified state */
body.simplified .simplify-section {
  opacity: 1 !important;
  filter: none !important;
  pointer-events: auto !important;
}

.simple-form-content {
  position: relative;
  max-width: 100%;
  width: 100%;
  padding: 0;
  text-align: center;
  overflow: hidden;

  /* Terminal-style card */
  background: rgba(10, 14, 20, 0.95);
  border: 1px solid #30363d;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
              0 0 1px rgba(0, 212, 255, 0.3);
}

/* Terminal header bar with typing animation */
.simple-form-content::before {
  content: 'user@k2o:~$ simplify --mode=human';
  display: block;
  padding: 0.6rem 1rem;
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border-bottom: 1px solid #30363d;
  color: #8b949e;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  text-align: left;

  /* Typing animation */
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  animation: terminal-typing 1.5s steps(35) 0.3s forwards;
}

/* Blinking cursor after header */
.simple-form-content::after {
  content: '\u258c';
  position: absolute;
  top: 0.6rem;
  left: 1rem;
  color: #00ff88;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  animation: cursor-blink 1s step-end infinite, cursor-move 1.5s steps(35) 0.3s forwards;
  opacity: 0;
}

@keyframes terminal-typing {
  0% { width: 0; }
  100% { width: 100%; }
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes cursor-move {
  0% {
    left: 1rem;
    opacity: 1;
  }
  100% {
    left: calc(1rem + 35ch);
    opacity: 1;
  }
}

.simple-form-content h2 {
  margin: 0;
  padding: 1.5rem 2rem 0.5rem;
  font-size: 1.4rem;
  color: #00ff88;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.simple-form-content p {
  margin: 0;
  padding: 0 2rem 1.5rem;
  color: #8b949e;
  font-size: 0.95rem;
  font-weight: 400;
}

.simple-form-content form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 2rem 2rem;
  text-align: left;
}

.simple-form-content input,
.simple-form-content textarea,
.simple-form-content select {
  padding: 0.85rem 1rem 0.85rem 2.5rem;

  /* Terminal-style input */
  background: rgba(13, 17, 23, 0.8);
  border: 1px solid #30363d;
  border-radius: 4px;

  color: #e6edf3;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;

  transition: all 0.2s ease;
}

/* Prompt prefix for inputs */
.simple-form-content input,
.simple-form-content textarea {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ctext x='2' y='15' fill='%2300ff88' font-family='monospace' font-size='14'%3E$%3C/text%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.7rem center;
}

.simple-form-content textarea {
  background-position: 0.7rem 0.85rem;
}

.simple-form-content input:focus,
.simple-form-content textarea:focus,
.simple-form-content select:focus {
  outline: none;
  border-color: #00d4ff;
  background-color: rgba(0, 212, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1),
              inset 0 0 20px rgba(0, 212, 255, 0.03);
}

.simple-form-content input::placeholder,
.simple-form-content textarea::placeholder {
  color: #6e7681;
  font-style: italic;
}

.simple-form-content textarea {
  resize: vertical;
  min-height: 120px;
}

.simple-form-content select {
  cursor: pointer;
  appearance: none;
  padding-left: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300ff88' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Style dropdown options (limited browser support but works in Chrome/Edge) */
.simple-form-content select option {
  background-color: #0d1117;
  color: #e6edf3;
  padding: 0.5rem;
}

.simple-form-content button[type="submit"] {
  padding: 0.9rem 1.5rem;
  margin-top: 0.75rem;

  /* Terminal outline style - subtle, not bright */
  background: transparent;
  border: 1px solid #00ff88;
  border-radius: 4px;

  color: #00ff88;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;

  transition: all 0.2s ease;
}

.simple-form-content button[type="submit"]:hover {
  background: rgba(0, 255, 136, 0.1);
  border-color: #00ff88;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.15);
  transform: translateY(-1px);
}

.simple-form-content button[type="submit"]:active {
  background: rgba(0, 255, 136, 0.15);
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.1);
}

/* Loading spinner for submit button */
.simple-form-content button[type="submit"] .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top: 2px solid #00ff88;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.simple-form-content button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

@keyframes spinner-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.restore-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.5rem 1rem;

  color: #6e7681;
  font-size: 0.8rem;
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid transparent;
  border-radius: 4px;

  transition: all 0.2s ease;
}

.restore-link:hover {
  color: #58a6ff;
  border-color: rgba(88, 166, 255, 0.3);
  background: rgba(88, 166, 255, 0.05);
}

/* Hide button checkbox */
.hide-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-bottom: 1.5rem;
  color: #484f58;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: color 0.2s ease;
}

.hide-checkbox-label:hover {
  color: #6e7681;
}

.hide-checkbox-label input[type="checkbox"] {
  width: 12px;
  height: 12px;
  accent-color: #00ff88;
  cursor: pointer;
}

.hide-checkbox-label span {
  opacity: 0.8;
}

/* ================================
   SIMPLIFIED STATE - Embedded Form
   Content fades, form visible
   ================================ */

/* Hide button when form is open */
body.simplified .simplify-btn,
.simplify-section.active ~ .simplify-btn,
.simplify-section:not(.hidden) ~ .simplify-btn {
  display: none !important;
}

/* Content stays fully visible when form is open - no dimming */
body.simplified header,
body.simplified footer,
body.simplified section:not(.simplify-section) {
  /* opacity: 1 - no dimming per user request */
}

/* Nav stays fully visible and interactive */
body.simplified nav {
  opacity: 1;
  pointer-events: auto;
}

/* Form stays clear and clickable */
body.simplified .simplify-section {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Matrix background stays visible when form is open */
body.simplified #matrix-canvas {
  /* opacity: 1 - no dimming per user request */
}

/* ================================
   MOBILE ADJUSTMENTS
   ================================ */

@media (max-width: 768px) {
  .simplify-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }

  .simple-form-content {
    width: 95%;
  }

  .simple-form-content::before {
    font-size: 0.7rem;
    padding: 0.5rem 0.8rem;
  }

  .simple-form-content h2 {
    font-size: 1.2rem;
    padding: 1.25rem 1.25rem 0.5rem;
  }

  .simple-form-content p {
    font-size: 0.9rem;
    padding: 0 1.25rem 1.25rem;
  }

  .simple-form-content form {
    padding: 0 1.25rem 1.5rem;
    gap: 0.6rem;
  }

  .simple-form-content input,
  .simple-form-content textarea,
  .simple-form-content select {
    padding: 0.75rem 0.9rem 0.75rem 2.2rem;
    font-size: 0.85rem;
  }

  .simple-form-content select {
    padding-left: 0.9rem;
  }

  .restore-link {
    font-size: 0.75rem;
  }

  .hide-checkbox-label {
    font-size: 0.7rem;
  }
}

/* ================================
   THEME COMPATIBILITY
   ================================ */

/* Light theme adjustments */
body.light-theme .simplify-btn {
  background: rgba(255, 255, 255, 0.95);
  color: #00884d;
  border-color: #00884d;
  box-shadow: 0 4px 15px rgba(0, 136, 77, 0.1),
              0 0 30px rgba(0, 150, 199, 0.05);
}

body.light-theme .simplify-btn:hover {
  background: rgba(0, 136, 77, 0.1);
  box-shadow: 0 6px 20px rgba(0, 136, 77, 0.2),
              0 0 40px rgba(0, 150, 199, 0.1);
}

/* Light theme for embedded section */
body.light-theme .simplify-section.active {
  background: rgba(0, 150, 199, 0.08);
  border-top: 1px solid rgba(0, 150, 199, 0.3);
  border-bottom: 1px solid rgba(0, 150, 199, 0.3);
}


body.light-theme .simple-form-content {
  background: #ffffff;
  border: 1px solid #d0d7de;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body.light-theme .simple-form-content::before {
  content: 'user@k2o:~$ simplify --mode=human';
  background: linear-gradient(180deg, #f6f8fa 0%, #eaeef2 100%);
  border-bottom: 1px solid #d0d7de;
  color: #57606a;
}

body.light-theme .simple-form-content h2 {
  color: #00884d;
  text-shadow: none;
}

body.light-theme .simple-form-content p {
  color: #57606a;
}

body.light-theme .simple-form-content input,
body.light-theme .simple-form-content textarea,
body.light-theme .simple-form-content select {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  color: #24292f;
}

/* Light theme prompt */
body.light-theme .simple-form-content input,
body.light-theme .simple-form-content textarea {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ctext x='2' y='15' fill='%2300884d' font-family='monospace' font-size='14'%3E$%3C/text%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.7rem center;
}

body.light-theme .simple-form-content input:focus,
body.light-theme .simple-form-content textarea:focus,
body.light-theme .simple-form-content select:focus {
  border-color: #00884d;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 136, 77, 0.1);
}

body.light-theme .simple-form-content input::placeholder,
body.light-theme .simple-form-content textarea::placeholder {
  color: #8c959f;
}

body.light-theme .simple-form-content select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300884d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

body.light-theme .simple-form-content select option {
  background-color: #ffffff;
  color: #24292f;
}

body.light-theme .simple-form-content button[type="submit"] {
  background: transparent;
  border-color: #00884d;
  color: #00884d;
}

body.light-theme .simple-form-content button[type="submit"]:hover {
  background: rgba(0, 136, 77, 0.1);
  border-color: #00884d;
  box-shadow: 0 0 15px rgba(0, 136, 77, 0.15);
}

body.light-theme .restore-link {
  color: #555;
}

body.light-theme .restore-link:hover {
  color: #00aa00;
}

body.light-theme .hide-checkbox-label {
  color: #666;
}

body.light-theme .hide-checkbox-label span {
  color: #555;
}

/* ================================
   ACCESSIBILITY
   ================================ */

.simplify-btn:focus,
.simple-form-content input:focus,
.simple-form-content textarea:focus,
.simple-form-content select:focus,
.simple-form-content button:focus,
.restore-link:focus {
  outline: 2px solid #00ff88;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .simplify-btn,
  .simple-form-content,
  .techy-content,
  body.simplified header,
  body.simplified footer,
  body.simplified nav,
  body.simplified #matrix-canvas {
    transition: none;
    animation: none;
  }

  @keyframes pulse-magic {
    0%, 100% {
      box-shadow: 0 4px 15px rgba(0, 255, 136, 0.15);
    }
  }
}

/* ================================
   MAGIC SPARKLE ANIMATION
   ================================ */

.magic-sparkle {
  position: fixed;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #00ff88 0%, #00ff8840 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: sparkle-magic 1.2s ease-out forwards;
  box-shadow: 0 0 4px #00ff88, 0 0 8px rgba(0, 255, 136, 0.5);
}

/* Cyan sparkle variant */
.magic-sparkle.cyan {
  background: radial-gradient(circle, #00d4ff 0%, #00d4ff40 40%, transparent 70%);
  box-shadow: 0 0 4px #00d4ff, 0 0 8px rgba(0, 212, 255, 0.5);
}

@keyframes sparkle-magic {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  15% {
    opacity: 1;
    transform: scale(1.5) rotate(90deg);
  }
  40% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(360deg) translateY(-60px);
  }
}

/* ================================
   BUTTON EMERGENCE - "PLANT ON ASPHALT"
   ================================ */

.simplify-btn.emerging {
  animation: button-emerge 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes button-emerge {
  0% {
    transform: scale(0) translateY(50px);
    opacity: 0;
  }
  40% {
    transform: scale(1.2) translateY(-10px);
    opacity: 1;
  }
  70% {
    transform: scale(0.95) translateY(5px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

/* Button shrinking animation for lifecycle */
.simplify-btn.shrinking {
  animation: button-shrink 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes button-shrink {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Crowd-out effect - elements near button get pushed physically */
.crowded-out {
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* ================================
   SPLASH EXPLOSION EFFECT
   ================================ */

.splash-ring {
  position: fixed;
  pointer-events: none;
  border: 3px solid rgba(0, 212, 255, 0.8);
  border-radius: 50%;
  z-index: 999;
  animation: splash-expand 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.splash-ring.cyan {
  border-color: rgba(88, 166, 255, 0.8);
  animation-delay: 0.1s;
}

.splash-ring.outer {
  animation-duration: 0.8s;
}

@keyframes splash-expand {
  0% {
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
    opacity: 1;
  }
  100% {
    width: 200px;
    height: 200px;
    margin-left: -100px;
    margin-top: -100px;
    opacity: 0;
  }
}

/* Splash particles */
.splash-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  background: #00d4ff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
  animation: splash-particle 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.splash-particle.cyan {
  background: #58a6ff;
}

@keyframes splash-particle {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0);
  }
}

/* ================================
   CONTENT DISSOLVE ANIMATION
   ================================ */

.dissolving {
  animation: dissolve-out 0.4s ease-out forwards;
}

@keyframes dissolve-out {
  0% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(4px);
    transform: scale(0.98);
  }
}

.simplified-text {
  animation: fade-in 0.4s ease-in forwards;
}

@keyframes fade-in {
  0% {
    opacity: 0;
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
  }
}

/* ================================
   PRICING UAH CONVERTER
   ================================ */

.uah-price {
  display: inline-block;
  margin-left: 0.5rem;
  color: #8b949e;
  font-size: 0.85em;
  font-weight: 400;
}

body.light-theme .uah-price {
  color: #57606a;
}
