/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  background: #0b0f14;
  color: #e7edf5;

  overflow: hidden;
}


/* =========================================================
   MAIN LAYOUT
   ========================================================= */

main {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    380px;

  width: 100%;
  height: calc(100vh - 42px);

  min-height: 0;
}


/* =========================================================
   MAP SECTION
   ========================================================= */

.map-section {
  position: relative;

  min-width: 0;
  min-height: 0;

  background: #10161d;

  overflow: hidden;
}

#map {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  background: #10161d;

  z-index: 1;
}


/* =========================================================
   LEAFLET
   ========================================================= */

.leaflet-container {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  background: #10161d;
}

.leaflet-control-attribution {
  display: none;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #111820;
  color: #e7edf5;
}

.leaflet-popup-content {
  margin: 14px 16px;

  font-size: 13px;
  line-height: 1.55;
}

.leaflet-popup-close-button {
  color: #8b98a8 !important;
}

.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}


/* =========================================================
   MAP TITLE
   ========================================================= */

.map-title {
  position: absolute;

  top: 16px;
  right: 16px;
  left: auto;

  z-index: 500;

  display: flex;

  align-items: center;

  gap: 10px;

  padding: 8px 11px;

  background:
    rgba(
      11,
      15,
      20,
      0.68
    );

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.08
    );

  border-radius: 8px;

  box-shadow:
    0 8px 20px
    rgba(
      0,
      0,
      0,
      0.18
    );

  backdrop-filter: blur(7px);
}

.map-title h1 {
  font-size: 15px;

  font-weight: 700;

  letter-spacing: -0.02em;

  line-height: 1;
}


/* =========================================================
   LIVE INDICATOR
   ========================================================= */

.map-live {
  display: flex;

  align-items: center;

  gap: 5px;

  min-height: 18px;

  padding-left: 8px;

  border-left:
    1px solid
    rgba(
      255,
      255,
      255,
      0.12
    );
}

.map-live img {
  width: 15px;
  height: 15px;

  object-fit: contain;

  display: block;

  flex-shrink: 0;
}

.map-live span {
  font-size: 10px;

  line-height: 1;

  font-weight: 800;

  letter-spacing: 0.04em;

  color: #52d66f;

  white-space: nowrap;
}


/* =========================================================
   CONTROLS
   ========================================================= */

.controls {
  position: absolute;

  left: 24px;
  right: 24px;
  bottom: 24px;

  z-index: 500;

  display: grid;

  grid-template-columns:
    minmax(220px, 2fr)
    1.15fr
    1fr
    1fr
    1fr;

  gap: 10px;

  padding: 12px;

  background:
    rgba(
      11,
      15,
      20,
      0.90
    );

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.08
    );

  border-radius: 14px;

  box-shadow:
    0 12px 35px
    rgba(
      0,
      0,
      0,
      0.35
    );

  backdrop-filter: blur(12px);
}

.control {
  min-width: 0;

  display: flex;

  flex-direction: column;

  gap: 6px;
}

.control label {
  padding-left: 2px;

  color: #8290a2;

  font-size: 11px;

  font-weight: 600;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}


/* =========================================================
   SELECTS
   ========================================================= */

.control select {
  width: 100%;

  height: 40px;

  padding:
    0 36px 0 12px;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.09
    );

  border-radius: 8px;

  outline: none;

  background-color: #151c24;

  color: #e7edf5;

  font-size: 13px;

  cursor: pointer;

  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.control select:hover {
  background-color: #19212a;

  border-color:
    rgba(
      255,
      255,
      255,
      0.16
    );
}

.control select:focus {
  border-color: #3b82f6;

  box-shadow:
    0 0 0 3px
    rgba(
      59,
      130,
      246,
      0.14
    );
}

.control select option {
  background: #151c24;

  color: #e7edf5;
}


/* =========================================================
   SEARCH
   ========================================================= */

.search-control {
  position: relative;
}

.search {
  position: relative;

  display: flex;

  width: 100%;
}

.search input {
  width: 100%;

  height: 40px;

  padding:
    0 86px 0 12px;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.09
    );

  border-radius: 8px;

  outline: none;

  background: #151c24;

  color: #e7edf5;

  font-size: 13px;

  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.search input::placeholder {
  color: #5f6d7d;
}

