/* public/css/events.css */
/* Unique scope: .ffev */

.ffev {
  padding: 16px 0 28px;
}

.ffev-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 12px;
}

.ffev-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.ffev-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.ffev-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.ffev-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ffev-label {
  font-size: 12px;
  color: var(--muted);
}

.ffev-input {
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  outline: none;
}

.ffev-input:focus {
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .16);
  border-color: rgba(29, 78, 216, .45);
}

.ffev-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ffev-tablewrap {
  margin-top: 14px;
  padding: 0;
}

.ffev-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border-radius: var(--radius);
}


.ffev-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}

.ffev-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
}

.ffev-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  vertical-align: top;
}

.ffev-empty {
  padding: 16px 12px;
  color: var(--muted);
}

/* 7 columns */
.ffev-table th:nth-child(1),
.ffev-table td:nth-child(1) { width: 124px; }  /* Дата */

.ffev-table th:nth-child(3),
.ffev-table td:nth-child(3) { width: 330px; }  /* Компания */

.ffev-table th:nth-child(4),
.ffev-table td:nth-child(4) { width: 370px; }  /* Сектор */

.ffev-table th:nth-child(5),
.ffev-table td:nth-child(5) { width: 150px; }  /* Ожидание */

.ffev-table th:nth-child(6),
.ffev-table td:nth-child(6) { width: 180px; }  /* Реакция цены */

.ffev-table th:nth-child(7),
.ffev-table td:nth-child(7) { width: 160px; }  /* Факт */

.ffev-td-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

.ffev-td-ticker,
.ffev-td-sector {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ffev-td-num {
  text-align: left;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}

.ffev-td-title {
  min-width: 250px;
  max-width: none;
}

.ffev-title-main {
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

.ffev-title-sub {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.3;
}

/* ===== fact/expectation cells ===== */

.ffev-fact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.ffev-fact-main {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  white-space: nowrap;
}

.ffev-fact-sub {
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

/* price move */
.ffev-move {
  font-weight: 600;
  white-space: nowrap;
}

.ffev-move-up { color: #16a34a; }
.ffev-move-down { color: #dc2626; }
.ffev-move-flat { color: var(--muted); }

/* generic signal chip */
.ffev-signal {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  border: 1px solid rgba(15, 23, 42, .12);
}

.ffev-signal-up {
  background: #ecfdf5;
  color: #065f46;
  border-color: rgba(6, 95, 70, .18);
}

.ffev-signal-down {
  background: #fef2f2;
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, .18);
}

.ffev-signal-neutral {
  background: #f8fafc;
  color: #475569;
  border-color: rgba(71, 85, 105, .16);
}

/* anomaly badge */
.ffev-anom {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  border: 1px solid rgba(15, 23, 42, .12);
}

.ffev-anom-up {
  background: #ecfdf5;
  color: #065f46;
  border-color: rgba(6, 95, 70, .18);
}

.ffev-anom-down {
  background: #fef2f2;
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, .18);
}

.ffev-anom-zero {
  background: #fff7ed;
  color: #7c2d12;
  border-color: rgba(124, 45, 18, .18);
}

/* row highlight for anomalies */
.ffev-table tr.ffev-row-anom-up td {
  background: rgba(16, 185, 129, 0.08);
}

.ffev-table tr.ffev-row-anom-down td {
  background: rgba(239, 68, 68, 0.08);
}

.ffev-table tr.ffev-row-anom-neutral td {
  background: rgba(245, 158, 11, 0.08);
}

.ffev-table tr.ffev-row-anom-up:hover td {
  background: rgba(16, 185, 129, 0.12);
}

.ffev-table tr.ffev-row-anom-down:hover td {
  background: rgba(239, 68, 68, 0.12);
}

.ffev-table tr.ffev-row-anom-neutral:hover td {
  background: rgba(245, 158, 11, 0.12);
}

/* Responsive */
@media (max-width: 1100px) {
  .ffev-table {
    min-width: 860px;
  }

  .ffev-table th:nth-child(4),
  .ffev-table td:nth-child(4) { width: 150px; }

  .ffev-table th:nth-child(5),
  .ffev-table td:nth-child(5) { width: 140px; }

  .ffev-table th:nth-child(7),
  .ffev-table td:nth-child(7) { width: 150px; }
}

@media (max-width: 980px) {
  .ffev-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .ffev-table {
    min-width: 760px;
  }

  .ffev-table th:nth-child(4),
  .ffev-table td:nth-child(4) { width: 130px; }  /* Сектор */

  .ffev-table th:nth-child(5),
  .ffev-table td:nth-child(5) { width: 130px; }  /* Ожидание */

  .ffev-table th:nth-child(6),
  .ffev-table td:nth-child(6) { width: 120px; }  /* Реакция */
}

@media (max-width: 640px) {
  .ffev {
    padding: 12px 0 24px;
  }

  .ffev-table {
    min-width: 640px;
  }

  .ffev-table th,
  .ffev-table td {
    padding: 12px 10px;
  }

  .ffev-table th:nth-child(1),
  .ffev-table td:nth-child(1) { width: 110px; }

  .ffev-table th:nth-child(3),
  .ffev-table td:nth-child(3) { width: 330px; }

  .ffev-table th:nth-child(4),
  .ffev-table td:nth-child(4) { display: none; } /* Сектор */

  .ffev-table th:nth-child(5),
  .ffev-table td:nth-child(5) { width: 120px; }

  .ffev-table th:nth-child(6),
  .ffev-table td:nth-child(6) { width: 110px; }

  .ffev-table th:nth-child(7),
  .ffev-table td:nth-child(7) { width: 140px; }

  .ffev-td-title {
    min-width: 220px;
  }

  .ffev-title-main {
    font-size: 15px;
    line-height: 1.3;
  }

  .ffev-title-sub,
  .ffev-fact-sub {
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .ffev-title {
    font-size: 20px;
  }

  .ffev-grid {
    grid-template-columns: 1fr;
  }

  .ffev-table {
    min-width: 560px;
  }

  .ffev-table th:nth-child(1),
  .ffev-table td:nth-child(1) { width: 96px; }

  .ffev-table th:nth-child(3),
  .ffev-table td:nth-child(3) { width: 78px; }

  .ffev-table th:nth-child(5),
  .ffev-table td:nth-child(5) { display: none; } /* Ожидание */

  .ffev-table th:nth-child(6),
  .ffev-table td:nth-child(6) { width: 100px; }

  .ffev-table th:nth-child(7),
  .ffev-table td:nth-child(7) { width: 128px; }

  .ffev-td-title {
    min-width: 200px;
  }

  .ffev-anom,
  .ffev-signal {
    font-size: 10px;
    padding: 2px 6px;
    height: auto;
    line-height: 1.2;
  }
}

@media (max-width: 720px) {
  .wrap {
    padding: 16px 16px;
  }

  .ffev-card {
    padding: 10px;
  }
}