/* Crypto Tax Calculator Widget Styles - Waltio Design System */

/* Design System Colors */
:root {
  --waltio-purple: #3B24FC;
  --waltio-purple-hover: #2A1BC7;
  --waltio-purple-light: rgba(59, 36, 252, 0.1);
  --waltio-text-grey-2: #4A4A4A;
  --waltio-stroke-button: #E5E5E5;
  --waltio-white: #FFFFFF;
  --waltio-error: #E53E3E;
  --waltio-disabled-bg: #F5F5F5;
  --waltio-disabled-text: #9B9B9B;
  --waltio-success: #00A86B;
  --waltio-bg: #F5F7FA;
}

.crypto-tax-widget {
  font-family: var(--waltio-font-family, 'Roobert', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  background: var(--waltio-white);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: var(--waltio-text-grey-2);
}

.crypto-tax-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}

.crypto-tax-section {
  display: flex;
  flex-direction: column;
}

.crypto-tax-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--waltio-purple);
  color: var(--waltio-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.crypto-tax-section-title {
  margin: 0 0 24px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.crypto-tax-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crypto-tax-input-group {
  display: flex;
  flex-direction: column;
}

.crypto-tax-input-group label {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--waltio-text-grey-2);
  line-height: 1.4;
}

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

.crypto-tax-input {
  appearance: textfield;
  appearance: textfield;
  width: 100%;
  padding: 12px 16px;
  padding-right: 60px;
  font-size: 16px;
  line-height: 1.5;
  border: 1px solid var(--waltio-stroke-button);
  border-radius: 8px;
  box-sizing: border-box;
  background: var(--waltio-white);
  color: #1a1a1a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.crypto-tax-input::placeholder {
  color: var(--waltio-disabled-text);
  opacity: 0.6;
}

.crypto-tax-input:focus {
  outline: none;
  border-color: var(--waltio-purple);
  box-shadow: 0 0 0 3px var(--waltio-purple-light);
}

.crypto-tax-input.error {
  border-color: var(--waltio-error);
}

.crypto-tax-input.error:focus {
  border-color: var(--waltio-error);
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.crypto-tax-currency {
  position: absolute;
  right: 16px;
  color: var(--waltio-disabled-text);
  font-size: 14px;
  pointer-events: none;
}

.crypto-tax-max-wrapper {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 1;
}

.crypto-tax-max-button {
  font-size: 10px;
  color: var(--waltio-purple);
  text-transform: uppercase;
  background: var(--waltio-purple-light);
  border: 1px solid var(--waltio-purple);
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0;
  cursor: pointer;
  font-weight: 700;
  pointer-events: all;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1;
}

.crypto-tax-max-button:hover {
  background: var(--waltio-purple);
  color: var(--waltio-white);
}

.crypto-tax-max-wrapper .crypto-tax-currency {
  position: static;
  color: var(--waltio-text-grey-2);
  font-weight: 600;
  font-size: 14px;
}

.crypto-tax-error-message {
  display: none;
  margin-top: 8px;
  font-size: 12px;
  color: var(--waltio-error);
}

.crypto-tax-input-group.has-error .crypto-tax-error-message {
  display: block;
}

.crypto-tax-button {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--waltio-white);
  background: var(--waltio-purple);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: inherit;
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.crypto-tax-button:active:not(:disabled) {
  background: var(--waltio-purple-hover);
}

.crypto-tax-button:hover:not(:disabled) {
  background: var(--waltio-purple-hover);
}

.crypto-tax-button:disabled {
  background: var(--waltio-disabled-bg);
  color: var(--waltio-disabled-text);
  cursor: not-allowed;
  border: 1px solid var(--waltio-stroke-button);
}

.crypto-tax-button.loading {
  color: var(--waltio-white);
  pointer-events: none;
  background: var(--waltio-purple-hover);
}

.crypto-tax-button.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid var(--waltio-white);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Results Section */
.crypto-tax-results {
  background: var(--waltio-bg);
  padding: 24px;
  border-radius: 8px;
}

.crypto-tax-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--waltio-disabled-text);
  font-size: 14px;
}

.crypto-tax-result-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease-in;
}

/* Order (ES widgets): taxable amount -> tax rate -> tax due -> message -> CTA */
.crypto-tax-result-content .crypto-tax-result-item:nth-of-type(1) { order: 0; } /* taxable amount */
.crypto-tax-result-content .crypto-tax-result-item:nth-of-type(3) { order: 1; } /* rate */
.crypto-tax-result-content .crypto-tax-result-item:nth-of-type(2) { order: 2; } /* tax due */
.crypto-tax-message { order: 3; }
.crypto-tax-cta-button { order: 4; }

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.crypto-tax-result-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crypto-tax-result-label {
  font-size: 14px;
  color: var(--waltio-text-grey-2);
  font-weight: 500;
}

