/* Base styles and variables */,
:root {
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #3498db;
  --success-color: #2ecc71;
  --warning-color: #f1c40f;
  --error-color: #e74c3c;
  --background-color: #f8f9fa;
  --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --bid-color: #28a745;
  --ask-color: #dc3545;
  --spread-color: #6c757d;
  --header-bg: #343a40;
}

body {
  background-color: var(--background-color);
  color: var(--primary-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 1rem;
}

/* Navigation tabs */
.nav-tabs {
  border-bottom: 2px solid var(--accent-color);
  background-color: white;
  padding: 0.5rem 1rem 0;
  margin-bottom: 2rem;
}

.nav-tabs .nav-link {
  color: var(--secondary-color);
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
}

.nav-tabs .nav-link:hover {
  color: var(--accent-color);
  background-color: rgba(52, 152, 219, 0.1);
}

.nav-tabs .nav-link.active {
  color: var(--accent-color);
  border: none;
  border-bottom: 2px solid var(--accent-color);
  background-color: transparent;
}

/* Content areas */
.tab-content {
  background: white;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}

.tab-pane {
  animation: fadeIn 0.3s ease-in;
}

/* Tables and inputs */
table {
  width: 100%;
  max-width: 800px;
  margin: 1rem 0;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9rem;
}

td {
  padding: 0.5rem 1rem;
  vertical-align: middle;
}

td:not(:first-child) {
  text-align: right;
}

/* Style for limit trader info */
.trading-components {
  display: flex;
  gap: 20px;
  margin: 20px 0;
width: 100%;
}

.trading-panel {
  flex: 1;
  min-width: 0; /* Prevents flex item from overflowing */
  background: white;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 20px;
}

.trading-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.limit-trader-info {
  width: 100%;
}

.limit-trader-info table {
  margin: 0;
  width: auto;
  min-width: 300px;
}

.limit-trader-info th {
  color: var(--spread-color);
  font-weight: bold;
  padding: 8px 15px;
  text-align: right;
}

.limit-trader-info th:first-child {
  text-align: left;
}

.limit-trader-info tr:hover {
  background: rgba(0,0,0,0.05);
}

.limit-trader-info td {
  border-top: 1px solid #dee2e6;
}

.limit-trader-info td:first-child {
  font-weight: 500;
  color: var(--primary-color);
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Buttons */
button {
  background-color: #3498db;
  color: white;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  background-color: #2980b9;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Utility classes */
.inline {
  display: inline-block;
  margin-right: 1rem;
}

.border {
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1rem;
}

.highlight {
  background-color: rgba(52, 152, 219, 0.1);
  border-radius: 4px;
}

/* Logs section */
#logs {
  margin-top: 2rem;
}

.log-section {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  box-shadow: var(--card-shadow);
}

#logs_error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--error-color);
}

#logs_warning {
  background-color: #fef3c7;
  color: #92400e;
  border-left: 4px solid var(--warning-color);
}

#logs_info {
  background-color: #e0f2fe;
  color: #075985;
  border-left: 4px solid var(--accent-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }
  
  .nav-tabs {
    padding: 0.25rem 0.5rem 0;
  }
  
  .nav-tabs .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .tab-content {
    padding: 1rem;
  }
  
  table {
    display: block;
    overflow-x: auto;
  }
  
  td {
    padding: 0.5rem;
  }
  
  input[type="text"],
  input[type="number"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* OrderBook styles */
.orderbook-info {
  flex: 1;
  margin: 0; /* Remove default margin since we're using gap */
  min-width: 0; /* Prevents flex item from overflowing */
}

.orderbook-container {
  flex: 1;
  margin: 0; /* Remove default margin since we're using gap */
  min-width: 0; /* Prevents flex item from overflowing */
}

.orderbook-header {
    background: var(--header-bg);
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
}

.orderbook-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.orderbook-subheader {
    display: flex;
    justify-content: space-between;
    color: #adb5bd;
    font-size: 0.9rem;
    margin-top: 5px;
}

.orderbook-content {
    padding: 15px;
}

.orderbook-headers {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 8px 15px;
    font-weight: bold;
    border-bottom: 1px solid #dee2e6;
    color: var(--spread-color);
text-align: right;
}

.orderbook-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 4px 15px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
text-align: right;
}

.orderbook-row:hover {
    background: rgba(0,0,0,0.05);
}

.ask-row {
    color: var(--ask-color);
}

.bid-row {
    color: var(--bid-color);
}

.price-ask {
    color: var(--ask-color);
}

.price-bid {
    color: var(--bid-color);
}

.orderbook-spread {
  text-align: center;
  padding: 10px;
  background: #f8f9fa;
  color: var(--spread-color);
  font-weight: bold;
  border-top: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
}

.orderbook-asks {
  margin-bottom: 10px;
}

.orderbook-bids {
  margin-top: 10px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .trading-components {
    flex-direction: column;
  }
  
  .limit-trader-info,
  .orderbook-container {
    width: 100%;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes highlightValue {
  0% { background-color: transparent; }
  20% { background-color: rgba(52, 152, 219, 0.3); }
  100% { background-color: transparent; }
}

.highlight-change {
  animation: highlightValue 1s ease-out;
}

.highlight-order {
  background-color: rgba(241, 196, 15, 0.3); /* Using warning-color with low opacity */
}
