@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');

/* ------ CSS reset ------ */
/* From from https://www.joshwcomeau.com/css/custom-css-reset/ */

/*
  1. Use a more-intuitive box-sizing model.
*/
*, *::before, *::after {
  box-sizing: border-box;
}
/*
  2. Remove default margin
*/
* {
  margin: 0;
}
/*
  3. Allow percentage-based heights in the application
*/
html, body {
  height: 100%;
}
/*
  Typographic tweaks!
  4. Add accessible line-height
  5. Improve text rendering
*/
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/*
  6. Improve media defaults
*/
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}
/*
  7. Remove built-in form typography styles
*/
input, button, textarea, select {
  font: inherit;
}
/*
  8. Avoid text overflows
*/
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
/*
  9. Create a root stacking context
*/
#root, #__next {
  isolation: isolate;
}

/* ------ App Styles ------ */

:root {
  --font: "Lato", sans-serif;
  --base-size: 14px;
  --bigger-size: 16px;
  --smaller-size: 12px;
  --regular-weight: 400;
  --bold-weight: 700;
  --main-color: #5FD3BC;
  --main-background-color: #5FD3BC;
  --secondary-color: #3D3D3D;
  --tertiary-color: #447E72;
  --breathing-room: 25px;
  --little-breath: 4px;
  --radio-button-color: #6c757d;
}

/* ------  Header and font styles ------ */

body {
  font-family: var(--font);
  font-weight: var(--regular-weight);
}

.shiny-options-group, .btn-default {
  font-size: var(--base-size);
}

.header {
  font-size: var(--bigger-size);
}

a {
  color: var(--main-color);
}

a:hover {
  color: var(--tertiary-color);
}

/* General */

.censusagg-col {
  padding-left: 0;
  padding-right: 0;
}

.breathe {
  margin-bottom: var(--breathing-room);
}

.little-breath {
  margin-bottom: var(--little-breath);
}

table {
  font-family: var(--font) !important;
  color: var(--secondary-color);
  padding-left: 17px;
}

.censusagg-map {
  height: 100vh;
  position: relative;
}

.censusagg-sidebar {
  height: calc(100vh - 70px);
  padding: 25px;
  position: relative;
  overflow-y: auto;
  margin-bottom: 70px; /* height + 2*bottom */
}

.pa-logo { /* TODO */
  position: fixed;
  bottom: 15px;
  right: var(--breathing-room);
  height: 50px;
}

bslib-tooltip {
  cursor: pointer;
}

.tooltip {
  background-color: #fff; /* White background like popovers */
  border: 1px solid rgba(0, 0, 0, 0.2); /* Border similar to popovers */
  border-radius: 0.5rem; /* Rounded corners */
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); /* Box shadow for depth */
  padding: 0.5rem; /* Padding inside the tooltip */
  max-width: 400px; /* Max width similar to popovers */
}

.tooltip .tooltip-inner {
  color: #212529; /* Text color */
  padding: 0.5rem; /* Inner padding */
}

.tooltip .arrow::before {
  border-width: 0.5rem; /* Arrow size */
  border-color: rgba(0, 0, 0, 0.2); /* Arrow color */
}

.popover, .popover .form-control, .popover .btn-link, .popover .btn-link:hover, .popover .btn-link:focus{
  font-size: 0.8rem;
}

.help-icon {
  color: #aaaaaa;
  margin-bottom: -2px;
}

.badge {
  background-color: #5FD3BC;
  display: inherit;
  margin-left: 1px;
}

.modal {

  .close-modal-button .btn {
    border: 0px none;
    float: right;
    color: #cccccc;
    padding: 10px 20px;
    margin-right: -20px;
  }

  .close-modal-button .btn:hover {
    background: none;
    color: #000000;
  }

  --bs-modal-margin: 50px;

  .title {
    display: none;
  }

  .section-heading hr {
    border-top: 2px solid var(--main-background-color);
  }

  .subsection-heading {
    font-weight: var(--bold-weight);
    background-color: white;
    color: var(--main-background-color);
    padding-top: 0.5rem;
    padding-bottom: 0;
  }

  .box {
    min-height: 106px;
    height: 100%;
    background-color: var(--main-background-color);
    color: white;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
  }

  .card-value {
    margin-top: auto;
    font-size: 2rem;
    font-weight: bold;
  }

  h1 {
    font-size: 1.5rem;
  }

  .title-heading {
    margin-top: 0.5em;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  a {
    color: var(--main-color);
  }

  .gt_table {
    font-size: var(--base-size) !important;
  }

  /* Hide PDF definitions table in HTML */
  .definitions-table-pdf {
    display: none;
  }

  .print-header {
    display: block;
    width: 100%;
    height: 75px;
    margin: 1rem 0;
  }

  .print-header .left-logo {
    float: left;
    text-align: left;
    max-width: 75%;
    height: 100%;
  }

  .print-header .right-logo {
    float: right;
    text-align: right;
    max-width: 25%;
    height: 100%;
  }

  .print-header img {
    height: 100%;
  }

  .censusagg-link {
    margin-bottom: 0.5rem;
  }

  .censusagg-link a {
    font-size: var(--bigger-size);
  }

  #modal-fig {
    margin-bottom: 24px;
  }

}

/* Inputs */

/* Radio buttons */

