/* =============================================
   DASHBOARD COMPONENTS STYLES
   ============================================= */

/* --- GENERAL STATS BOX: Cards in single row --- */
.dashboard-cards-row {
  display: flex;
  flex-wrap: wrap;
}
.dashboard-cards-row > .col-2 {
  display: flex;
  flex-direction: column;
}
.dashboard-cards-row .stat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 140px;
}

@media (max-width: 1199px) {
  .dashboard-cards-row > .col-2 {
    flex: 0 0 33.333% !important;
    max-width: 33.333% !important;
  }
}
@media (max-width: 767px) {
  .dashboard-cards-row > .col-2 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
}
@media (max-width: 575px) {
  .dashboard-cards-row > .col-2 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .dashboard-cards-row .stat-card {
    min-height: auto;
  }
}

/* =============================================
   GENDER DISTRIBUTION BOX
   ============================================= */

.gender-stat-chart-outer {
  display: flex;
  gap: 2rem;
  padding: 1.5rem;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 20px;
  max-width: 800px;
  margin: 0 auto;
}

/* --- TABLE --- */
.gender-stat-table-panel {
  flex: 1;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.gender-stat-table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 12px;
  margin-bottom: 6px;
}
.gender-stat-table-row:hover {
  background-color: #f8fafc;
  transform: translateX(2px);
}
.gender-stat-table-row.active {
  background-color: #f1f5f9;
  font-weight: 600;
}

.gender-table-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}
.gender-table-icon-i {
  font-size: 1.1rem;
  color: #fff;
}

.gender-stat-table-category-name {
  font-size: 0.95rem;
  color: #64748b;
  font-weight: 500;
  flex-grow: 1;
}
.gender-stat-table-row.active .gender-stat-table-category-name {
  color: #0f172a;
}

.gender-stat-table-category-value {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-left: 10px;
  font-variant-numeric: tabular-nums;
}

/* --- CHART --- */
.gender-stat-chart-panel {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 auto;
}
.gender-chart-root-block {
  position: relative;
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.05));
}

.gender-chart-path-segment {
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 50% 50%;
  cursor: pointer;
  stroke: #fff;
  stroke-width: 3px;
}
.gender-chart-path-segment:hover {
  opacity: 0.9 !important;
  transform: scale(1.03);
}

/* --- CENTER ICON --- */
.gender-chart--icon-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
  pointer-events: none;
}

.gender-center-icon-circle {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background-color: #ffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s ease;
}

.gender-center-icon-i {
  font-size: 1.3rem !important;
  color: #2B3034 !important;
}

.gender-stat-slider-text-container {
  margin-top: 10px;
  text-align: center;
}
.gender-pfm-category-title {
  font-size: 1rem;
  font-weight: 600;
}

@media (max-width: 991px) {
  .gender-stat-chart-outer {
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
  }
  .gender-stat-table-panel {
    width: 100%;
  }
}

/* =============================================
   VULNERABILITY DISTRIBUTION BOX
   ============================================= */

.vuln-stats-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1rem;
  padding: 1.5rem;
  min-height: 300px;
  height: 300px;
  box-sizing: border-box;
}

.vuln-stat-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
  border: 1px solid #f1f5f9;
  height: 100%;
  margin: 0;
}

.vuln-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.vuln-stat-icon-box {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.25rem;
  flex-shrink: 0;
}
.vuln-stat-icon-box i {
  font-size: 1.3rem;
  color: #fff;
}

.vuln-stat-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.vuln-stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.vuln-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.vuln-stat-percentage {
  font-size: 1rem;
  font-weight: 700;
  color: #FF8500;
  line-height: 1;
}

.vuln-stat-label {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 0.5rem;
  line-height: 1.3;
  word-break: break-word;
  max-width: 100%;
}

@media (max-width: 767px) {
  .vuln-stats-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    min-height: 0;
  }
  .vuln-stat-card {
    min-height: 120px;
  }
}

/* =============================================
   MONTHLY STATS BOX
   ============================================= */

.monthly-tabs-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}
.monthly-tab-btn {
  color: #333;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 8px;
  background-color: #fff;
  border: 1px solid #ddd;
  transition: all 0.2s ease;
  cursor: pointer;
}
.monthly-tab-btn:hover {
  background-color: #f5f5f5;
  border-color: #bbb;
}
.monthly-tab-btn.active {
  background-color: #2d3436;
  color: white;
  border-color: #2d3436;
}

/* =============================================
   TOP LISTS BOX
   ============================================= */

.top-list-card {
  background: white;
  border-radius: 20px;
  padding: 20px 10px 20px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
  height: 100%;
  transition: all 0.3s ease;
}

.top-list-card:hover {
  box-shadow: 0 12px 32px rgba(247, 103, 7, 0.15);
  transform: translateY(-2px);
}

.top-list-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  padding-right: 10px;
}

.top-list-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #f76707 0%, #ff8500 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: white;
  flex-shrink: 0;
}

.top-list-icon i {
  font-size: 16px;
}