.search input:hover {
  background: #19212a;

  border-color:
    rgba(
      255,
      255,
      255,
      0.16
    );
}

.search input:focus {
  border-color: #3b82f6;

  box-shadow:
    0 0 0 3px
    rgba(
      59,
      130,
      246,
      0.14
    );
}

.search button {
  position: absolute;

  top: 4px;
  right: 4px;

  height: 32px;

  padding:
    0 12px;

  border: none;

  border-radius: 6px;

  background: #2563eb;

  color: #ffffff;

  font-size: 12px;

  font-weight: 600;

  cursor: pointer;

  transition:
    background-color 0.18s ease,
    transform 0.18s ease;
}

.search button:hover {
  background: #3574ed;
}

.search button:active {
  transform: translateY(1px);
}


/* =========================================================
   SEARCH SUGGESTIONS
   ========================================================= */

.suggestions {
  position: absolute;

  left: 0;
  right: 0;

  top: auto;
  bottom: calc(100% + 6px);

  z-index: 2000;

  display: none;

  max-height: 280px;

  overflow-y: auto;

  background: #111820;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.09
    );

  border-radius: 9px;

  box-shadow:
    0 15px 35px
    rgba(
      0,
      0,
      0,
      0.35
    );
}

.suggestions.visible {
  display: block;
}

.suggestion {
  padding:
    10px 12px;

  border-bottom:
    1px solid
    rgba(
      255,
      255,
      255,
      0.05
    );

  cursor: pointer;

  transition:
    background-color 0.15s ease;
}

.suggestion:last-child {
  border-bottom: none;
}

.suggestion:hover,
.suggestion.selected {
  background: #19212a;
}

.suggestion-name {
  color: #e7edf5;

  font-size: 13px;

  font-weight: 600;
}

.suggestion-details {
  margin-top: 3px;

  color: #718093;

  font-size: 11px;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
  display: flex;

  flex-direction: column;

  min-width: 0;
  min-height: 0;

  background: #0d1218;

  border-left:
    1px solid
    rgba(
      255,
      255,
      255,
      0.07
    );

  overflow: hidden;
}


/* =========================================================
   SIDEBAR HEADER
   ========================================================= */

.sidebar-header {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 16px;

  padding:
    20px 18px;

  border-bottom:
    1px solid
    rgba(
      255,
      255,
      255,
      0.07
    );

  background: #10161d;
}

.sidebar-header h2 {
  font-size: 16px;

  font-weight: 700;

  color: #edf2f7;

  line-height: 1.2;
}

.subtitle {
  display: block;

  margin-top: 4px;

  color: #687687;

  font-size: 11px;
}


/* =========================================================
   SIDEBAR ACTIONS
   ========================================================= */

.sidebar-actions {
  display: flex;

  align-items: center;

  gap: 8px;
}

.count {
  min-width: 28px;

  height: 28px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  padding:
    0 8px;

  border-radius: 7px;

  background: #19212a;

  color: #a8b5c4;

  font-size: 12px;

  font-weight: 700;
}

.refresh-button {
  height: 30px;

  padding:
    0 11px;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.08
    );

  border-radius: 7px;

  background: #151c24;

  color: #bac5d2;

  font-size: 11px;

  font-weight: 600;

  cursor: pointer;

  transition:
    background-color 0.18s ease,
    border-color 0.18s ease;
}

.refresh-button:hover {
  background: #1b242e;

  border-color:
    rgba(
      255,
      255,
      255,
      0.15
    );
}

.refresh-button:disabled {
  opacity: 0.55;

  cursor: default;
}


/* =========================================================
   EARTHQUAKE LIST
   ========================================================= */

#earthquake-list {
  flex: 1;

  min-height: 0;

  overflow-y: auto;

  padding: 8px;
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

#earthquake-list::-webkit-scrollbar,
.suggestions::-webkit-scrollbar {
  width: 7px;
}

#earthquake-list::-webkit-scrollbar-track,
.suggestions::-webkit-scrollbar-track {
  background: transparent;
}

#earthquake-list::-webkit-scrollbar-thumb,
.suggestions::-webkit-scrollbar-thumb {
  background: #2b3541;

  border-radius: 10px;
}

#earthquake-list::-webkit-scrollbar-thumb:hover,
.suggestions::-webkit-scrollbar-thumb:hover {
  background: #3a4654;
}


/* =========================================================
   EARTHQUAKE ITEM
   ========================================================= */