.shiny-input-radiogroup {
  margin-bottom: var(--breathing-room);
}

/* Radio button label */

.shiny-input-radiogroup > .control-label {
  font-size: var(--bigger-size);
  font-weight: var(--bold-weight);
}

.pretty {
  margin-right: 0;
  margin-bottom: 0.6em;
}

/* Radio button choices */
.shiny-input-radiogroup > .shiny-options-group {
  color: var(--secondary-color);
}

.input-field .form-group {
  margin-bottom: 0.5em;
}

.pretty input:checked ~ .state.p-primary label:after, .pretty.p-toggle .state.p-primary label:after {
  background-color: var(--radio-button-color) !important;
}

/* Position clear selection button */
#sidebar-selection_tool {
  margin-bottom: 0;
  margin-right: 1em;
  float: left;
}

#sidebar-reset {
  margin-top: -9px;
}

#sidebar-share {
  margin-left: 6px;
  margin-top: 3px;
}


/* Spacing for share button */
.fa, .fas {
  padding: 0 3px !important;
}

/* Buttons */

.bttn-bordered.bttn-md {
  font-size: var(--bigger-size);
  font-weight: var(--bold-weight);
  margin-bottom: var(--breathing-room);
  width: 50%;
}

.bttn-bordered.bttn-primary {
  color: var(--secondary-color);
}

.btn-default {
  margin-bottom: var(--little-breath);
  margin-right: var(--little-breath);
}

.btn-default.main-color {
  border-color: var(--main-color);
  background-color: var(--main-color);
  color: #ffffff;
}

.dropdown-menu {
  width: 98% !important;
  min-width: 0 !important;
}
/* Polygon drawing */

.mapbox-gl-draw_polygon.active {
  background-color: rgba(0,0,0,0.3);
}

/* Cursor on disabled buttons */
a[disabled], button:disabled, .btn.disabled {
  cursor: not-allowed;
  pointer-events: none;
  color: var(--bs-btn-disabled-color);
  background-color: var(--bs-btn-disabled-bg);
  border-color: var(--bs-btn-disabled-border-color);
  opacity: var(--bs-btn-disabled-opacity);
}

/* Style secondary buttons (link style) to have no background colour, no outline, no padding */
/* Just link a link! */
.btn-link, .btn-link:disabled, .btn-link:hover, .btn-link:active, .btn-link:focus,
.shiny-download-link.btn-link, .shiny-download-link.btn-link:disabled,
.shiny-download-link.btn-link:hover, .shiny-download-link.btn-link:active,
.shiny-download-link.btn-link:focus {
  background-color: inherit !important;
  border-style: none !important;
  padding: 0;
  color: var(--main-color);
  font-size: var(--base-size);
}

/* Tooltip positioning - top left instead of following mouse */

.mapboxgl-symbol {
  pointer-events: none
}

.mapboxgl-popup {
  transform: none !important;
  min-width: 240px;
  bottom: 30px !important;
  right: 50px !important;
  top: unset !important;
  left: unset !important;
  border-radius: 3px;
  -moz-box-shadow: 0 0 2px rgba(0,0,0,.1);
  -webkit-box-shadow: 0 0 2px rgba(0,0,0,.1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
}

.mapboxgl-popup-content {
  padding: 10px !important;
  min-width: 240px;
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-center .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip {
  display: none !important;
}


/* Legend */

.map-overlay-container {
  position: absolute;
  top: 10px;
  right: 30px;
  border-radius: 3px;
  font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;
}

.map-overlay {
  margin-right: 20px;
  border-radius: 3px;
  min-width: 240px;
}

.legend {
  padding: 10px;
  line-height: 1.3rem;
  background: #fff;
  margin-bottom: 20px;
  -moz-box-shadow: 0 0 2px rgba(0,0,0,.1);
  -webkit-box-shadow: 0 0 2px rgba(0,0,0,.1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
}

.legend-key {
  display: inline-block;
  border-radius: 20%;
  width: 10px;
  height: 10px;
  margin-right: 5px;
}

#select-municipality {
  font-weight: bold;
  width: 240px;
}

#select-municipality .btn {
  font-size: 0.9em;
  -moz-box-shadow: 0 0 2px rgba(0,0,0,.1);
  -webkit-box-shadow: 0 0 2px rgba(0,0,0,.1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
  padding: 0.55em 9px;
}

#select-municipality #map-select_municipality-label {
  margin-bottom: .25rem;
  text-shadow: 0px 0px 3px white;
}

#select-municipality .dropdown-menu {
  font-size: 0.95em;
}

/* Media queries - default is desktop */

@media (max-width: 1500px) {
  /* Laptop */
}

@media (max-width: 1100px) {
  /* Tablets */
}

@media (max-width: 550px) {
  /* Phones */
  .mapboxer, .censusagg-map {
    height: 50vh !important;
  }

  .censusagg-sidebar {
    height: calc(50vh - 50px);
    margin-bottom: 50px;
  }

  .pa-logo {
    height: 30px;
    bottom: 10px;
  }

  .sidebar-header .col-sm-6 {
    width: 50%;
  }

  .map-overlay, .mapboxgl-popup {
    font-size: var(--smaller-size);
  }

  .mapboxgl-popup {
    bottom: unset !important;
    right: 50px !important;
    top: 10px !important;
    left: unset !important;
  }
}
