/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

body {
  font-family: 'Inter', sans-serif;
  background: #eef4fb;
  color: #0a1628;
  padding: 40px 20px;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(0,152,234,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(0,152,234,0.07) 0%, transparent 50%),
    linear-gradient(180deg, #e8f3fc 0%, #f2f7fc 60%, #eef4fb 100%);
  position: relative;
  overflow-x: hidden;
}

/* Subtle diamond pattern — TON brand motif */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(45deg, rgba(0,152,234,0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,152,234,0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,152,234,0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,152,234,0.03) 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
  pointer-events: none;
  z-index: 0;
}

main {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* Container */
.mix-container {
  width: 100%;
  max-width: 1000px;
  background: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 48px;
  box-shadow:
    0 2px 8px rgba(0,152,234,0.08),
    0 16px 48px rgba(0,152,234,0.12),
    0 48px 80px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}

/* TON diamond gem top glow */
.mix-container::before {
  content: '';
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 240px;
  background: radial-gradient(ellipse, rgba(0,152,234,0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* Bottom right soft glow */
.mix-container::after {
  content: '';
  position: absolute;
  bottom: -80px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0,152,234,0.06) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

/* Header */
.mix-header {
  text-align: center;
  margin-bottom: 44px;
  position: relative;
  z-index: 1;
}

.mix-logo {
  width: 72px;
  height: 72px;
  display: block;
  margin: 0 auto 18px;
  filter: drop-shadow(0 4px 20px rgba(0,152,234,0.4));
}

.mix-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 28px;
  line-height: 1.3;
  color: #0a1628;
  letter-spacing: -0.8px;
}

/* Form */
.mix-form {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Exchange Panel */
.exchange-panel {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 28px;
  position: relative;
}

/* Panel */
.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0f7fd;
  border: 1.5px solid #d0e8f7;
  border-radius: 16px;
  overflow: visible;
  transition: all 0.25s;
}

.panel:hover {
  border-color: #0098ea;
  box-shadow: 0 0 0 4px rgba(0,152,234,0.08);
}

/* Panel Label */
.panel-label {
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 600;
  color: #7aaac8;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 1px solid #ddeef8;
}

/* Panel Header */
.panel-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

/* Amount Input */
.from-panel .panel-header input {
  width: 100%;
  max-width: 280px;
  padding: 8px 12px;
  font-size: 40px;
  font-weight: 800;
  text-align: right;
  border: none;
  background: transparent;
  color: #0098ea;
  outline: none;
  font-family: 'Inter', sans-serif;
  letter-spacing: -2px;
}

.from-panel .panel-header input::placeholder {
  color: rgba(0,152,234,0.2);
}

/* Receive Amount */
.to-panel .panel-header .receive-big {
  width: 100%;
  max-width: 280px;
  padding: 8px 12px;
  font-size: 40px;
  font-weight: 800;
  text-align: right;
  color: #0a1628;
  background: transparent;
  font-family: 'Inter', sans-serif;
  letter-spacing: -2px;
}

/* Select Area */
.panel-select {
  padding: 10px 16px 16px;
}

/* Custom Select */
.custom-select {
  position: relative;
  width: 100%;
  z-index: 100;
}

.select-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid #d0e8f7;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  color: #0a1628;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(0,152,234,0.06);
}

.select-trigger:hover {
  border-color: #0098ea;
  box-shadow: 0 0 0 3px rgba(0,152,234,0.1);
}

.select-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,152,234,0.2);
}

.select-value {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0a1628;
}

.arrow {
  font-size: 11px;
  color: #0098ea;
  transition: transform 0.2s;
}

.custom-select.active .arrow {
  transform: rotate(180deg);
}

/* Options Dropdown */
.options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  padding: 0;
  border: 1.5px solid #d0e8f7;
  border-radius: 16px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 10000 !important;
  box-shadow:
    0 8px 32px rgba(0,152,234,0.15),
    0 2px 8px rgba(0,0,0,0.06);
}

