/* stats.css - стили для раздела "Статистика" */

/* Сообщение об отсутствии данных */
.no-data {
  text-align: center;
  color: #a6b1c2;
  padding: 20px;
  font-style: italic;
}

#stats-page {
  padding: 24px 12px 64px 12px;
  max-width: 600px;
  margin: 0 auto;
  background: #23272f;
  min-height: 100vh;
}

#stats-page h2 {
  text-align: center;
  margin-bottom: 24px;
  color: #a6b1c2;
  font-size: 1.4em;
  font-weight: 600;
}

.stats-block {
  margin-bottom: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  background: #353942;
  padding: 0 0 16px 0;
}

.stats-block.income .stats-header {
  background: linear-gradient(90deg, #b6f5c2 0%, #e0ffe6 100%);
  color: #1a7f3c;
}
.stats-block.expense .stats-header {
  background: linear-gradient(90deg, #ffd6d6 0%, #fff0f0 100%);
  color: #b71c1c;
}
.stats-header {
  font-weight: bold;
  font-size: 1.1em;
  padding: 14px 18px;
  border-radius: 16px 16px 0 0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-header-text {
  flex: 1;
}

.stats-group-btn {
  background: none;
  border: none;
  color: #a6b1c2;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.stats-group-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #f5f6fa;
}

.stats-group-btn.active {
  opacity: 1;
  color: #e15f10;;
  background: rgba(76, 175, 80, 0.1);
}

.stats-group-btn.active svg {
  transform: rotate(180deg);
}

.stats-group-label {
  font-size: 0.75em;
  color: #a6b1c2;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.stats-categories {
  padding: 0 12px;
}

.stats-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #444a56;
  border-radius: 4px;
  margin-bottom: 4px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: background 0.2s;
  color: #f5f6fa;
}
/* Убираем hover эффект для строк категорий */
.stats-category-row:hover {
  background: #444a56 !important;
}
.stats-category-name {
  flex: 1 1 60%;
  font-weight: 500;
}

.stats-category-count {
  display: inline-block;
  background: #5d5e5d;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  font-size: 0.8em;
  font-weight: bold;
  margin-left: 8px;
  vertical-align: middle;
}
.stats-category-sum {
  flex: 0 0 auto;
  font-weight: 600;
  margin-left: 12px;
}
.stats-category-bar {
  height: 4px;
  border-radius: 2px;
  background: #555b67;
  margin: 0 8px;
  flex: 1 1 20%;
  min-width: 40px;
  position: relative;
  overflow: hidden;
}

.stats-category-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--progress-width, 0%);
  background: linear-gradient(90deg, #4CAF50, #66BB6A);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.stats-category-percent {
  flex: 0 0 auto;
  font-size: 0.95em;
  color: #a6b1c2;
  margin-left: 8px;
}

.stats-ops-list {
  margin: 8px 0 16px 0;
  background: #2e323a;
  border-radius: 8px;
  padding: 8px;
  /* border-left: 3px solid #5921f5; */
  /* box-shadow: 0 1px 3px rgba(0,0,0,0.2); */
}
.stats-op-row {
  font-size: 0.9em;
  color: #a6b1c2;
  margin-bottom: 4px;
  padding: 3px 0;
  border-bottom: 1px solid #444a56;
}

.stats-op-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Стили для операций в статистике (аналогично operations.css) */
.stats-ops-list .operation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px dotted #555;
  width: 98%;
  font-size: 0.99em;
  cursor: pointer;
  transition: background 0.15s;
  flex-wrap: nowrap;
}

/* Убираем hover эффект для операций в статистике */
.stats-ops-list .operation-row:hover {
  background: #2e323a !important;
  border-radius: 0 !important;
}

.stats-ops-list .operation-row:last-child {
  border-bottom: none;
}

.stats-ops-list .operation-left {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-right: 12px;
  overflow: hidden;
}

.stats-ops-list .operation-main-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
  overflow: hidden;
}

.stats-ops-list .operation-desc {
  flex: 1;
  color: #a6b1c2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-ops-list .operation-account {
  /*font-weight: 600;*/
  /*color: #f5f6fa;*/
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: visible;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 65%;
  font-size: 11px;
  color: #e8eaeb;
  text-transform: capitalize;
}

.stats-ops-list .operation-who-small {
  user-select: none;
  opacity: 0.7;
  font-size: 1em;
  color: #8c96a7;
}

.stats-ops-list .operation-sum {
  min-width: 80px;
  text-align: right;
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
}

.stats-ops-list .operation-sum.income {
  color: #44bd32;
}

.stats-ops-list .operation-sum.expense {
  color: #e84118;
}

