*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --gray-950: hsl(0, 0%, 17%);
  --gray-400: hsl(0, 0%, 58%);
  --gray-200: hsl(0, 0%, 86%);
  --white: hsl(0, 0%, 100%);
  --red-500: hsl(356, 75%, 53%);

  --font-family: "Rubik", sans-serif;

  --header-height: 200px;
  --gutter-desktop: 300px;
  --gutter-tablet: 60px;
  --gutter-mobile: 100px;

  --fs-heading: 2rem;
  --fs-label: 0.875rem;
  --fs-body: 1rem;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  font-family: var(--font-family);
}

.header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
  background-image: url("/images/pattern-bg-desktop.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  width: 100%;
  height: var(--header-height);
  overflow: visible;
}

.header-title {
  font-size: var(--fs-heading);
  color: var(--white);
  font-weight: bold;
  margin: 20px 0 0 0;
}

.error-message {
  display: none;
  position: relative;
  color: var(--red-500);
  padding: 10px 16px;
  border-radius: 8px;
  background-color: hsl(356, 90%, 96%);
  font-size: 0.875rem;
  font-weight: 500;
  width: fit-content;
}

.form-search {
  display: flex;
  flex-direction: column;
}
.search-card {
  display: flex;
  align-items: center;
  width: fit-content;
  height: fit-content;

  border-radius: 15px;
  background-color: var(--white);
  overflow: hidden;
}
.search-input {
  color: var(--gray-950);
  font-size: 16px;
  padding-left: 15px;
  width: 400px;
  height: 40px;
   
  border: none;
}
.search-input:focus-visible {
  outline: 2px solid var(--gray-950);
  outline-offset: -2px;
}

.search-button {
  flex: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--gray-950);
  border: none;
}
.search-button.loading .arrow-icon {
  visibility: hidden; /* keeps layout size, just hides icon */
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.search-button.loading .spinner {
  display: block;
  position: absolute; /* sits where the icon was */
}

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

.search-button:hover {
  opacity: 0.9;
}
.search-button:active {
  transform: scale(0.98);
}
.arrow-icon {
  width: 15px;
  height: 15px;
}
.container {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  width: calc(100dvw - var(--gutter-desktop));
  max-width: 1000px;
  height: auto;
  border-radius: 20px;
  background-color: var(--white);
  z-index: 999;
}
.container-loader {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.container-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-right: 10px;
  gap: 10px;
  justify-content: flex-start;
}
.card-label-value {
  font-size: var(--fs-body);
}

.card-title {
  font-size: var(--fs-body);
  color: var(--gray-400);
}
.container.loading .container-card {
  opacity: 0.3;
  pointer-events: none;
}
.container.loading .container-loader {
  display: flex;
}
.container-loader .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: bounce 0.6s infinite ease-in-out both;
}
.container-loader .dot:nth-child(1) {
  animation-delay: -0.32s;
}
.container-loader .dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.ip-address-card,
.location-card,
.timezone-card {
  border-right: 1px solid var(--gray-200);
}

#map {
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.attribution {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  text-align: center;
  padding: 10px 0;
  background-image: url("/images/pattern-bg-desktop.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-color: var(--white);
  z-index: 10;
}
.attribution a {
  color: var(--white);
}
@media (min-width: 491px) and (max-width: 600px) {
  .card-title,
  .card-label-value {
    font-size: var(--fs-label);
  }
}

@media (min-width: 491px) and (max-width: 1023px) {
  .card-label-value {
    flex: 1;
  }
  .search-input {
    font-size: var(--fs-body);
    width: 340px;
  }

  .container {
    width: calc(100dvw - var(--gutter-tablet));
    max-width: 724px;
    height: auto;
    gap: 10px;
  }

  .container-card {
    padding-right: 5px;
    flex: 1;
  }
}

@media (max-width: 490px) {
  .card-title {
    font-size: var(--fs-label);
  }
  .card-label-value {
    font-size: var(--fs-body);
  }
  .search-card {
    width: calc(100dvw - var(--gutter-mobile));
    max-width: 380px;
  }
  .search-input {
    font-size: var(--fs-label);
    width: 100%;
  }
  .container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: calc(100dvw - var(--gutter-mobile));
    padding: 10px 20px;
    gap: 5px;
  }
  .container-card {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    gap: 10px;
    padding: 5px 0 10px 0;
  }
  .ip-address-card,
  .location-card,
  .timezone-card {
    border-bottom: 1px solid var(--gray-200);
    border-right: none;
  }

  .container-card:first-child {
    padding-top: 0;
  }

  .isp-card {
    padding: 5px 0 0 0;
  }
}
