/* ==========================================================================
   Global reset & base
   ========================================================================== */

#dfg-dashboard-container,
#dfg-dashboard-container * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

#dfg-dashboard-container,
.dfg-dashboard-shortcode-root {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 400px; /* visible area before JS runs */
}

/* ==========================================================================
   Dashboard layout
   ========================================================================== */

.dfg-dashboard {
  display: grid;
  grid-template-columns: 260px 1fr; 
  gap: 24px;
  padding: 16px;
  width: 100%;
  max-width: none;     
  margin: 0;         
  align-items: start;
}

/* Sidebar (Filters) */
.dfg-sidebar {
  border-right: 1px solid #e5e5e5;
  padding-right: 16px;
  overflow-y: auto;
}

/* Content area */
.dfg-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0; 
}

.dfg-dashboard-header {
  width: 100%;
  background-color: #3f3f3f;   
  color: #fff;
  font-size: 20px;
  font-weight: 400;
  text-align: left;
  padding: 24px;
  margin-bottom: 2px;     
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 8px;        
  box-sizing: border-box;
}
#dfg-dashboard-header > span {
    font-size: .65em;
    text-transform: none;
    line-height: .75em;
    letter-spacing: normal;
}

/* ==========================================================================
   Headings 
   ========================================================================== */

.dfg-section {
  background-color: #f3f3f3;  
  border-left: 4px solid #111; 
  padding: 16px 20px;         
  border-radius: 8px;
  margin-bottom: 2px;    
}

.dfg-section-title {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #111;
  margin-bottom: 2px;
}

.dfg-section-text {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}


/* ==========================================================================x
   Skeleton containers (base cards)
   ========================================================================== */

.dfg-skeleton-box {
  border: 1px dashed #d6d6d6;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
  position: relative;
}

.dfg-skeleton-title {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 1;
  margin-bottom: 8px;
  color: #111;
}

/* ==========================================================================
   MAP (THIS IS THE IMPORTANT PART)
   ========================================================================== */

#dfg-map-root,
.dfg-skeleton-map {
  width: 100%;
  height: 600px;       
  min-height: 600px;
  position: relative;
  overflow: hidden;
}

/* Leaflet requires this */
#dfg-map {
  width: 100%;
  height: 100%;
}

path.leaflet-interactive:hover {
    cursor: default;
}
path.leaflet-interactive:focus {
    outline: none !important;
}

/* ==========================================================================
   Overview grid (KPIs + Capacity + Revenue)
   ========================================================================== */

.dfg-overview-grid {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

.dfg-skeleton-kpis {
  min-height: 400px;
}

.dfg-overview-right {
  display: flex;
  flex-direction: column;
  gap: 35px;     
  min-width: 0; 
}

.dfg-skeleton-capacity {
  min-height: 170px;
}

.dfg-skeleton-revenue {
  min-height: 170px;
}

/* Subsector charts - larger section */
.dfg-skeleton-subsectors,
#dfg-subsectors-root {
  min-height: 560px;
  display: block;
  padding: 20px;
}

.dfg-subsector-section-title {
  font-size: 20px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 16px 0;
  color: #111;
}

.dfg-subsector-no-data-note {
  margin: 0 0 16px 0;
  padding: 10px 14px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 14px;
  color: #92400e;
}

/* Grid for subsector charts - two equal columns, full width */
.dfg-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 900px) {
  .dfg-chart-grid {
    grid-template-columns: 1fr;
  }
}

/* Each chart card - room for pie + compact legend */
.dfg-chart-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eee;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0; /* allow shrink for grid */
}

#dfg-subsectors-root .dfg-chart-card {
  min-width: 0;
  width: 100%;
  min-height: 420px;
  border: 3px solid #000;
  box-sizing: border-box;
  position: relative;
}

/* Small star in bottom right corner of each pie chart box */
#dfg-subsectors-root .dfg-chart-card::after {
  content: "\2605";
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 14px;
  color: #b0b0b0;
  line-height: 1;
  pointer-events: none;
}

/* Subsector: legend in two columns, 5 items per column – larger text */
#dfg-subsectors-root .dfg-chart-card .dfg-chart-legend {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, auto);
  grid-auto-flow: column;
  gap: 8px 16px;
  width: 100%;
  max-width: 100%;
  max-height: none;
  overflow-y: visible;
  font-size: 18px;
  line-height: 1.4;
}

#dfg-subsectors-root .dfg-chart-card .dfg-legend-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

