/* Base styles */
.trading-body {
  background: #0E0F1E;
  min-height: 100vh;
  color: #ffffff;
  font-size: 16px;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(14,15,30,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 0;
}

.page-container {
  flex: 1;
  padding: 2rem 0;
}

.dashboard-row {
  display: flex;
  max-width: 1900px;
  margin: 0 auto;
  padding: 0 2rem;
  gap: 1.5rem;
}

.chart-and-positions {
  width: 78%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.chart-container {
  width: 100%;
  height: 500px;
  background: #000000;
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
}

.dashboard-container {
  width: 100%;
  background: #1C1F2E;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  height: calc(100vh - 500px - 3rem);
  display: flex;
  flex-direction: column;
}

.dashboard-content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.trading-interface {
  width: 22%;
  position: sticky;
  top: 2rem;
  height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 1.25rem;
  background: #1C1F2E;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
}

.position-summary {
  background: rgba(28, 31, 46, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
}

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

.position-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.position-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.leverage-btn {
  background: #4f46e5;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.leverage-btn:hover {
  background: #4338ca;
}

.position-details {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  color: #9CA3AF;
  font-size: 0.875rem;
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
}

.detail-subvalue {
  color: #9CA3AF;
  font-size: 0.875rem;
}

.table-container {
  flex: 1;
  overflow: auto;
  background-color: #1f2937;
  border-radius: 0.5rem;
  margin-top: 1rem;
}

.tabs {
  display: flex;
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab {
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: #9ca3af;
  white-space: nowrap;
}

.tab:hover {
  color: #e5e7eb;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th {
  background-color: #374151;
  padding: 0.5rem 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1d5db;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: 0.5rem 1rem;
  text-align: left;
  color: #9ca3af;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.btn {
  width: 100%;
  padding: 12px;
  background-color: #4f46e5;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: #4338ca;
}

.action-btn {
  padding: 4px 8px;
  font-size: 12px;
  margin-right: 6px;
  width: 60px;
}

.input {
  width: 100%;
  padding: 8px 12px;
  background-color: #1f2937;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
}

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

.dropdown-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 16px;
  padding: 0;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: #1f2937;
  min-width: 140px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 8px;
}

.dropdown-content a {
  color: #d1d5db;
  padding: 12px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background-color: #374151;
}

.dropdown-content img {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

.show {
  display: block;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-gray-400 {
  color: #9ca3af;
}

.text-sm {
  font-size: 14px;
}

.relative {
  position: relative;
}

.mr-2 {
  margin-right: 8px;
}

.slider-container {
  width: 100%;
  position: relative;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: #4f46e5;
  outline: none;
  opacity: 0.7;
  transition: opacity .2s;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #ffffff;
  cursor: pointer;
  border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #ffffff;
  cursor: pointer;
  border-radius: 50%;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.slider-label {
  position: relative;
  text-align: center;
  width: 20px;
  color: #9ca3af;
  font-size: 12px;
}

.slider-label::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background-color: #4f46e5;
}

.info-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid #9ca3af;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  margin-right: 8px;
  cursor: pointer;
  position: relative;
}

.info-icon:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

.tooltip {
  visibility: hidden;
  width: 200px;
  background-color: #1f2937;
  color: #ffffff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  font-weight: normal;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.down-arrow {
  border: solid #9ca3af;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  margin-left: 12px;
}

.tab-buttons {
  display: flex;
  border-bottom: 1px solid #374151;
  margin-bottom: 16px;
}

.tab-button {
  flex: 1;
  padding: 12px 8px;
  font-weight: 600;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-align: center;
}

.tab-button.active {
  color: #6366F1;
  border-bottom: 2px solid #6366F1;
}

.tab-button:hover:not(.active) {
  color: #e5e7eb;
}

.profit-positive {
  color: #10B981;
}

.profit-negative {
  color: #EF4444;
}

.input-group {
  margin-bottom: 16px;
}

.swap-box {
  background: rgba(28, 31, 46, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.token-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropdown-container {
  position: relative;
}

.dropdown-toggle {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 16px;
  padding: 0;
}

.token-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}

.dropdown-content {
  display: none;
  position: absolute;
  left: 0;
  background-color: #1f2937;
  min-width: 140px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 8px;
}

.dropdown-content a {
  color: #d1d5db;
  padding: 12px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background-color: #374151;
}

.dropdown-content img {
  width: 20px;
  height: 20px;
}

.show {
  display: block;
}

.down-arrow {
  border: solid #9ca3af;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  margin-left: 12px;
}

.swap-input {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  text-align: right;
  width: 100%;
  outline: none;
}

.swap-input::placeholder {
  color: #4B5563;
}

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #9CA3AF;
  font-size: 0.875rem;
}

.token-price {
  color: #9CA3AF;
  font-size: 0.875rem;
}

.max-button {
  color: #3B82F6;
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 500;
  margin-left: 0.5rem;
}
.clickable {
  cursor: pointer;
}

@media (max-width: 767px) {
  .trading-body {
    padding: 0;
  }

  .page-container {
    padding: 1rem 0;
  }

  .dashboard-row {
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem;
  }

  .chart-and-positions {
    width: 100%;
  }

  .trading-interface {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
  }

  .chart-container {
    height: 300px;
  }

  .dashboard-container {
    height: auto;
  }

  .position-details {
    grid-template-columns: repeat(2, 1fr);
  }
}