/*!* static/css/global.css *!*/
/* Keyframe animations */
@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sankeyWrapper {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

#sankeyDiagram {
    box-sizing: border-box;
    margin: 10px;
    border: 1px solid #1E2761;
    border-radius: 8px;
    padding: 20px;
    overflow: hidden;
}

.sankey-button, .export-button {
    background-color: #1E2761;
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    padding: 10px 20px;
    margin: 20px 0;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

/* get rid of that big 20px vertical margin */
#loadSankeyButton {
  margin: 0;
}

.sankey-button:hover, .export-button:hover {
    background-color: #2C9EFF;
}

#loading-bar-container {
    display: none;
    position: relative;
    width: 100%;
    height: 30px;
    background-color: #f3f3f3;
    border: 1px solid #ccc;
    border-radius: 50px;
    margin: 20px 0;
    text-align: center;
}

#loading-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #2C9EFF, #1E2761);
    background-size: 200% 100%;
    background-position: left center;
    border-radius: 50px;
    transition: width 0.4s ease, background-position 1s linear;
    box-shadow: 0 0 8px rgba(44, 158, 255, 0.5);
    overflow: hidden;
}

#loading-bar-text {
    position: absolute; !important;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: black;
    font-weight: bold;
    font-size: 14px;
    display: block;
}

/* Animate background shifting while loading */
@keyframes shimmer {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

#loading-bar.active {
    animation: shimmer 2s infinite linear;
}

.custom-choices {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 50px; !important;
    padding: 10px;
}

.form-container {
    margin: 20px auto; /* center horizontally */
    padding: 20px;
    background-color: white; /* optional: makes it pop on light blue background */
    border-radius: 10px; /* optional: soft rounded corners */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); /* optional: subtle shadow */
    width: 67%;
}

.form-container h1 {
    padding: 0;
}

.form-container h2 {
    color: #1E2761;
    padding: 10px 0;
}

/* Stop the global 50% widths from affecting the toolbar */
#sankeyForm .advanced-options .fgx-toolbar label,
#sankeyForm .advanced-options .fgx-toolbar button,
#sankeyForm .advanced-options .fgx-toolbar select {
  width: auto;
  display: inline-flex;
  margin-bottom: 0;
}

/* Make the toolbar use the full row */
#sankeyForm .advanced-options { grid-column: 1 / -1; width: 100%; }
#sankeyForm .advanced-options .fgx-toolbar {
    width: 100%;
    align-items: flex-end;
}

/* Nice minimums so controls don’t squish */
#sankeyForm .advanced-options .fgx-field { min-width: 220px; }
#sankeyForm .advanced-options .fgx-select { min-width: 140px; }
#sankeyForm .advanced-options .fgx-slider { min-width: 220px; }

/* Make buttons vertically centered within their own box and a consistent height */
#sankeyForm .advanced-options .sankey-button,
#sankeyForm .advanced-options .export-button {
  display: inline-flex;
  align-items: center;
  height: 35px;              /* match your input/select visual height */
  line-height: 1;
}

.dropdown-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* allows wrapping on smaller screens */
}

.dropdown-field {
    flex: 1;
    min-width: 200px;
}

.dropdown-field label {
    white-space: nowrap;         /* ❌ Prevent line wrapping */
    display: inline-block;       /* ✅ Let it respect container sizing */
    max-width: 100%;             /* ✅ Allow it to shrink when needed */
    overflow: hidden;            /* optional: clean cutoff if too long */
    text-overflow: ellipsis;     /* optional: add "..." if trimmed */
    color: #1E2761;
}

.dropdown-field select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

#fiscalSection.visible, #loadButtonWrapper.visible {
  visibility: visible;
  animation: fadeSlideIn 0.6s ease-out forwards;
}

/* Show with fade/slide */
.show {
  align-items: center;            /* center vertically */
  flex-wrap: nowrap;              /* keep everything on one line */
  gap: 1rem;                      /* spacing between items */
  opacity: 0;
  transform: translateY(10px);
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#fiscalSection,
#actionRow {
  display: none;
}