.top-list-title {
  font-size: 16px;
  font-weight: 700;
  color: #2d3436;
}

/* Scroll Container */
.top-list-container {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 6px;
}

/* Custom Scrollbar */
.top-list-container::-webkit-scrollbar {
  width: 4px;
}
.top-list-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}
.top-list-container::-webkit-scrollbar-thumb {
  background: #ffbd8a;
  border-radius: 10px;
}
.top-list-container::-webkit-scrollbar-thumb:hover {
  background: #f76707;
}

/* Compact variant — used by the oblast list next to the map */
.oblast-list-card .top-list-item {
  padding: 6px 4px;
}
.oblast-list-card .top-list-rank {
  font-size: 10px;
  width: 18px;
}
.oblast-list-card .top-list-pie-wrapper {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}
.oblast-list-card .top-list-pie-svg {
  width: 22px;
  height: 22px;
}
.oblast-list-card .top-list-pie-bg,
.oblast-list-card .top-list-pie-fill {
  stroke-width: 4.5;
}
.oblast-list-card .top-list-content {
  margin-left: 8px;
}
.oblast-list-card .top-list-name {
  font-size: 12px;
  font-weight: 600;
}
.oblast-list-card .top-list-percent {
  font-size: 10px;
}
.oblast-list-card .top-list-value {
  font-size: 12px;
  font-weight: 700;
  margin-left: 4px;
}

.top-list-item {
  display: flex;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid #f8f9fa;
  transition: background 0.2s;
  /* Горизонтальний свайп для довгих назв, які не вміщаються */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* Ховаємо горизонтальний скролбар в рядку (свайп залишається) */
.top-list-item::-webkit-scrollbar {
  height: 0;
  display: none;
}
.top-list-item {
  scrollbar-width: none;
}
.top-list-item:hover {
  background: #fff9f5;
  border-radius: 10px;
}

.top-list-rank {
  font-size: 11px;
  font-weight: 700;
  color: #adb5bd;
  width: 22px;
  flex-shrink: 0;
}

/* Pie Indicator */
.top-list-pie-wrapper {
  position: relative;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  margin-left: 4px;
}
.top-list-pie-svg {
  transform: rotate(-90deg);
  width: 30px;
  height: 30px;
}
.top-list-pie-bg {
  fill: none;
  stroke: #eee;
  stroke-width: 4;
}
.top-list-pie-fill {
  fill: none;
  stroke: #f76707;
  stroke-width: 4;
  stroke-linecap: round;
}

.top-list-content {
  display: flex;
  flex: 1 0 auto;
  justify-content: space-between;
  align-items: center;
  margin-left: 12px;
  min-width: 0;
}

.top-list-info {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-width: 0;
}
.top-list-name {
  display: block;
  font-weight: 700;
  color: #2d3436;
  font-size: 14px;
  white-space: nowrap;
  min-width: 0;
}
.top-list-percent {
  font-size: 12px;
  color: #f76707;
  font-weight: 600;
}

.top-list-value {
  font-weight: 800;
  color: #1a1a1a;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  margin-left: 8px;
  white-space: nowrap;
}

@media (max-width: 991px) {
  .top-lists-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 20px;
  }
  .oblast-map-col,
  .oblast-map-table-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .oblast-map-table-col {
    margin-top: 16px;
  }
}

@media (max-width: 480px) {
  .top-list-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .top-list-name {
    font-size: 12px;
    font-weight: 600;
  }
  .top-list-percent {
    font-size: 10px;
  }
  .top-list-value {
    margin-left: 0;
    margin-top: 2px;
    color: #f76707;
    font-size: 12px;
    font-weight: 700;
  }
  .top-list-rank {
    width: 18px;
    font-size: 10px;
  }
  .top-list-card:hover {
    transform: none;
  }
}

/* =============================================
   SECTION: Dashboard Mobile Charts
   ============================================= */

@media (max-width: 991px) {
  /* Графіки на дашборді — повна ширина */
  .echarts4r,
  .echarts4r canvas,
  .html-widget,
  [id*="echarts"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Monthly tabs — wrap на мобільному */
  .monthly-tabs-buttons {
    flex-wrap: wrap;
  }
  .monthly-tab-btn {
    font-size: 13px;
    padding: 6px 14px;
  }

  /* Top list cards — мінімальний padding */
  .top-list-card {
    padding: 16px 8px 16px 14px;
  }
}

@media (max-width: 576px) {
  /* Dashboard stat cards — компактніший вигляд */
  .dashboard-cards-row .stat-card {
    min-height: 100px;
    padding: 0.6rem 0.75rem;
  }
  .dashboard-cards-row .stat-card .h3 {
    font-size: 1.25rem;
  }
  .dashboard-cards-row .stat-card .subheader {
    font-size: 0.75rem;
  }
}

/* ============================================
   Усі стилі селекта — глобальні зі style.css.
   ============================================ */
.dashboard-oblast-filter .form-group,
.dashboard-oblast-filter .shiny-input-container {
  margin-bottom: 0 !important;
}
