@import url("https://fonts.googleapis.com/css2?family=Cal+Sans&family=Barlow+Condensed:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #111318;
  --surface: #1c2028;
  --surface-active: #303641;
  --text: #f5f6f8;
  --muted: #a1a7b2;
  --border: #333844;
  --accent: #B8F34A;
  --button-text: #111318;
  --water: #66D6C2;
  --power: #F08A8A;
  --marker-bg: #30343b;
  --shadow: 0 12px 40px #0005;
}

body.light {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-active: #e9edf2;
  --text: #17191d;
  --muted: #626976;
  --border: #dce0e6;
  --shadow: 0 12px 40px #0002;
  --accent: #719E16;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
  transition: background .18s, color .18s;
}

button,
input,
select,
textarea {
  font: inherit;
  text-transform: uppercase;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Titles */

h1,
h2,
h3,
h4,
h5,
h6,
#active-count {
  font-family: "Cal Sans", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
}

/* Header */

.app-header {
  position: relative;
  z-index: 700;
  height: 80px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  min-width: 0;
  margin: 0;
  font-size: clamp(15px, 3.8vw, 20px);
  line-height: 1.1;
  letter-spacing: -.45px;
  white-space: nowrap;
}

.report-count {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--muted);
  font-size: clamp(8px, 2vw, 10px);
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
}

#active-count {
  color: var(--accent);
  font-size: clamp(22px, 4vw, 40px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#count-label {
  font-size: 0;
}

#count-label::after {
  content: "REPORTES ACTIVOS";
  font-size: clamp(10px, 2vw, 12px);
}

main {
  height: calc(100dvh - 60px);
  display: flex;
  flex-direction: column;
}

/* Map */

.map-section {
  position: relative;
  flex: 1 1 auto;
  min-height: 160px;
  margin: 12px 12px 0;
  overflow: hidden;
  border: 1px solid var(--accent);
  border-radius: 16px;
  background: #ffffff;
  isolation: isolate;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.leaflet-tile-pane {
  filter: grayscale(1) contrast(.2);
}

.map-hint {
  position: absolute;
  z-index: 500;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 100px);
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: .96;
}

/* Map refresh */

.map-control {
  position: absolute;
  z-index: 600;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 2px 8px #0002;
}

.refresh-control {
  top: 15px;
  right: 15px;
}

/* Bottom controls */

.bottom-panel {
  flex: 0 0 auto;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
}

#location-status {
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

.bottom-controls {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  column-gap: 10px;
}

.logo-placeholder {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--muted);
  border-radius: 100vw;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  filter: opacity(0.4);
}

.primary {
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  justify-self: center;
  padding: 10px 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text);
  font-family: "Cal Sans", sans-serif;
  font-size: clamp(15px, 4vw, 17px);
  font-weight: 400;
  letter-spacing: .1px;
  white-space: nowrap;
  box-shadow: 0 3px 12px #0002;
  transition: opacity .15s, transform .15s;
}

.primary:active:not(:disabled) {
  transform: scale(.98);
}

.primary:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  justify-self: end;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}

#message {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

#message:empty {
  display: none;
}

#message.error {
  color: #F08A8A;
}

#message.success {
  color: #B8F34A;
}

/* Dark-gray outage markers with colored outlines and slashes */

.outage-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--water);
  border-radius: 50%;
  background: var(--marker-bg);
  box-shadow: 0 2px 7px #0005;
}

.outage-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: var(--water);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.outage-icon.water-marker {
  border-color: var(--water);
  background: var(--marker-bg);
}

.outage-icon.water-marker svg {
  stroke: var(--water);
}

.outage-icon.power-marker {
  border-color: var(--power);
  background: var(--marker-bg);
}

.outage-icon.power-marker svg {
  stroke: var(--power);
}

.selection-icon {
  width: 22px;
  height: 22px;
  border: 3px solid #20262e;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px #fff9;
}

/* Popups */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--border);
}