/* when you add .show, un-hide it */
#fiscalSection.show {
  display: block;            /* you want your label + select to stack vertically */
  animation: fadeIn 0.3s ease-out forwards;
  position: relative;
  z-index: 10;
}

/* hide until JS adds .show */
#advancedOptions {
  display: none;
  position: relative; /* establish a stacking context */
  z-index: 1;         /* sit below the dropdown menu */
}

/* only when you call .show do you un-hide and flex */
#advancedOptions.show {
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: fadeIn 0.3s ease-out forwards;
  transform: none !important;
}

/* reset any stray margins */
.advanced-options label,
.advanced-options input,
.advanced-options select,
.advanced-options button {
  margin: 0;
}

.advanced-options {
  grid-column: 1 / -1;   /* span all columns if parent is a grid */
  width: 100%;           /* ensure full width regardless */
}

/* make the Sankey button inline but flush left */
#loadSankeyButton {
  margin-right: auto;
}

/* ensure the overall choices container is positioned so its dropdown can escape */
.choices {
  position: relative;
  z-index: 10;             /* ensure its wrapper sits above #advancedOptions */
}

/* the menu itself must be absolutely positioned and very high z-index */
.choices__list--dropdown {
  position: absolute;
  z-index: 10000;
}


.disabled-export {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    text-align: center;
    width: 90%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 100000; /* Make sure it's above other elements */
}

.modal-button {
    display: inline-block;
    padding: 0.6rem 1rem;
    margin: 0.5rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.modal-button.secondary {
    background: #6c757d;
}

.modal-close {
    background: transparent;
    border: none;
    color: #333;
    font-size: 1rem;
    margin-top: 1rem;
    cursor: pointer;
}


.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
  color: #333;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 5px solid #999;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.export-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ---- FinGraphicx Sankey toolbar ---- */
.fgx-toolbar{
  display:flex;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  padding:12px 16px;
  background:#fff;
  border:1px solid #e7eaf3;
  border-radius:14px;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
  width: 100%;
}

/* ensure toolbar stays horizontal even if advancedOptions had other layout */
.advanced-options .fgx-toolbar{display:flex !important;}

.fgx-field{display:flex;flex-direction:column;gap:6px;min-width:180px}
.fgx-field--slim{min-width:220px}
.fgx-field label{font-size:12px;font-weight:600;color:#475467}

.fgx-slider{display:flex;align-items:center;gap:10px;min-width:220px}
.fgx-badge{
  min-width:36px;text-align:center;font-weight:600;font-size:13px;
  color:#1d2559;background:#eef2ff;border:1px solid #d7dcff;
  border-radius:10px;padding:6px 8px
}

/* Range input */
input[type="range"]{appearance:none;-webkit-appearance:none;width:100%;height:6px;background:#dfe3f0;border-radius:999px;outline:none}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;width:18px;height:18px;background:#fff;border:2px solid #1d2559;border-radius:50%;
  box-shadow:0 1px 2px rgba(16,24,40,.14);cursor:pointer
}
input[type="range"]::-moz-range-track{height:6px;background:#dfe3f0;border-radius:999px}
input[type="range"]::-moz-range-thumb{
  width:18px;height:18px;background:#fff;border:2px solid #1d2559;border-radius:50%;box-shadow:0 1px 2px rgba(16,24,40,.14);cursor:pointer
}

/* Select */
.fgx-select{
  appearance:none;-webkit-appearance:none;-moz-appearance:none;
  padding:10px 36px 10px 12px;
  border:1px solid #e6e8ef;border-radius:12px;background:#fff;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 20 20' fill='none'><path d='M5 7l5 6 5-6' stroke='%231d2559' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat:no-repeat;background-position:right 10px center;
  font-weight:600;color:#1d2559;min-width:140px;cursor:pointer
}
.fgx-select:focus{outline:none;border-color:#b8bef5;box-shadow:0 0 0 3px rgba(29,37,89,.12)}

/* Buttons */
.fgx-spacer{flex:1}

/* Mobile: stack nicely */
@media (max-width: 900px){
  .fgx-field--slim{min-width:100%}
  .fgx-slider{min-width:0;width:100%}
}