.stats-ops-list .operation-account .account-color-indicator {
  width: 7px;
  height: 7px;
  margin-right: 4px;
}

.stats-month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  margin-bottom: 20px;
  background: #353942;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.stats-month-btn {
  background: #444a56;
  border: none;
  border-radius: 8px;
  font-size: 1.2em;
  color: #a6b1c2;
  margin: 0 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 40px;
}
.stats-month-btn:hover {
  color: #f5f6fa;
  background: #555b67;
  transform: translateY(-1px);
}
.stats-month-label {
  font-weight: bold;
  font-size: 1.1em;
  color: #a6b1c2;
  min-width: 120px;
  text-align: center;
} 

@media (max-width: 500px) {

  .stats-month-nav {
    font-size: 14px;
    padding: 15px 0;
  }
  .stats-categories {
    padding: 0 7px;
    margin-top: 11px;
    font-size: 12px;
  }

  .stats-header {
    padding: 10px 18px;
    font-size: 0.85em;
    gap: 8px;
  }

  .stats-group-label {
    font-size: 0.7em;
  }

  .stats-group-btn {
    min-width: 28px;
    height: 28px;
    padding: 4px;
  }

  .stats-grouped-op {
    padding: 10px 12px;
  }

  .stats-grouped-op-desc {
    font-size: 0.9em;
  }

  .stats-grouped-op-count {
    font-size: 0.7em;
  }

  .stats-grouped-op-sum {
    font-size: 0.95em;
    min-width: 70px;
  }

  .stats-grouped-ops-details {
    margin-left: 12px;
    padding: 8px;
  }

  .stats-grouped-ops-details .operation-row {
    font-size: 0.8em;
    padding: 6px 8px;
  }

.stats-category-name {
  flex: 1 1 90%;
  font-weight: 450;
  padding: 0px;
  height: 15px;
}
.stats-category-row {
  padding: 9px 8px;
}
#stats-page {
  padding: 15px 5px 35px 5px;
  max-width: 600px;
  margin: 0;
}
#stats-page h2 {
  text-align: center;
  margin: 45px 10px 20px 10px;
  font-size: 1em;
}
  .stats-ops-list .operation-main-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
    /*margin: 6px;*/
    overflow: hidden;
    font-size: 12px; /* было 10px, увеличиваем на 2px */

  }

  @media (max-width: 300px) {
    .stats-categories {
        padding: 0 7px;
        margin-top: 11px;
        font-size: 9px;
    }
}
}

/* Стили для группированных операций */
.stats-grouped-op {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 3px;
  border-bottom: 1px solid #444a56;
  cursor: pointer;
  transition: all 0.2s;
  /* background: #3a3f4a; */
  margin-bottom: 0;
  position: relative;
}

.stats-grouped-op:hover {
  background: #444a56;
  transform: translateX(2px);
  border-radius: 5px;
}

.stats-grouped-op:last-child {
  border-bottom: none;
}

.stats-grouped-op-left {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-right: 16px;
  gap: 4px;
}

.stats-grouped-op-desc {
  font-weight: 600;
  color: #f5f6fa;
  font-size: 0.95em;
  line-height: 1.2;
}

.stats-grouped-op-count {
  font-size: 0.75em;
  color: #8c96a7;
  font-weight: 500;
}

.stats-grouped-op-sum {
  font-weight: 700;
  font-size: 1.05em;
  color: #e84118;
  text-align: right;
  min-width: 80px;
}

.stats-grouped-op-sum.income {
  color: #44bd32;
}

.stats-grouped-ops-details {
  /* margin-left: 20px; */
  margin-top: 8px;
  padding-left: 7px;
  border-left: 1px solid #797575;
  /* background: #2e323a; */
  /* border-radius: 0 0 8px 8px; */
  /* padding: 12px; */
  margin-bottom: 15px;
}

.stats-grouped-ops-details .operation-row {
  font-size: 0.85em;
  padding: 3px 12px;
  margin-bottom: 4px;
  /* background: #353942; */
  /* border-radius: 4px; */
  /* border: 1px solid #444a56; */
}

.stats-grouped-ops-details .operation-row:last-child {
  margin-bottom: 0;
}

/* Стили для заголовков дат в обычном режиме */
.date-label {
  font-weight: 600;
  color: #a6b1c2;
  padding: 8px 10px 4px 10px;
  font-size: 0.9em;
  border-bottom: 1px solid #444a56;
  margin-bottom: 4px;
}

@media (max-width: 500px) {
  .stats-grouped-ops-details {
    margin-left: 5px;
    /* padding: 8px; */
  }

  .stats-grouped-ops-details .operation-row {
    font-size: 0.8em;
    padding: 6px 8px;
  }
}