.earthquake {
  padding:
    13px 12px;

  margin-bottom: 6px;

  border:
    1px solid
    rgba(
      255,
      255,
      255,
      0.06
    );

  border-radius: 9px;

  background: #111820;

  cursor: pointer;

  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.earthquake:hover {
  background: #161e27;

  border-color:
    rgba(
      255,
      255,
      255,
      0.11
    );

  transform: translateY(-1px);
}

.eq-header {
  display: flex;

  align-items: center;

  justify-content: space-between;
}

.magnitude {
  font-size: 13px;

  font-weight: 700;
}

.eq-location {
  margin-top: 6px;

  color: #dce4ec;

  font-size: 12px;

  font-weight: 600;

  line-height: 1.4;
}

.eq-details {
  margin-top: 7px;

  color: #718093;

  font-size: 11px;

  line-height: 1.6;
}

.depth-category {
  color: #8b98a8;
}


/* =========================================================
   LOADING
   ========================================================= */

.loading {
  min-height: 120px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 9px;

  padding: 20px;

  color: #718093;

  font-size: 12px;

  text-align: center;
}

.loading-spinner {
  width: 14px;
  height: 14px;

  border:
    2px solid
    rgba(
      255,
      255,
      255,
      0.12
    );

  border-top-color: #60a5fa;

  border-radius: 50%;

  animation:
    spinner 0.8s linear infinite;
}

@keyframes spinner {

  to {
    transform: rotate(360deg);
  }

}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
  width: 100%;

  height: 42px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 10px;

  padding:
    0 16px;

  background: #090d12;

  border-top:
    1px solid
    rgba(
      255,
      255,
      255,
      0.06
    );

  color: #5f6d7d;

  font-size: 10px;

  white-space: nowrap;
}

.footer-separator {
  color: #394451;
}


/* =========================================================
   RESPONSIVE PC
   ========================================================= */

@media (max-width: 1300px) {

  main {
    grid-template-columns:
      minmax(0, 1fr)
      340px;
  }

  .controls {
    grid-template-columns:
      minmax(190px, 1.6fr)
      1.15fr
      1fr
      1fr
      1fr;
  }

}