.options::-webkit-scrollbar { width: 6px; }
.options::-webkit-scrollbar-track { background: #f0f7fd; border-radius: 8px; }
.options::-webkit-scrollbar-thumb { background: #a8d4f0; border-radius: 6px; }
.options::-webkit-scrollbar-thumb:hover { background: #0098ea; }

/* Search Input */
.search-input {
  position: sticky;
  top: 0;
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid #e8f3fb;
  background: #f8fbfe;
  color: #0a1628;
  font-size: 14px;
  outline: none;
  border-radius: 16px 16px 0 0;
  z-index: 2;
  font-family: 'Inter', sans-serif;
}

.search-input::placeholder { color: #a8c8e0; }

/* Option Group */
.opt-group {
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 700;
  color: #0098ea;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: #f8fbfe;
  position: sticky;
  top: 48px;
  z-index: 1;
}

/* Option Item */
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  color: #4a6a88;
  transition: all 0.15s ease;
  border: none;
  box-shadow: inset 0 -1px 0 #f0f7fd;
}

.option:last-child { box-shadow: none; }

.option:hover {
  background: #f0f7fd;
  color: #0a1628;
}

.option.selected {
  background: #e8f5ff;
  color: #0098ea;
  box-shadow: inset 3px 0 0 #0098ea, inset 0 -1px 0 #f0f7fd;
}

.option img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.option span {
  white-space: nowrap;
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Swap Button */
.mix-swap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #d0e8f7;
  color: #0098ea;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,152,234,0.15);
}

.mix-swap:hover {
  background: #0098ea;
  border-color: #0098ea;
  color: #ffffff;
  transform: translate(-50%, -50%) rotate(180deg) scale(1.1);
  box-shadow: 0 6px 24px rgba(0,152,234,0.45);
}

/* Wallet Input */
.mix-form label {
  display: block;
  margin: 22px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #7aaac8;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.mix-form input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid #d0e8f7;
  border-radius: 14px;
  background: #f0f7fd;
  color: #0a1628;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.mix-form input[type="text"]:focus {
  border-color: #0098ea;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(0,152,234,0.1);
}

.mix-form input[type="text"]::placeholder { color: #b0cfe8; }

/* Submit Button */
.mix-submit {
  display: block;
  width: 100%;
  background: #0098ea;
  color: #ffffff;
  border: none;
  padding: 18px 24px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 28px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 4px 20px rgba(0,152,234,0.4),
    0 1px 0 rgba(255,255,255,0.2) inset;
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}

/* Ripple overlay */
.mix-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  pointer-events: none;
}

.mix-submit:hover {
  background: #007acc;
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 32px rgba(0,152,234,0.5);
}

.mix-submit:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 2px 8px rgba(0,152,234,0.3);
}

/* SEO Section */
.seo-section {
  max-width: 800px;
  margin: 40px auto 0;
  padding: 32px;
  background: #ffffff;
  border: 1px solid #d0e8f7;
  border-radius: 20px;
  color: #6a8aaa;
  box-shadow: 0 4px 20px rgba(0,152,234,0.06);
}

.seo-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 14px;
  color: #0a1628;
  letter-spacing: -0.3px;
}

.seo-section h2:first-child { margin-top: 0; }
.seo-section p  { margin-bottom: 14px; line-height: 1.75; font-size: 14px; }
.seo-section ul { margin: 14px 0 14px 22px; }
.seo-section li { margin-bottom: 8px; font-size: 14px; line-height: 1.6; }

/* Info Block */
.info-block {
  max-width: 800px;
  margin: 20px auto 0;
  padding: 22px 32px;
  background: #ffffff;
  border: 1px solid #d0e8f7;
  border-radius: 20px;
  color: #0a1628;
  box-shadow: 0 4px 20px rgba(0,152,234,0.06);
}

.info-block .label {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 11px;
  color: #7aaac8;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.info-block .value p { margin: 0; font-size: 14px; }

.info-block .value a {
  color: #0098ea;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.info-block .value a:hover {
  color: #007acc;
  text-decoration: underline;
}

/* Loader */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #d0e8f7;
  border-top-color: #0098ea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  visibility: hidden;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* Responsive */
@media (max-width: 768px) {
  .mix-container { padding: 28px 20px; border-radius: 20px; }
  .mix-title { font-size: 22px; }

  .exchange-panel { flex-direction: column; gap: 0; position: relative; }
  .panel { border-radius: 14px; width: 100%; }
  .from-panel { z-index: 10; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .to-panel   { z-index: 5;  border-top-left-radius: 0;    border-top-right-radius: 0;    margin-top: -1px; }

  .from-panel .panel-header input,
  .to-panel .panel-header .receive-big { font-size: 32px; max-width: 100%; text-align: center; letter-spacing: -1px; }

  .mix-swap {
    position: relative; left: auto; top: auto; transform: none;
    margin: -22px auto; z-index: 20; order: 1;
    width: 44px; height: 44px; border-radius: 50%;
  }

  .from-panel { order: 0; }
  .to-panel   { order: 2; }

  .mix-submit { padding: 15px 20px; font-size: 15px; margin-top: 24px; }
  .seo-section, .info-block { padding: 22px 18px; margin-top: 32px; border-radius: 16px; }
  .seo-section h2 { font-size: 17px; }
  .seo-section p, .seo-section li { font-size: 13px; }
}

@media (max-width: 480px) {
  body { padding: 20px 12px; }
  .mix-container { padding: 22px 16px; border-radius: 18px; }
  .mix-logo { width: 60px; height: 60px; margin-bottom: 14px; }
  .mix-title { font-size: 20px; }
  .panel-label { padding: 10px 14px; font-size: 10px; }
  .panel-header { padding: 14px; }
  .from-panel .panel-header input,
  .to-panel .panel-header .receive-big { font-size: 28px; }
  .panel-select { padding: 8px 14px 14px; }
  .select-trigger { padding: 10px 12px; }
  .mix-swap { width: 40px; height: 40px; margin: -20px auto; }
  .mix-form input[type="text"] { padding: 12px 14px; }
  .mix-submit { padding: 14px 18px; margin-top: 20px; }
}

/* Validation */
.wallet-error { color: #e03333; font-size: 12px; margin-top: 5px; display: none; }
.wallet-input.error { border-color: #e03333 !important; }
.wallet-validation-status { display: inline-block; margin-left: 8px; font-size: 14px; }
.wallet-validation-status.valid   { color: #22bb66; }
.wallet-validation-status.invalid { color: #e03333; }
.amount-error { color: #e03333; font-size: 12px; margin-top: 5px; }
#amount.error { color: #e03333; }
