/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #3b82f6 0%, #9333ea 100%);
  min-height: 100vh;
  color: white;
}

/* Demo styles */
.demo-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.demo-container h1 {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.demo-container p {
  font-size: 1.125rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.demo-button {
  background: #2563eb;
  color: white;
  padding: 12px 24px;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.demo-button:hover {
  background: #1d4ed8;
}

/* Modal overlay */
.wallet-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wallet-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Main modal container */
.wallet-modal {
  background: #121313;
  border: 1px solid #4b5563;
  border-radius: 24px;
  width: 100%;
  max-width: 1024px;
  height: auto;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.wallet-modal-overlay.active .wallet-modal {
  transform: scale(1);
}

@media (min-width: 768px) {
  .wallet-modal {
    height: 600px;
    max-height: 600px;
    flex-direction: row;
  }
}

/* Close button */
.wallet-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #9ca3af;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  z-index: 10;
  border-radius: 4px;
  transition: color 0.2s;
}

.wallet-modal-close:hover {
  color: #d1d5db;
}

/* Left panel - Wallet selection */
.wallet-selection-panel {
  flex: 1;
  padding: 24px;
  border-bottom: 1px solid #4b5563;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .wallet-selection-panel {
    flex: none;
    width: 50%;
    border-bottom: none;
    border-right: 1px solid #4b5563;
  }
}

/* Header */
.wallet-modal-header {
  margin-bottom: 24px;
  flex-shrink: 0;
}

.wallet-modal-logo {
  height: 35px;
  width: auto;
  margin-bottom: 8px;
}

.wallet-modal-subtitle {
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Wallet list */
.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.wallet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: left;
}

.wallet-item:hover {
  background: #374151;
}

.wallet-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wallet-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wallet-name {
  flex: 1;
  text-align: left;
}

.wallet-recommended {
  background: #16a34a;
  color: white;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* Right panel - Default content */
.wallet-content-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

@media (min-width: 768px) {
  .wallet-content-panel {
    flex: none;
    width: 50%;
  }
}

.wallet-default-content {
  text-align: center;
}

.wallet-default-icon {
  width: 64px;
  height: 64px;
  color: #9ca3af;
  margin: 0 auto 16px;
}

.wallet-default-text {
  color: #9ca3af;
  font-size: 1.125rem;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Ledger Modal Styles */
.ledger-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.ledger-modal {
  background: #1a1a1a;
  border: 1px solid #4a4a4a;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Loading State */
.ledger-loading-content {
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 400px;
}

.ledger-loading-icon {
  margin-bottom: 40px;
}

.ledger-icon-container {
  width: 80px;
  height: 80px;
  background: #e5e7eb;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  animation: pulse 2.5s ease-in-out infinite;
}

.ledger-loading-title {
  color: #d1d5db;
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 80px 0;
}

.ledger-powered-by {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
}

.powered-text {
  font-weight: 600;
}

.reown-logo {
  height: 16px;
  width: auto;
}

/* Phrase State */
.ledger-phrase-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 600px;
}

.ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #4a4a4a;
  flex-shrink: 0;
}

.ledger-header-text {
  display: flex;
  gap: 12px;
  color: #d1d5db;
  font-size: 14px;
  font-weight: 500;
}

.reown-text {
  color: #d1d5db;
}

.manual-kit-text {
  color: #d1d5db;
}

.ledger-close-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: color 0.2s;
}

.ledger-close-btn:hover {
  color: #d1d5db;
}

.ledger-phrase-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ledger-phrase-title {
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.ledger-phrase-description {
  color: #9ca3af;
  font-size: 14px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.ledger-phrase-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.ledger-phrase-length-selector {
  display: flex;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.phrase-length-btn {
  flex: 1;
  padding: 10px 12px;
  background: #374151;
  border: none;
  color: #9ca3af;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid #4a4a4a;
}

.phrase-length-btn:last-child {
  border-right: none;
}

.phrase-length-btn:hover {
  background: #4b5563;
  color: #d1d5db;
}

.phrase-length-btn.active {
  background: #4b5563;
  color: #ffffff;
}

.ledger-phrase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
  padding-right: 4px;
}

.phrase-input-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 6px;
  padding: 8px 10px;
  transition: border-color 0.2s;
}

.phrase-input-container:focus-within {
  border-color: #3b82f6;
}

.phrase-number {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
  min-width: 16px;
  flex-shrink: 0;
}

.phrase-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 12px;
  outline: none;
  min-width: 0;
  width: 100%;
}

.phrase-input::placeholder {
  color: #6b7280;
}

.ledger-continue-btn {
  width: 100%;
  background: #6b7280;
  color: #ffffff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
  flex-shrink: 0;
}

.ledger-continue-btn:hover:not(:disabled) {
  background: #4b5563;
}

.ledger-continue-btn:disabled {
  background: #374151;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Trezor Modal Styles */
.trezor-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.trezor-modal {
  background: #1a1a1a;
  border: 1px solid #4a4a4a;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Loading State */
.trezor-loading-content {
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 400px;
}

.trezor-loading-icon {
  margin-bottom: 40px;
}

.trezor-icon-container {
  width: 80px;
  height: 80px;
  background: #2c7a51; /* Green background for Trezor */
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff; /* White icon */
  animation: pulse 2.5s ease-in-out infinite;
}

.trezor-loading-title {
  color: #d1d5db;
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 80px 0;
}

.trezor-powered-by {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
}

/* Phrase State */
.trezor-phrase-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 600px;
}

.trezor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #4a4a4a;
  flex-shrink: 0;
}

.trezor-header-text {
  display: flex;
  gap: 12px;
  color: #d1d5db;
  font-size: 14px;
  font-weight: 500;
}

.trezor-close-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: color 0.2s;
}

.trezor-close-btn:hover {
  color: #d1d5db;
}

.trezor-phrase-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.trezor-phrase-title {
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.trezor-phrase-description {
  color: #9ca3af;
  font-size: 14px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.trezor-phrase-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.trezor-phrase-length-selector {
  display: flex;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.trezor-phrase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
  padding-right: 4px;
}

.trezor-continue-btn {
  width: 100%;
  background: #6b7280;
  color: #ffffff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
  flex-shrink: 0;
}

.trezor-continue-btn:hover:not(:disabled) {
  background: #4b5563;
}

.trezor-continue-btn:disabled {
  background: #374151;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive Design for both Ledger and Trezor */
@media (max-width: 768px) {
  .ledger-modal,
  .trezor-modal {
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 12px;
  }

  .ledger-loading-content,
  .trezor-loading-content {
    padding: 40px 24px;
    min-height: 300px;
  }

  .ledger-icon-container,
  .trezor-icon-container {
    width: 64px;
    height: 64px;
  }

  .ledger-loading-title,
  .trezor-loading-title {
    font-size: 18px;
    margin-bottom: 60px;
  }

  .ledger-phrase-body,
  .trezor-phrase-body {
    padding: 20px;
  }

  .ledger-phrase-title,
  .trezor-phrase-title {
    font-size: 18px;
  }

  .ledger-phrase-grid,
  .trezor-phrase-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 240px;
  }
}

@media (max-width: 480px) {
  .ledger-modal,
  .trezor-modal {
    max-width: 98vw;
    max-height: 98vh;
    border-radius: 8px;
  }

  .ledger-loading-content,
  .trezor-loading-content {
    padding: 32px 20px;
  }

  .ledger-phrase-body,
  .trezor-phrase-body {
    padding: 16px;
  }

  .ledger-header,
  .trezor-header {
    padding: 16px 20px;
  }

  .phrase-length-btn {
    padding: 8px 10px;
    font-size: 13px;
  }

  .phrase-input-container {
    padding: 6px 8px;
  }

  .phrase-input {
    font-size: 11px;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