.leaflet-popup-content {
  margin: 10px 12px;
  min-width: 155px;
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
}

.popup-title {
  margin-bottom: 6px;
  font-family: "Cal Sans", sans-serif;
  font-size: 14px;
  font-weight: 400;
}

.popup-detail {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.resolve-button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #111318;
  font-size: 13px;
  font-weight: 700;
}

.resolve-button:disabled {
  opacity: .6;
  cursor: wait;
}

.leaflet-control-attribution {
  font-size: 10px !important;
  text-transform: uppercase;
  opacity: .85;
}

/* Compact report modal */

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: #0009;
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: var(--shadow);
  animation: modal-in .28s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.modal-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -.3px;
}

.close-button {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  font-size: 24px;
}

.modal-label {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.service-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.service-option {
  min-width: 0;
  min-height: 54px;
  padding: 6px 9px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.service-option.selected {
  border-color: var(--accent);
  background: var(--surface-active);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.option-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid var(--water);
  border-radius: 50%;
  background: var(--marker-bg);
}

.option-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: var(--water);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.option-icon .icon-slash {
  stroke-width: 2.8;
}

.water-bubble {
  border-color: var(--water);
}

.water-bubble svg {
  stroke: var(--water);
}

.power-bubble {
  border-color: var(--power);
}

.power-bubble svg {
  stroke: var(--power);
}

.location-label {
  margin-top: 12px;
}

.location-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.15;
  text-align: left;
}

.secondary > span:first-child {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 18px;
}

.modal-location {
  min-height: 0;
  margin: 8px 1px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.submit-button {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
}

/* Small screens */

@media (max-width: 360px) {
  .app-header {
    padding-right: 10px;
    padding-left: 10px;
    gap: 6px;
  }

  .app-header h1 {
    font-size: clamp(12px, 3.7vw, 15px);
    letter-spacing: -.5px;
  }

  #active-count {
    font-size: 20px;
  }

  .bottom-panel {
    padding-right: 10px;
    padding-left: 10px;
  }

  .bottom-controls {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    column-gap: 7px;
  }

  .logo-placeholder,
  .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .primary {
    min-height: 44px;
    padding: 9px 16px;
    font-size: 15px;
  }

  .map-section {
    margin: 10px 10px 0;
    border-radius: 15px;
  }

  .modal-card {
    padding: 12px;
  }

  .service-options,
  .location-options {
    gap: 6px;
  }

  .service-option {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 6px;
    padding: 6px;
    font-size: 13px;
  }

  .option-icon {
    width: 32px;
    height: 32px;
  }

  .option-icon svg {
    width: 21px;
    height: 21px;
  }

  .secondary {
    padding: 7px 6px;
    gap: 5px;
    font-size: 12px;
  }
}

/* Wider screens */

@media (min-width: 760px) {
  .app-header {
    padding-right: 24px;
    padding-left: 24px;
  }

  main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px 12px;
  }

  .map-section {
    margin-top: 14px;
  }

  .bottom-panel {
    padding-right: 10px;
    padding-left: 10px;
  }

  .bottom-controls {
    max-width: 560px;
    margin: 0 auto;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .primary {
    min-width: 190px;
  }

  .modal-card {
    padding: 16px;
  }
}

/* Short screens */

@media (max-height: 650px) {
  .bottom-panel {
    padding-top: 6px;
  }

  .primary {
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .map-section {
    min-height: 140px;
  }

  .modal-card {
    max-height: calc(100dvh - 20px);
    padding: 12px;
  }

  .modal-heading {
    margin-bottom: 6px;
  }

  .modal-label {
    margin-top: 8px;
    margin-bottom: 5px;
  }

  .location-label {
    margin-top: 9px;
  }

  .modal-location {
    margin-top: 6px;
    margin-bottom: 7px;
  }

  .service-option {
    min-height: 48px;
  }

  .secondary {
    min-height: 38px;
  }

  .submit-button {
    min-height: 40px;
  }
}