/**
 * StarTON - P2P Liquidity Exchange Stylesheet
 * High-performance 3D Light/Clean Aesthetics with Mobile Responsive Grid
 */

:root {
  --p2p-bg-card: #ffffff;
  --p2p-border: #e2e8f0;
  --p2p-border-bottom: #cbd5e1;
  --p2p-text-main: #0f172a;
  --p2p-text-muted: #64748b;
  --p2p-green: #059669;
  --p2p-green-bg: #ecfdf5;
  --p2p-red: #dc2626;
  --p2p-red-bg: #fef2f2;
  --p2p-blue: #0284c7;
  --p2p-gold: #d97706;
}

/* Controls Header */
.p2p-controls-card {
  background: #ffffff;
  border: 1px solid var(--p2p-border);
  border-bottom: 4px solid var(--p2p-border-bottom);
  border-radius: 20px;
  padding: 22px 28px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.p2p-switcher {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.p2p-tab-btn {
  padding: 9px 22px;
  font-size: 0.92rem;
  font-weight: 800;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  color: #64748b;
}

.p2p-tab-btn.active-buy {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.35);
}

.p2p-tab-btn.active-sell {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.35);
}

/* Filter Row */
.p2p-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #f1f5f9;
}

.p2p-select, .p2p-input {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease;
}

.p2p-select:focus, .p2p-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Live Market Bar */
.p2p-market-strip {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 20px;
  margin-bottom: 22px;
  overflow-x: auto;
  white-space: nowrap;
}

.p2p-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.p2p-ticker-val {
  color: #059669;
  font-family: 'JetBrains Mono', monospace;
}

/* Listing Cards */
.p2p-listing-card {
  background: #ffffff;
  border: 1px solid var(--p2p-border);
  border-bottom: 3.5px solid var(--p2p-border-bottom);
  border-radius: 18px;
  padding: 22px 26px;
  display: grid;
  grid-template-columns: 2.2fr 1.6fr 1.5fr auto;
  align-items: center;
  gap: 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.p2p-listing-card:hover {
  transform: translateY(-2px);
  border-color: #94a3b8;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.p2p-merchant-col {
  display: flex;
  align-items: center;
  gap: 14px;
}

.p2p-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  flex-shrink: 0;
}

.p2p-merchant-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p2p-merchant-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.p2p-badge-verified {
  background: #ecfdf5;
  color: #059669;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  border: 1px solid #a7f3d0;
}

.p2p-merchant-stats {
  font-size: 0.78rem;
  color: #64748b;
}

.p2p-price-col {
  display: flex;
  flex-direction: column;
}

.p2p-unit-price {
  font-size: 1.45rem;
  font-weight: 900;
  color: #059669;
  font-family: 'JetBrains Mono', monospace;
}

.p2p-unit-price.sell-mode {
  color: #dc2626;
}

.p2p-limit-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #475569;
}

.p2p-methods-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* Modals */
.p2p-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.p2p-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.p2p-modal-box {
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
  border: 1px solid #e2e8f0;
  padding: 32px;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.p2p-modal-overlay.active .p2p-modal-box {
  transform: translateY(0);
}

.p2p-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.p2p-modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
}

.p2p-close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: background 0.15s;
}

.p2p-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Order Pipeline / Stepper */
.p2p-stepper {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 24px;
}

.p2p-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.p2p-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p2p-step.active .p2p-step-circle {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.2);
}

.p2p-step.completed .p2p-step-circle {
  background: #059669;
  color: #ffffff;
}

.p2p-step-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
}

/* Chat Log Box */
.p2p-chat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.p2p-chat-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.4;
  max-width: 85%;
}

.p2p-chat-msg.buyer {
  background: #e0f2fe;
  color: #0369a1;
  align-self: flex-start;
}

.p2p-chat-msg.seller {
  background: #ecfdf5;
  color: #047857;
  align-self: flex-end;
}

.p2p-chat-msg.system {
  background: #f1f5f9;
  color: #475569;
  align-self: center;
  font-size: 0.78rem;
  border: 1px dashed #cbd5e1;
  max-width: 95%;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .p2p-listing-card {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .p2p-action-col {
    grid-column: span 2;
    text-align: right;
  }
}

@media (max-width: 640px) {
  .p2p-listing-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 20px;
  }
  .p2p-action-col {
    grid-column: span 1;
    width: 100%;
  }
  .p2p-action-col .hp-btn-3d {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}
