/**
 * Portal Trading Enhancement Styles
 */

/* ==================== CATEGORY FILTERS ==================== */

.category-filters {
  display: flex;
  gap: 8px;
  padding: 15px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  color: #a0a0a0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.category-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-color: transparent;
  color: #fff;
}

.category-btn .count {
  background: rgba(0,0,0,0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

/* ==================== TRADING LAYOUT ==================== */

.trading-page {
  padding: 0;
}

.trading-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 1024px) {
  .trading-layout {
    grid-template-columns: 1fr;
  }
}

/* ==================== CHART SECTION ==================== */

.chart-section {
  background: rgba(15, 15, 20, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.chart-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chart-symbol {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.chart-price {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-family: 'SF Mono', monospace;
}

.chart-change {
  font-size: 14px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.chart-change.positive {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.chart-change.negative {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.chart-status {
  display: flex;
  align-items: center;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #10b981;
  font-size: 12px;
  font-weight: 600;
}

.live-indicator .pulse {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.chart-container {
  height: 500px;
  background: #0a0a0f;
}

/* ==================== SIDEBAR ==================== */

.trading-sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* ==================== ASSETS PANEL ==================== */

.assets-panel {
  background: rgba(15, 15, 20, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  max-height: 300px;
  display: flex;
  flex-direction: column;
}

.assets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-weight: 600;
  color: #fff;
}

.asset-search {
  width: 120px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
}

.asset-search::placeholder {
  color: #666;
}

.assets-list {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
}

.asset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.asset-item:hover {
  background: rgba(255,255,255,0.05);
}

.asset-item.selected {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.asset-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.asset-icon {
  font-size: 16px;
}

.asset-name {
  font-weight: 500;
  color: #fff;
  font-size: 13px;
}

.asset-price {
  text-align: right;
}

.asset-price .price {
  display: block;
  font-weight: 600;
  color: #fff;
  font-size: 13px;
  font-family: 'SF Mono', monospace;
}

.asset-price .change {
  font-size: 11px;
  font-weight: 500;
}

.asset-price .change.positive { color: #10b981; }
.asset-price .change.negative { color: #ef4444; }

/* ==================== ORDER PANEL ==================== */

.order-panel {
  background: rgba(15, 15, 20, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 15px;
}

.order-header {
  font-weight: 600;
  color: #fff;
  margin-bottom: 15px;
  font-size: 14px;
}

.order-form .form-group {
  margin-bottom: 12px;
}

.order-form label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 5px;
}

.order-form .form-control {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
}

.order-form .form-control:focus {
  outline: none;
  border-color: #6366f1;
}

.order-form .form-row {
  display: flex;
  gap: 10px;
}

.order-form .form-group.half {
  flex: 1;
}

.order-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.btn-sell, .btn-buy {
  padding: 15px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.3;
}

.btn-sell {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.btn-sell:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

.btn-buy {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.btn-buy:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.btn-sell span, .btn-buy span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  margin-top: 3px;
  opacity: 0.9;
  font-family: 'SF Mono', monospace;
}

/* ==================== POSITIONS SECTION ==================== */

.positions-section {
  background: rgba(15, 15, 20, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.positions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-weight: 600;
  color: #fff;
}

.positions-count {
  background: rgba(99, 102, 241, 0.2);
  color: #6366f1;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.positions-table {
  padding: 15px;
}

.no-positions {
  text-align: center;
  color: #666;
  padding: 30px;
}

.positions-tbl {
  width: 100%;
  border-collapse: collapse;
}

.positions-tbl th {
  text-align: left;
  padding: 10px 12px;
  color: #888;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.positions-tbl td {
  padding: 12px;
  font-size: 13px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.trade-type {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.trade-type.buy {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.trade-type.sell {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.positions-tbl .pl {
  font-weight: 600;
  font-family: 'SF Mono', monospace;
}

.positions-tbl .pl.positive { color: #10b981; }
.positions-tbl .pl.negative { color: #ef4444; }

.btn-close-trade {
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close-trade:hover {
  background: #ef4444;
  color: #fff;
}

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
  .category-filters {
    padding: 10px 0;
  }
  
  .category-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .trading-sidebar {
    order: -1;
  }
  
  .chart-container {
    height: 350px;
  }
  
  .assets-panel {
    max-height: 200px;
  }
  
  .positions-tbl {
    font-size: 12px;
  }
  
  .positions-tbl th,
  .positions-tbl td {
    padding: 8px 6px;
  }
}

/* ==================== SCROLLBAR ==================== */

.assets-list::-webkit-scrollbar {
  width: 6px;
}

.assets-list::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.assets-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.assets-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}