#dfg-subsectors-root .dfg-chart-card .dfg-legend-label {
  /*overflow: hidden;*/
  /*text-overflow: ellipsis;*/
  /*white-space: nowrap;*/
  font-size: 16px;
}

#dfg-subsectors-root .dfg-chart-card .dfg-legend-value {
  font-size: 18px;
  flex-shrink: 0;
}

#dfg-subsectors-root .dfg-chart-card .dfg-legend-swatch {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

#dfg-subsectors-root .dfg-chart-card .dfg-chart-title,
.dfg-overview-right .dfg-chart-title {
  font-size: 20px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  line-height: 1.3;
}

/* Chart SVG */
.dfg-chart-body svg {
  width: 100%;
  max-width: 360px;
  height: auto;
}

/* Subsector section: wider pies to fill the section */
#dfg-subsectors-root .dfg-chart-body svg {
  max-width: 360px;
}

/* Legend layout (default for other charts) */
.dfg-chart-legend {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px 12px;
  width: 100%;
}



/* ==========================================================================
   Filters UI
   ========================================================================== */

.dfg-logo {
  text-align: center;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.dfg-logo img {
  display: block;   
  width: 180px;     
  height: auto;
  margin: 0 auto;
}

.dfg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.dfg-tab {
  padding: 10px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.dfg-tab.is-active {
  border-color: #999;
  background: #f3f3f3;
}

.dfg-search {
  margin-top: 10px;
}

.dfg-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 13px;
}

/* Filter list */
#dfg-filter-list {
  margin-top: 12px;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 12px;
  background: #fff;
  max-height: 460px;
  overflow-y: auto;
}

.dfg-checkrow {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 6px;
  border-radius: 10px;
  cursor: pointer;
}

.dfg-checkrow:hover {
  background: #f7f7f7;
}

.dfg-checkrow input {
  margin: 0;
}

/* Actions */
.dfg-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.dfg-btn {
  padding: 10px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

.dfg-btn--primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

/* Empty + toast */
.dfg-empty {
  padding: 10px;
  opacity: 0.65;
  font-size: 13px;
}

.dfg-toast {
  margin-top: 10px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.dfg-toast.is-visible {
  opacity: 0.8;
}

/* ==========================================================================
   Responsive behavior (optional but sane)
   ========================================================================== */
@media (min-width:1200px) and (max-width: 1440px){
  .dfg-overview-grid {display: block;}
  .kpis-flow-container {flex-direction: row !important;}
  .flow-arrow {transform: scaleX(2) scaleY(2) rotate(-90deg) !important;margin-left: -24px !important;}
  .kpi-card {min-width: 200px !important;}
}

@media (max-width:1300px){
  #dfg-subsectors-root .dfg-chart-card .dfg-chart-legend {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(10, auto);    
  }
}

@media (max-width: 1200px) {
  .dfg-overview-grid {grid-template-columns: 1fr !important;}
}

@media (max-width: 1100px) {
  .revenue-layout {grid-template-columns: 1fr !important;}
  .revenue-chart-side {margin: auto;}
}

@media (max-width: 1024px) {
  .dfg-dashboard {
    grid-template-columns: 220px 1fr;
  }
}

@media (max-width: 768px) {
  .dfg-dashboard {
    grid-template-columns: 1fr;
  }

  .dfg-sidebar {
    border-right: none;
    border-bottom: 1px solid #e5e5e5;
    padding-right: 0;
    padding-bottom: 16px;
  }

  #dfg-map-root,
  .dfg-skeleton-map {
    height: 480px;
    min-height: 480px;
  }
  .dfg-print-btn {
    display: none;
  }
}

/* ---------- Pie chart layout ---------- */

.dfg-chart-body--pie .dfg-pie-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.dfg-pie {
  flex: 0 0 auto;
}

.dfg-pie-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 6px 10px;
  font-size: 18px;
  width: 100%;
  margin-top: 6px;
}

.dfg-pie-title {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  margin: 6px 0 4px;
}

.dfg-pie-group + .dfg-pie-group {
  margin-top: 10px;
}

.dfg-legend-row {
  border-top: 1px solid #999;
  display: grid;
  /* 3 columns, 2 rows; 4th item on 2nd row, far right */
  grid-template-columns: 10px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 6px;
  row-gap: 4px;
  align-items: center;
}

/* 4th item (value) on second row, right-aligned */
.dfg-legend-row > :nth-child(4) {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  align-self: center;
}

.dfg-chart-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px 14px;
  font-size: 24px;
}

.dfg-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

