/* FinTracker — css/views.css
 * History / Analytics / Configure views, including the collapsible Filters page sections.
 * Part of the styles.css split — see CLAUDE.md "Module map". Loaded via multiple
 * <link> tags in the same cascade order as the original single file. */

/* ============ Views (History / Analytics / Configure) ============ */
.view-header { margin-bottom: 14px; }
.view-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--navy-soft);
  box-shadow: var(--shadow);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.filter-chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
@media (hover: hover) and (pointer: fine) {
  .filter-chip:not(.is-active):hover { border-color: #d7dce3; }
}

/* ---- History: date range / search / filters / summary ---- */
.history-daterange-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}
.history-daterange-btn > svg:first-child { color: var(--green-dark); flex-shrink: 0; }
.history-daterange-btn span { flex: 1; text-align: left; }
.history-daterange-chevron { flex: 0 0 auto !important; color: var(--navy-soft); }

.history-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.history-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
.history-search svg { color: var(--navy-soft); flex-shrink: 0; }
.history-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--navy);
}
.history-search input:focus { outline: none; }
.history-search input::placeholder { color: #a8afbd; }

.history-filters-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--navy);
  flex-shrink: 0;
}
.history-filters-btn svg { color: var(--navy-soft); }
.history-filters-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px #fff;
}
.history-filters-dot[hidden] { display: none; }

.history-summary {
  display: flex;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 6px;
  margin-bottom: 18px;
}
.history-summary__item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  padding: 0 6px;
  border-left: 1px solid var(--border);
}
.history-summary__item:first-child { border-left: none; }
.history-summary__label { font-size: 0.7rem; font-weight: 600; color: var(--navy-soft); }
.history-summary__value { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.history-summary__value--total { color: var(--red); }
.history-summary__value--fixed { color: var(--blue); }
.history-summary__value--variable { color: var(--green); }
.history-summary__count { font-size: 0.66rem; color: var(--navy-soft); }

/* ---- History: day groups & items ---- */
.history-group { margin-bottom: 18px; }
.history-group__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 8px;
  background: none;
  border: none;
}
.history-group__date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--navy-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.history-group__date svg { color: var(--green); flex-shrink: 0; }
.history-group__total {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--red);
}
.history-group__chevron { color: var(--navy-soft); transition: transform 0.2s ease; }
.history-group__header.is-open .history-group__chevron { transform: rotate(180deg); }
.history-items {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.history-items[hidden] { display: none; }
.history-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  transition: background 0.15s ease;
}
.history-item:last-child { border-bottom: none; }
.history-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-item__icon svg { width: 22px; height: 22px; }
.history-item__icon img { width: 26px; height: 26px; object-fit: contain; }
.history-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.history-item__title {
  font-weight: 500;
  font-size: 0.85rem;
  margin-top: 0.2rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.history-item__meta-text {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--navy-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item__fixed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa1b0;
  flex-shrink: 0;
}
.history-item__note-icon {
  display: inline-flex;
  align-items: center;
  color: var(--navy-soft);
  flex-shrink: 0;
}
.history-item__amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}
.history-item__amount.is-expense { color: var(--red); }
.history-item__amount.is-income { color: var(--green); }
.history-empty {
  text-align: center;
  color: var(--navy-soft);
  padding: 48px 16px;
  font-size: 0.92rem;
}
@media (hover: hover) and (pointer: fine) {
  .history-item:hover { background: rgba(30,42,69,0.03); cursor: pointer; }
  .history-group__header:hover .history-group__date { color: var(--navy); }
}

/* ---- Analytics ---- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat-tile {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-tile__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--navy-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-tile__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--navy);
  word-break: break-word;
}
.stat-tile--expense .stat-tile__value { color: var(--red); }
.stat-tile--income .stat-tile__value { color: var(--green); }

.bar-list {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 6px 16px;
}
.bar-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.bar-item:last-child { border-bottom: none; }
.bar-item__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.bar-item__label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-item__value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.bar-item__track {
  height: 7px;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}
.bar-item__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--green);
}
.bar-list-empty {
  text-align: center;
  color: var(--navy-soft);
  padding: 24px 0;
  font-size: 0.88rem;
}

/* ---- Configure ---- */
.config-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.config-section__title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 10px;
}
.config-hint {
  font-size: 0.84rem;
  color: var(--navy-soft);
  line-height: 1.5;
  margin: 0 0 12px;
}
.config-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.config-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f7f8fa;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.config-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--navy-soft);
}
.config-btn--danger .config-btn__icon { color: var(--red); }
.config-btn--danger { color: var(--red); }
.config-btn.is-active { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }
@media (hover: hover) and (pointer: fine) {
  .config-btn:hover { background: #eef1f5; border-color: #d7dce3; }
  .config-btn--danger:hover { background: var(--red-light); border-color: #f3c9c9; }
}
.config-stat {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--navy-soft);
  text-align: center;
}

/* ---- Edit transaction form (inside bottom sheet) ---- */
.edit-form { display: flex; flex-direction: column; gap: 12px; }
.edit-field { display: flex; flex-direction: column; gap: 6px; }
.edit-field__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--navy-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.edit-field__input,
.edit-field__select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f7f8fa;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--navy);
}
.edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit-type-toggle { display: flex; gap: 8px; }
.edit-type-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #f7f8fa;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--navy-soft);
}
.edit-type-btn.is-active.is-expense { border-color: var(--red); background: var(--red-light); color: var(--red); }
.edit-type-btn.is-active.is-income { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }
.edit-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.edit-delete-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--red-light);
  color: var(--red);
  font-weight: 600;
  font-size: 0.92rem;
}
@media (hover: hover) and (pointer: fine) {
  .edit-delete-btn:hover { background: #fcdcdc; }
}

.sheet__body { overflow-y: auto; flex: 1; }
.sheet__list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; cursor: pointer; }
.sheet__list li:last-child { border-bottom: none; }
.sheet__list .empty { text-align: center; color: var(--navy-soft); padding: 30px 0; cursor: default; }