.crypto-tax-result-separator {
  height: 1px;
  background: var(--waltio-stroke-button);
  width: 100%;
}

.crypto-tax-result-value {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.crypto-tax-flat-tax {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--waltio-stroke-button);
}

.crypto-tax-flat-tax-indicator {
  width: 4px;
  height: 32px;
  background: var(--waltio-purple);
  border-radius: 2px;
  flex-shrink: 0;
}

.crypto-tax-flat-tax .crypto-tax-result-label {
  flex: 1;
  margin: 0;
}

.crypto-tax-flat-tax .crypto-tax-result-value {
  font-size: 18px;
}

.crypto-tax-message {
  margin-top: 16px;
  padding: 16px;
  background: var(--waltio-white);
  border-radius: 8px;
  border-left: 4px solid var(--waltio-purple);
  font-size: 14px;
  line-height: 1.5;
  color: var(--waltio-text-grey-2);
}

.crypto-tax-message.exempt {
  border-left-color: var(--waltio-success);
}

.crypto-tax-message.loss {
  border-left-color: var(--waltio-disabled-text);
}

.crypto-tax-cta-button {
  margin-top: 20px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--waltio-white);
  background: var(--waltio-purple);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  animation: pulse-glow 2s ease-in-out infinite;
  isolation: isolate;
}

.crypto-tax-cta-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--waltio-purple);
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  z-index: -1;
  animation: ripple 2s ease-out infinite;
  clip-path: inset(0);
}

.crypto-tax-cta-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--waltio-purple);
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  z-index: -1;
  animation: ripple 2s ease-out infinite 0.5s;
  clip-path: inset(0);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 36, 252, 0.4),
                0 0 0 0 rgba(59, 36, 252, 0.3);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(59, 36, 252, 0),
                0 0 0 16px rgba(59, 36, 252, 0);
  }
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.4;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0;
  }
}

.crypto-tax-cta-button:hover {
  background: var(--waltio-purple-hover);
  transform: scale(1.02);
  animation: none;
}

.crypto-tax-cta-button:hover::before,
.crypto-tax-cta-button:hover::after {
  animation: none;
}

.crypto-tax-disclaimer-box {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #FFF9E6;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid #FFC107;
}

.crypto-tax-disclaimer-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.2;
}

.crypto-tax-disclaimer-box .crypto-tax-disclaimer {
  margin: 0;
  font-size: 12px;
  color: var(--waltio-text-grey-2);
  line-height: 1.5;
  flex: 1;
  text-align: left;
  opacity: 1;
}

/* Footer */
.crypto-tax-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--waltio-stroke-button);
}

.crypto-tax-disclaimer {
  margin: 0 0 16px 0;
  font-size: 12px;
  color: var(--waltio-disabled-text);
  line-height: 1.4;
  opacity: 0.7;
  text-align: center;
}

.crypto-tax-powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.crypto-tax-powered-by-text {
  font-size: 12px;
  color: var(--waltio-disabled-text);
  opacity: 0.6;
  text-transform: lowercase;
  font-weight: 400;
}

.crypto-tax-powered-by-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.crypto-tax-powered-by-link:hover {
  opacity: 0.8;
}

.crypto-tax-powered-by-logo {
  height: 20px;
  width: auto;
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .crypto-tax-container {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .crypto-tax-widget {
    padding: 20px;
  }

  .crypto-tax-result-value {
    font-size: 20px;
  }
}

/* Dark theme support */
[data-theme="dark"] .crypto-tax-widget {
  background: #1a1a1a;
  color: #e0e0e0;
}

[data-theme="dark"] .crypto-tax-section-title {
  color: #ffffff;
}

[data-theme="dark"] .crypto-tax-input {
  appearance: textfield;
  appearance: textfield;
  background: #2a2a2a;
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .crypto-tax-input:focus {
  border-color: var(--waltio-purple);
  box-shadow: 0 0 0 3px rgba(59, 36, 252, 0.2);
}

[data-theme="dark"] .crypto-tax-results {
  background: #2a2a2a;
}

[data-theme="dark"] .crypto-tax-result-value {
  color: #ffffff;
}

[data-theme="dark"] .crypto-tax-message {
  background: #1a1a1a;
  color: #e0e0e0;
}

[data-theme="dark"] .crypto-tax-footer {
  border-top-color: #404040;
}

[data-theme="dark"] .crypto-tax-powered-by-text {
  color: #808080;
}


/* Hide native numeric arrows */
.crypto-tax-input::-webkit-outer-spin-button,
.crypto-tax-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.crypto-tax-input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}
