/* trading.css - Trading styles */

/* Trading buttons */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 1;
  gap: 0.5rem;
}

.btn-primary:hover {
  background-color: var(--primary-color-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 1;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background-color: var(--secondary-color-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 1;
  gap: 0.5rem;
}

.btn-outline:hover {
  background-color: var(--hover-bg);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 10px;
}

.btn-group {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border-color);
  margin: 0;
}

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

.btn-group .btn.active {
  background-color: var(--primary-color);
  color: white;
}

/* Button with running state */
.btn.running {
  background-color: var(--danger-color);
}

.btn.running:hover {
  background-color: var(--danger-color-dark);
}

.btn.running .btn-icon svg {
  transform: rotate(45deg);
}

/* Status indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  gap: 0.5rem;
}

.status-badge::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.status-active {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}

.status-badge.status-active::before {
  background-color: var(--success-color);
}

.status-badge.status-inactive {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.status-badge.status-inactive::before {
  background-color: var(--danger-color);
}

/* Trading pairs */
.pair-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pair-symbol {
  font-weight: 600;
}

.pair-change {
  font-size: 0.875rem;
  font-weight: 600;
}

.pair-change.positive {
  color: var(--success-color);
}

.pair-change.negative {
  color: var(--danger-color);
}

.pair-price {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.pair-volume {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Trade table */
.trades-table tr.buy td:nth-child(2),
.trades-table tr td.text-success {
  color: var(--success-color);
}

.trades-table tr.sell td:nth-child(2),
.trades-table tr td.text-danger {
  color: var(--danger-color);
}

/* Input fields */
.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--input-bg);
  color: var(--text-color);
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.input-field:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
  outline: none;
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

/* Search */
.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--input-bg);
  color: var(--text-color);
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Pairs suggestions */
.pairs-suggestions {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.pair-suggestion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.pair-suggestion:last-child {
  border-bottom: none;
}

.pair-suggestion:hover {
  background-color: var(--hover-bg);
}

.pair-suggestion.selected {
  background-color: var(--primary-color-light);
}

/* Login Page Specific Styles */
.login-logo {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-color);
  text-align: center;
  margin-bottom: 2rem;
  display: block;
  width: 100%;
}

.login-logo .logo-dot {
  font-weight: bold;
  color: var(--primary-color);
}

/* Fixed height and scrollable trading pairs section */
.pairs-grid,
.market-grid {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Specific max-height for active trading pairs grid */
.dashboard-card.trading-pairs .pairs-grid {
  max-height: 350px;
}

.pairs-grid::-webkit-scrollbar,
.market-grid::-webkit-scrollbar {
  width: 6px;
}

.pairs-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.pairs-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.pairs-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Fix user menu dropdown */
.user-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 1000;
  border: 1px solid var(--border-color);
}

.user-menu-dropdown.show {
  display: block;
  animation: fadeInDown 0.2s ease forwards;
}

/* Table Header Specific Styles */
.pairs-table th,
.trades-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Allow specific header to wrap */
.pairs-table th[data-col="Suggested Allocation"] {
  white-space: normal;
  min-width: 80px;
  word-wrap: break-word;
  vertical-align: top;
}

/* Responsive Table Styles (Card View on Mobile) */
@media screen and (max-width: 768px) {
  .pairs-table,
  .trades-table {
    border: 0;
  }

  .pairs-table thead,
  .trades-table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }

  .pairs-table tr,
  .trades-table tr {
    display: block;
    margin-bottom: .625em;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background-color: var(--card-bg);
  }

  .pairs-table td,
  .trades-table td {
    display: block;
    text-align: right;
    padding: .75em 1em;
    border-bottom: 1px dotted var(--border-color);
    position: relative;
    white-space: normal;
    max-width: none;
  }

  .pairs-table td::before,
  .trades-table td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8em;
    margin-right: 1em;
    color: var(--text-muted);
  }

  .pairs-table td:last-child,
  .trades-table td:last-child {
    border-bottom: 0;
  }

  /* Specific alignment for action button */
  .pairs-table td[data-label="Action"]::before,
  .trades-table td[data-label="Action"]::before {
    content: "";
  }

  .pairs-table td[data-label="Action"],
  .trades-table td[data-label="Action"] {
    text-align: center;
    padding-top: 1em;
    padding-bottom: 1em;
  }

  /* Adjust specific columns if needed */
  .pairs-table td.pair-symbol {
    font-weight: 600;
    max-width: 120px;
    padding: 8px 12px;
}

.pairs-table td.pair-symbol div:first-child {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.pairs-table td.pair-symbol .estimated-value {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: normal;
}
}

@media (max-width: 991.98px) {
  /* Ensure suggested pairs also adopt card view on tablets */
  .pairs-table.responsive-suggested-pairs {
    border: 0;
  }

  .pairs-table.responsive-suggested-pairs thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }

  .pairs-table.responsive-suggested-pairs tr {
    display: block;
    margin-bottom: .625em;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background-color: var(--card-bg);
  }

  .pairs-table.responsive-suggested-pairs td {
    display: block;
    text-align: right;
    padding: .75em 1em;
    border-bottom: 1px dotted var(--border-color);
    position: relative;
    white-space: normal;
    max-width: none;
  }

  .pairs-table.responsive-suggested-pairs td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8em;
    margin-right: 1em;
    color: var(--text-muted);
  }

  .pairs-table.responsive-suggested-pairs td:last-child {
    border-bottom: 0;
  }

  /* Specific alignment for action button */
  .pairs-table.responsive-suggested-pairs td[data-label="Action"]::before {
    content: "";
  }

  .pairs-table.responsive-suggested-pairs td[data-label="Action"] {
    text-align: center;
    padding-top: 1em;
    padding-bottom: 1em;
  }
}