/* Force subsector chart fonts to match overview */
.dfg-chart-title,
.dfg-chart-body,
.dfg-chart-legend,
.dfg-legend-row,
.dfg-legend-label,
.dfg-legend-value,
.dfg-legend-percent {
    font-family: 'Actor', sans-serif !important;
}
.dfg-legend-percent {
  font-size: 14px;
}
.dfg-chart-title {
    font-size: 23px;
    font-weight: 400;
    color: #000;
    margin: 0 0 30px 0;
    letter-spacing: 0.3px;
    font-family: 'Actor', sans-serif;
    text-transform: uppercase;
    text-align: left;
    justify-self: start;
    align-self: start;
}

/* ---------- Sources section ---------- */
.dfg-sources-list {
  list-style: none;
  padding-left: 0;
  margin-top: 12px;
}

.dfg-sources-list li {
  font-size: 15px;
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
  line-height: 1.4;
}

.dfg-symbol {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  flex-shrink: 0;
  margin-top: 3px; /* align with text */
}

.dfg-symbol.triangle {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 12px solid grey;
}

.dfg-symbol.square {
  background-color: grey;
}

.dfg-symbol.circle {
  background-color: grey;
  border-radius: 50%;
}

.dfg-symbol.star {
  width: 15px;
  height: 15px;
  clip-path: polygon(
    50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 
    50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%
  );
  background-color: grey;
}

/* PRINT */
/* Print button styling */
button.dfg-print-btn {
    float: right;
    color: var(--awb-color7);
    background: none;
    border: 1px solid;
    border-radius: var(--form_border_radius);
    padding: .5em 1em;    
    cursor: pointer;
}
button.dfg-print-btn:hover {
    color: #3f3f3f;
    background: var(--awb-color7);
}
.print-only {display:none;}

/* The magic: print only your content */
@media print {
    html, body {background-color: transparent !important;}
    body * {
        visibility: hidden;           /* hide everything */        
    }
    #dfg-map-root, .dfg-section.map-heading {display: none;}
    .print-only {display: block;}
    .fusion-tb-header {height: 1cm !important; }
    .dfg-content,
    .dfg-content * {
        background: white !important;
        visibility: visible;          /* show only your content */
    }
    .dfg-content {
        position: absolute;
        left: 0;
        top: 0;
        max-width: 100%;
    }
    #dfg-dashboard-header { 
      font-size:36pt !important; 
      background-color: transparent !important; 
      color: #3f3f3f !important;
    }
    #dfg-dashboard-header > span {
        font-size: 12pt !important;
        line-height: 14pt;
    }
    .dfg-section {
      break-before: always !important; 
      page-break-before: always !important;
    }
    .dfg-chart-card {
     break-inside: avoid-page !important;
     page-break-inside: avoid-page !important;
    }
    .dfg-chart-title { font-size: 16pt !important; }
    .dfg-chart-body > svg {
        width: 50% !important;
    }
    #dfg-kpis-root {max-width: 100vw !important;}
    /*.kpis-flow-container {
        flex-direction: row !important;
    }
    .flow-arrow {
        transform: scaleX(2) scaleY(2) rotate(-90deg) !important;
        max-width: 15px !important;
        margin-left: -20px !important;
        z-index: 1;
        display: none !important;
    }
    .kpi-card {
      min-width: 200px !important;
      max-width: 240px !important;
      height: auto !important;
      padding: 1cm .5cm !important;
      z-index: 2;
    }*/
    .kpi-number { font-size: 18pt !important; }
    .total-amount { font-size: 28pt !important; }
    .dfg-overview-grid {
      grid-template-columns: 1fr !important;
    }
    #dfg-subsectors-root .dfg-chart-card .dfg-legend-swatch {
      width: .5cm !important;
      height: .5cm !important;
      border-width: 3mm !important;
    }
    #dfg-subsectors-root .dfg-chart-card .dfg-chart-legend {
      grid-template-columns: 1fr 1fr;
      grid-template-rows: repeat(5, auto);
    }
    #dfg-subsectors-root .dfg-chart-card .dfg-legend-label {
      font-size: 12pt !important;
    }
    .revenue-legend .legend-square {
      border-style: solid;
      border-width: 5mm !important;
    }
    .capacity-chart-wrapper > #capacityChart{
        max-width: 100% !important;
    }
    .capacity-explanation {margin-top: 2cm !important; }

    .dfg-print-btn {
        display: none;                /* hide the button itself and other selected sections when printing */
    }
    
    /* Optional: clean print styles */
    @page {
        margin: 1cm;
    }
}