@media (max-width: 1050px) {

  main {
    grid-template-columns:
      minmax(0, 1fr)
      310px;
  }

  .controls {
    grid-template-columns:
      repeat(
        2,
        minmax(
          0,
          1fr
        )
      );
  }

  .search-control {
    grid-column:
      1 / -1;
  }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 800px) {

  html,
  body {

    width: 100%;
    height: 100%;

    overflow: hidden;

  }


  /* -------------------------------------------------------
     MAIN
     ------------------------------------------------------- */

  main {

    display: flex !important;

    flex-direction: column !important;

    width: 100%;

    height:
      calc(
        100vh - 42px
      ) !important;

    min-height: 0 !important;

    overflow: hidden !important;

  }


  /* -------------------------------------------------------
     MAP SECTION
     ------------------------------------------------------- */

  .map-section {

    position: relative !important;

    display: flex !important;

    flex-direction: column !important;

    width: 100%;

    height: auto !important;

    min-height: 0 !important;

    flex:
      1 1 auto !important;

    overflow: hidden !important;

  }


  /* -------------------------------------------------------
     MAPA
     ------------------------------------------------------- */

  #map {

    position: relative !important;

    inset: auto !important;

    width: 100%;

    height: auto !important;

    min-height: 0 !important;

    flex:
      1 1 auto !important;

  }


  /* -------------------------------------------------------
     TITULO WORLD EARTHQUAKES
     ------------------------------------------------------- */

  .map-title {

    position: absolute !important;

    top: 10px !important;

    left: 10px !important;

    right: 10px !important;

    width: auto !important;

    max-width: none !important;

    box-sizing: border-box !important;

    padding:
      7px 9px !important;

    display: flex !important;

    align-items: center !important;

    justify-content: space-between !important;

    gap: 8px !important;

    border-radius: 8px !important;

    z-index: 1000 !important;

  }


  .map-title h1 {

    margin: 0 !important;

    padding: 0 !important;

    font-size: 13px !important;

    line-height: 1.2 !important;

    white-space: nowrap !important;

    overflow: hidden !important;

    text-overflow: ellipsis !important;

  }


  /* -------------------------------------------------------
     LIVE
     ------------------------------------------------------- */

  .map-live {

    flex-shrink: 0 !important;

    display: flex !important;

    align-items: center !important;

    gap: 4px !important;

    min-height: 0 !important;

    padding:
      4px 6px !important;

    border-left:
      1px solid
      rgba(
        255,
        255,
        255,
        0.12
      ) !important;

    border-radius: 5px !important;

  }


  .map-live img {

    width: 8px !important;

    height: 8px !important;

  }


  .map-live span {

    font-size: 8px !important;

    line-height: 1 !important;

  }


  /* -------------------------------------------------------
     CONTROLES
     ------------------------------------------------------- */

  .controls {

    position: relative !important;

    left: auto !important;

    right: auto !important;

    top: auto !important;

    bottom: auto !important;

    width: 100% !important;

    height: 250px !important;

    min-height: 150px !important;

    max-height: 55vh !important;

    flex:
      0 0 250px !important;

    box-sizing: border-box !important;

    display: grid !important;

    grid-template-columns:
      1fr !important;

    gap: 8px !important;

    padding: 10px !important;

    overflow-y: auto !important;

    background:
      rgba(
        11,
        15,
        20,
        .97
      ) !important;

    border:
      1px solid
      rgba(
        255,
        255,
        255,
        .08
      ) !important;

    border-radius:
      12px
      12px
      0
      0 !important;

    box-shadow:
      0 -8px 25px
      rgba(
        0,
        0,
        0,
        .25
      ) !important;

    z-index: 600 !important;

  }


  .control {

    min-width: 0;

  }


  .search-control {

    grid-column: auto !important;

  }


  .control select {

    width: 100% !important;

    min-height: 40px;

    font-size: 13px;

  }


  .search input {

    min-height: 40px;

    font-size: 13px;

  }


  /* -------------------------------------------------------
     SIDEBAR LATERAL
     ------------------------------------------------------- */

  .sidebar {

    position: fixed !important;

    top: 0 !important;

    right: 0 !important;

    bottom: 0 !important;

    left: auto !important;

    width: 85vw !important;

    max-width: 390px !important;

    height: 100vh !important;

    min-height: 100vh !important;

    max-height: none !important;

    margin: 0 !important;

    display: flex !important;

    flex-direction: column !important;

    z-index: 9500 !important;

    background: #0d1218 !important;

    border:
      none !important;

    border-left:
      1px solid
      rgba(
        255,
        255,
        255,
        .10
      ) !important;

    box-shadow:
      -12px 0 35px
      rgba(
        0,
        0,
        0,
        .45
      ) !important;

    overflow: hidden !important;

    transform:
      translateX(100%) !important;

    transition:
      transform .3s
      cubic-bezier(
        .4,
        0,
        .2,
        1
      );

  }


  .sidebar.mobile-latest-open {

    transform:
      translateX(0) !important;

  }


  /* -------------------------------------------------------
     BOTON LATERAL
     ------------------------------------------------------- */

  #mobile-latest-button {

    display: flex !important;

    position: fixed !important;

    top: 50% !important;

    right: 0 !important;

    transform:
      translateY(-50%) !important;

    width: 46px !important;

    min-height: 135px !important;

    padding:
      8px 4px !important;

    align-items: center !important;

    justify-content: center !important;

    flex-direction: column !important;

    gap: 8px !important;

    background: #111820 !important;

    color: #ffffff !important;

    border:
      1px solid
      rgba(
        255,
        255,
        255,
        .12
      ) !important;

    border-right: none !important;

    border-radius:
      10px
      0
      0
      10px !important;

    box-shadow:
      -4px 0 15px
      rgba(
        0,
        0,
        0,
        .30
      ) !important;

    z-index: 9999 !important;

    cursor: pointer !important;

    opacity: 1 !important;

    pointer-events: auto !important;

  }


  #mobile-latest-button:active {

    transform:
      translateY(-50%)
      scale(.96) !important;

  }


  .mobile-latest-icon {

    font-size: 18px;

    line-height: 1;

  }


  .mobile-latest-text {

    writing-mode:
      vertical-rl;

    transform:
      rotate(180deg);

    font-size: 8px;

    font-weight: 800;

    letter-spacing: .7px;

    line-height: 1.2;

    white-space: nowrap;

  }


  #mobile-latest-button.mobile-latest-hidden {

    opacity: 0 !important;

    pointer-events: none !important;

    transform:
      translate(
        20px,
        -50%
      ) !important;

  }


  /* -------------------------------------------------------
     OVERLAY
     ------------------------------------------------------- */

  #mobile-latest-overlay {

    display: block !important;

    position: fixed !important;

    inset: 0 !important;

    background:
      rgba(
        0,
        0,
        0,
        0
      );

    opacity: 0;

    pointer-events: none;

    z-index: 9000;

    transition:
      opacity .3s ease;

  }


  #mobile-latest-overlay.mobile-latest-overlay-visible {

    opacity: 1;

    background:
      rgba(
        0,
        0,
        0,
        .38
      );

    pointer-events: auto;

  }


  /* -------------------------------------------------------
     BOTON X DEL SIDEBAR
     ------------------------------------------------------- */

  #mobile-latest-close {

    display: flex !important;

    position: absolute !important;

    top: 10px !important;

    right: 10px !important;

    width: 38px !important;

    height: 38px !important;

    align-items: center !important;

    justify-content: center !important;

    padding: 0 !important;

    border: none !important;

    border-radius: 50% !important;

    background:
      rgba(
        255,
        255,
        255,
        .08
      ) !important;

    color: #ffffff !important;

    font-size: 28px !important;

    line-height: 1 !important;

    z-index: 20 !important;

    cursor: pointer !important;

  }


  #mobile-latest-close:active {

    background:
      rgba(
        255,
        255,
        255,
        .18
      ) !important;

  }


  /* -------------------------------------------------------
     CABECERA LATEST
     ------------------------------------------------------- */

  .sidebar-header {

    flex-shrink: 0 !important;

    padding:
      20px
      58px
      15px
      15px !important;

  }


  .sidebar-header h2 {

    font-size: 16px;

  }


  .subtitle {

    font-size: 10px;

  }


  /* -------------------------------------------------------
     LISTA LATEST
     ------------------------------------------------------- */

  #earthquake-list {

    flex: 1 !important;

    min-height: 0 !important;

    overflow-y: auto !important;

    -webkit-overflow-scrolling:
      touch;

    padding: 8px !important;

  }


  /* -------------------------------------------------------
     FOOTER
     ------------------------------------------------------- */

  footer {

    flex:
      0 0 42px !important;

    width: 100% !important;

    height: 42px !important;

    min-height: 42px !important;

    box-sizing: border-box !important;

    justify-content: flex-start;

    overflow: hidden;

    text-overflow: ellipsis;

  }


  footer .footer-separator {

    display: none;

  }

}


