/* style.css */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
}

.header {
  background: #333;
  color: #fff;
  padding: 15px;
  text-align: center;
}

.container {
  width: 95%;
  max-width: 1300px;
  margin: 20px auto;
  background: #fff;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.button {
  display: inline-block;
  padding: 10px 20px;
  background: #4CAF50;
  color: white;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.button:hover {
  background: #45a049;
}

/* ======= LAYOUT – DWIE KOLUMNY ======= */

.main-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 20px;
}

.column-left,
.column-right {
  flex: 1;
}

.column-right {
  flex: 1.3;
}

@media (max-width: 1100px) {
  .main-layout {
    flex-direction: column;
  }
}

/* fallback tabela */

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.table th,
.table td {
  border: 1px solid #ddd;
  padding: 8px;
}

.table th {
  background: #f2f2f2;
  text-align: left;
}

/* === MATCHING PANEL === */

.matching-panel {
  max-width: 100%;
  margin: 0 0 20px;
  padding: 16px 20px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  font-size: 14px;
}

.matching-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.matching-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#match-timer {
  padding: 6px 14px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-weight: 600;
  font-family: monospace;
}

#cancel-all-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  transition: background 0.15s ease, transform 0.05s ease;
}

#cancel-all-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* === TABELA GŁÓWNA / USEROWA === */

.matching-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.matching-table thead {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
}

.matching-table th,
.matching-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
  white-space: nowrap;
  font-size: 13px;
}

.matching-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  background: #f3f4f6;
}

.matching-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.matching-table tbody tr:hover {
  background: #e5f3ff;
}

.matching-table th.instrument-col,
.matching-table td.instrument-col {
  text-align: left;
  font-weight: 600;
}

.matching-table th.price-col,
.matching-table td.price-col {
  text-align: right;
}

/* Size @10k – wyrównanie do prawej (gdybyś ją kiedyś przywrócił) */
.matching-table th.size10k-col,
.matching-table td.size10k-col {
  text-align: right;
  width: 110px;
}

/* YOUR BIDS / OFFERS – szerokość */
.matching-table th:nth-child(4),
.matching-table td:nth-child(4),
.matching-table th:nth-child(5),
.matching-table td:nth-child(5) {
  width: 80px;
}

/* tabele użytkownika */

.user-table th:first-child,
.user-table td:first-child {
  text-align: left;
}

.user-table td {
  font-size: 13px;
}

/* Przyciski */

.btn-pill {
  display: inline-block;
  min-width: 60px;
  padding: 3px 10px;
  border-radius: 999px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.1s ease;
}

.btn-pill:active {
  transform: translateY(1px);
}

.btn-bid {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(16,185,129,0.4);
}
.btn-bid:hover { background: #059669; }

.btn-offer {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(59,130,246,0.4);
}
.btn-offer:hover { background: #2563eb; }

.btn-cancel {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(239,68,68,0.4);
}
.btn-cancel:hover { background: #dc2626; }

/* pastylki Your bids / Your offers */

.tag-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: #e5e7eb;
  color: #111827;
}

.tag-counter.my-bid,
.tag-counter.my-offer {
  background: #ffcc80;   /* pastelowy pomarańcz */
  color: #111827;
  font-weight: bold;
}

/* SIZE input */

.size-input {
  width: 45px;
  max-width: 55px;
  padding: 2px 4px;
  font-size: 12px;
  text-align: right;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
}

.size-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f633;
}

/* wiersz z interestem */

.matching-table tbody tr.has-orders {
  background-color: #dcfce7;
}

/* animacje flash */

@keyframes flash-green {
  0%, 100% { background-color: #bbf7d0; }
  50%      { background-color: #22c55e; }
}

@keyframes flash-red {
  0%, 100% { background-color: #fee2e2; }
  50%      { background-color: #ef4444; }
}

.matching-table tbody tr.row-flash-green {
  animation: flash-green 0.6s ease-out 3;
}

.matching-table tbody tr.row-flash-red {
  animation: flash-red 1s ease-out 5;
}

/* ====== SPREAD PANEL ====== */

.spread-panel h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

/* wiersze formularza w panelu spreadów */
.spread-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.spread-col {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spread-col label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.spread-col select {
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
}

.spread-col select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f633;
}

.spread-result {
  font-size: 13px;
  color: #111827;
}

/* AUTH */

.auth-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f4f4f4;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  padding: 24px 28px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.auth-title {
  margin: 0 0 12px;
  font-size: 1.4rem;
  font-weight: 600;
  color: #111827;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 6px;
  font-size: 0.9rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 999px 999px 0 0;
  color: #6b7280;
}

.auth-tab-btn.active {
  background: #ffffff;
  border-bottom: 2px solid #4CAF50;
  color: #111827;
  font-weight: 600;
}

.auth-forms { margin-top: 8px; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-note { font-size: 0.8rem; color: #6b7280; margin-bottom: 8px; }
.auth-footer { margin-top: 14px; text-align: center; font-size: 0.8rem; color: #9ca3af; }

/* ORDER BOOK (mechanizm może zostać, widok nieużywany) */

.orderbook-panel {
  margin-top: 20px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.orderbook-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.orderbook-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.orderbook-caption {
  margin: 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.orderbook-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.orderbook-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.orderbook-table th,
.orderbook-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  white-space: nowrap;
}

.orderbook-table th {
  background: #f3f4f6;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.orderbook-table td:first-child {
  text-align: right;
}

.orderbook-table td:last-child {
  text-align: center;
  font-family: monospace;
  font-size: 0.78rem;
}

.orderbook-empty,
.orderbook-loading,
.ob-empty {
  font-size: 0.85rem;
  color: #6b7280;
  padding: 6px 0;
  text-align: center;
}


.matching-table td .tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Kolory w tabeli spreadów (wiersze w tabeli, NIE formularz) */
.spread-row.spread-buy .spread-direction {
  color: #0a7f00;
  font-weight: bold;
}

.spread-row.spread-sell .spread-direction {
  color: #b00020;
  font-weight: bold;
}

/* delikatne tło dla buy/sell */
.spread-row.spread-buy {
  background: #e8f5e9;
}

.spread-row.spread-sell {
  background: #ffebee;
}

/* Spread interests – kolorowanie Side (Bid/Offer) */

#spread-interests-table tbody tr.spread-int-buy td:nth-child(2) {
  color: #16a34a;   /* zielony */
  font-weight: 600;
}

#spread-interests-table tbody tr.spread-int-sell td:nth-child(2) {
  color: #2563eb;   /* niebieski */
  font-weight: 600;
}

/* Spread buttons: same colors as outright Bid / Offer */
.btn-bid-spread {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(16,185,129,0.4);
}

.btn-bid-spread:hover {
  background: #059669;
}

.btn-offer-spread {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(59,130,246,0.4);
}

.btn-offer-spread:hover {
  background: #2563eb;
}
