/* style.css - Profesjonalny arkusz stylów OLED Dark dla aplikacji 4 Indeksy PRO (PWA) */

:root {
  --bg-primary: #0b0e14;
  --bg-secondary: #121722;
  --bg-card: #181f2e;
  --bg-card-hover: #1e273a;
  --border-color: #232d3f;
  --border-focus: #3b82f6;

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --color-tp: #10b981;
  --color-tp-bg: rgba(16, 185, 129, 0.12);
  --color-sl: #ef4444;
  --color-sl-bg: rgba(239, 68, 68, 0.12);

  --accent-gold: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bottom-nav-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  padding-bottom: calc(var(--bottom-nav-height) + 24px);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   1. NAGŁÓWEK APLIKACJI (TOP APP BAR)
   ========================================================================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.1;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--bg-card-hover);
}

/* Pasek statusu rynku */
.market-status-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.market-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--color-tp);
  box-shadow: 0 0 8px var(--color-tp);
}

.status-dot.offline {
  background-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

.market-timer {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2. KONTENER GŁÓWNY I ZAKŁADKI (TAB PANES)
   ========================================================================== */
.main-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 14px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.section-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Paski filtrów (Pills / Chips) */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

/* ==========================================================================
   3. KARTY ALERTÓW (ZAKŁADKA 1)
   ========================================================================== */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.alert-card.entry {
  border-color: var(--color-tp);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.15);
}

.alert-card.hot {
  border-color: var(--accent-gold);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

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

.inst-icon {
  font-size: 20px;
}

.inst-name {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.inst-full {
  font-size: 11px;
  color: var(--text-muted);
}

.badge-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-status.entry {
  background: var(--color-tp-bg);
  color: var(--color-tp);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-status.hot {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-status.warm {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.badge-status.cold {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

/* Cena i setup */
.card-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.card-price {
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
}

.card-indicators {
  display: flex;
  gap: 8px;
  font-size: 12px;
}

.ind-pill {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 600;
}

.ind-pill.hit {
  border-color: var(--color-tp);
  color: var(--color-tp);
}

/* Poziomy zlecenia SL/TP */
.order-levels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.level-box {
  display: flex;
  flex-direction: column;
}

.level-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.level-val {
  font-size: 15px;
  font-weight: 800;
}

.level-val.sl { color: var(--color-sl); }
.level-val.tp { color: var(--color-tp); }

/* Pasek postępu setupu */
.progress-wrap {
  margin-bottom: 12px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-blue), var(--color-tp));
  transition: width 0.4s ease;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions button {
  width: 100%;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ==========================================================================
   4. ZAKŁADKA WYKRESÓW (LIGHTWEIGHT-CHARTS)
   ========================================================================== */
.chart-container-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chart-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.chart-box {
  width: 100%;
  height: 380px;
  border-radius: 10px;
  overflow: hidden;
  background: #121722;
}

/* ==========================================================================
   5. KALKULATOR RYZYKA I WIELKOŚCI POZYCJI (ZAKŁADKA 3)
   ========================================================================== */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-control, select.form-control {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--border-focus);
}

.btn-risk-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.btn-risk {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 7px 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-risk.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.calc-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.res-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.res-card.highlight {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
}

.res-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.res-val {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin-top: 4px;
}

.res-card.highlight .res-val {
  color: var(--accent-gold);
}

/* ==========================================================================
   6. ZAKŁADKA STATYSTYK I HISTORIA (ZAKŁADKA 4)
   ========================================================================== */
.stats-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
}

.stat-box-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-box-metric {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  margin: 4px 0 2px;
}

.stat-box-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.history-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.trades-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.trades-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.trades-table tr:hover {
  background: var(--bg-card-hover);
}

.win-badge {
  background: var(--color-tp-bg);
  color: var(--color-tp);
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
}

.loss-badge {
  background: var(--color-sl-bg);
  color: var(--color-sl);
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
}

/* ==========================================================================
   7. ZAKŁADKA OPCJI, PUSH I TELEGRAM (ZAKŁADKA 5)
   ========================================================================== */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.settings-card .subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.helper-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Przyciski */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  font-weight: 700;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:active {
  background: #1d4ed8;
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 700;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
}

.btn-secondary:active {
  background: var(--bg-card-hover);
}

.full-width {
  width: 100%;
}

/* ==========================================================================
   8. DOLNY PASEK NAWIGACJI (BOTTOM NAV BAR)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: rgba(11, 14, 20, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.nav-icon {
  font-size: 19px;
  line-height: 1;
  margin-bottom: 3px;
  transition: transform 0.2s;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active {
  color: #fff;
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

.nav-item.active .nav-label {
  color: var(--accent-blue);
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: 25%;
  background-color: var(--color-sl);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ==========================================================================
   9. MODAL I DYMEK TOAST
   ========================================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(18, 23, 34, 0.95);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 92%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 310;
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.chart-modal-dialog {
  max-width: 96vw;
  width: 96%;
  padding: 14px;
}

.chart-modal-img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.chart-img-view {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  border: 1px solid var(--border-color);
  background: #131722;
}

.chart-img-wrapper {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
}

.chart-overlay-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(19, 23, 34, 0.88);
  border: 1px solid var(--border-color);
  color: #29b6f6;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}