/* =========================================================
   TELEFONO PEQUEÑO
   ========================================================= */

@media (max-width: 420px) {

  .map-title {

    top: 8px !important;

    left: 8px !important;

    right: 8px !important;

    padding:
      7px 9px !important;

  }


  .map-title h1 {

    font-size: 12px !important;

  }


  .map-live {

    padding:
      4px 5px !important;

  }


  .map-live img {

    width: 7px !important;

    height: 7px !important;

  }


  .map-live span {

    font-size: 7px !important;

  }


  .controls {

    height: 235px !important;

    flex:
      0 0 235px !important;

  }


  #mobile-latest-button {

    width: 44px !important;

    min-height: 125px !important;

  }


  .mobile-latest-text {

    font-size: 7px;

  }


  .sidebar {

    width: 88vw !important;

  }

}
/* =========================================================
   SIDEBAR MOBILE MÁS PEQUEÑA
   ========================================================= */

@media (max-width: 800px) {

  .sidebar {
    width: 75vw !important;
    max-width: 320px !important;
  }

  .sidebar-header {
    padding:
      16px
      50px
      12px
      13px !important;
  }

  .sidebar-header h2 {
    font-size: 15px !important;
  }

  .subtitle {
    font-size: 9px !important;
  }

  #earthquake-list {
    padding: 6px !important;
  }

  .earthquake {
    padding:
      10px 10px !important;

    margin-bottom: 5px !important;
  }

  .eq-location {
    font-size: 11px !important;
  }

  .eq-details {
    font-size: 10px !important;
  }

  .magnitude {
    font-size: 12px !important;
  }

}


@media (max-width: 420px) {

  .sidebar {
    width: 78vw !important;
    max-width: 300px !important;
  }

}