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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1a1a;
  color: #ffffff;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Account Bar (top header) ===== */
.account-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
}

.account-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.account-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.account-balance-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btc-icon,
.usdt-icon {
  display: flex;
  align-items: center;
}

.balance-btc {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.balance-approx {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
}

.account-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.25rem;
}

.btc-price-arrow {
  color: #e74c3c;
  font-size: 0.7rem;
}

.btc-price {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

/* ===== Sign Panel ===== */
.sign-panel {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.panel-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-clear {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-clear:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.btn-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.btn-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 1.5rem;
  background: #1e1e1e;
  border-radius: 12px 12px 0 0;
  padding: 0.75rem 1rem 0 1rem;
}

.tab {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.75rem 1.25rem;
  position: relative;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: rgba(255,255,255,0.8);
}

.tab.active {
  color: #4cd964;
  border-bottom: 2px solid #4cd964;
}

/* ===== Tab Content ===== */
.tab-content {
  background: #1e1e1e;
  border-radius: 0 0 12px 12px;
  padding: 1.5rem;
}

/* ===== Hex Format Row ===== */
.hex-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hex-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #333;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #888;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: #4cd964;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

/* ===== Field Groups ===== */
.field-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  margin-bottom: 0.35rem;
  text-transform: capitalize;
}

.field-textarea {
  width: 100%;
  min-height: 100px;
  background: #282828;
  border: 1px solid #333;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 1rem;
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.field-textarea:focus {
  outline: none;
  border-color: #4cd964;
}

.field-textarea::placeholder {
  color: rgba(255,255,255,0.3);
}

.char-count {
  position: absolute;
  bottom: 0.6rem;
  right: 0.75rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
}

.field-input {
  width: 100%;
  background: #282828;
  border: 1px solid #333;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  transition: border-color 0.2s;
}

.field-input:focus {
  outline: none;
  border-color: #4cd964;
}

.field-input::placeholder {
  color: rgba(255,255,255,0.3);
}

/* ===== Address Row ===== */
.address-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.address-field {
  flex: 1;
  min-width: 200px;
}

.address-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #282828;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 0.7rem 1rem;
}

.address-path {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.35);
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

.address-value {
  flex: 1;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  font-family: 'Courier New', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-icons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: rgba(255,255,255,0.8);
}

/* Format Group */
.format-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.format-label {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}

.format-btns {
  display: flex;
  background: #282828;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #333;
}

.format-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.format-btn.active {
  background: #3a3a3a;
  color: #fff;
}

.format-btn:hover:not(.active) {
  color: rgba(255,255,255,0.8);
}

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: #2a2a2a;
  margin: 0.5rem 0 1.5rem 0;
}

/* ===== Signature Output ===== */
.signature-output {
  background: #282828;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.35);
  min-height: 56px;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  line-height: 1.5;
}

.signature-output.has-signature {
  color: #4cd964;
}

/* ===== Sign Button ===== */
.sign-btn-row {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.btn-sign {
  background: #4cd964;
  color: #1a1a1a;
  border: none;
  padding: 0.9rem 3.5rem;
  border-radius: 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-sign:hover {
  background: #5ae472;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(76, 217, 100, 0.3);
}

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

.btn-verify-wallet {
  background: #e74c3c;
  color: #ffffff;
  border: none;
  padding: 0.9rem 3.5rem;
  border-radius: 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-verify-wallet:hover {
  background: #ff5a49;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(231, 76, 60, 0.3);
}

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

.btn-verify-wallet:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}


.btn-sign:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== Mobile Wallet Options ===== */
.mobile-wallet-options {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #282828;
  border-radius: 12px;
  border: 1px solid #333;
}

.wallet-choose-text {
  color: rgba(255,255,255,0.7);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.wallet-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wallet-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.wallet-option-btn:hover {
  background: #2a2a2a;
  border-color: #4cd964;
  transform: translateY(-1px);
}

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

.wallet-btn-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-btn-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wallet-btn-text strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
}

.wallet-btn-text small {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

/* ===== Status Messages ===== */
.status {
  margin-top: 1rem;
  padding: 0;
  border-radius: 10px;
  text-align: center;
  font-size: 0.9rem;
}

.status:empty {
  display: none;
}

.status-processing {
  padding: 0.85rem 1rem;
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

.status-success {
  padding: 0.85rem 1rem;
  background: rgba(76, 217, 100, 0.08);
  border: 1px solid rgba(76, 217, 100, 0.2);
  color: #4cd964;
}

.status-error {
  padding: 0.85rem 1rem;
  background: rgba(244, 67, 54, 0.08);
  border: 1px solid rgba(244, 67, 54, 0.2);
  color: #f44336;
}

.status a {
  color: #4cd964;
  text-decoration: underline;
}

/* ===== Hidden wallet info (JS needs these IDs) ===== */
.wallet-info-hidden {
  display: none;
}

.btn-send-hidden {
  display: none;
}

/* ===== Help FAB ===== */
.fab-help {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: #282828;
  border: 1px solid #333;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s;
  z-index: 100;
}

.fab-help:hover {
  color: #fff;
  border-color: #4cd964;
  background: #333;
}

/* ===== Loading spinner ===== */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26,26,26,0.3);
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== Responsive ===== */
@media (min-width: 600px) {
  .wallet-buttons {
    flex-direction: row;
  }

  .wallet-option-btn {
    flex: 1;
  }
}

@media (max-width: 600px) {
  .account-bar {
    padding: 1rem;
  }

  .account-name {
    font-size: 1.25rem;
  }

  .sign-panel {
    padding: 1rem;
  }

  .panel-title {
    font-size: 1.35rem;
  }

  .address-row {
    flex-direction: column;
    gap: 1rem;
  }

  .format-group {
    width: 100%;
    justify-content: flex-start;
  }

  .btn-sign {
    width: 100%;
  }
}
