@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'DM Sans', sans-serif;
  color: #222831;
}

html, body {
  min-height: 100svh;
  background: #fff;
}
header,footer{
  display: flex;
  align-items: center;
  pointer-events: none;
}
header{
  height: 65px;
  padding-left: 20px;
  border-bottom: 0.1px dotted #ccc;
}
footer{
  height: 40px;
  display: flex;
  justify-content: flex-end;
  border-top: 0.5px solid #ccc;
}
header h1{
  font-size: 22px;
}
footer p{
  opacity: 0.8;
  font-size: 15px;
  margin-right: 20px;
}
section{
  height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  padding-top: 20px;
}
section .search-section,
.dropdown-container{
  height: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
#searchField{
  width: 480px;
  border: 1.2px solid #222831;
  outline: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 5px;
  font-size: 1.1em;
}
#searchButton{
  padding: 10px 35px;
  border-radius: 5px;
  background: #222831;
  color: white;
  font-size: 1.1em;
  border: none;
  outline: none;
  width: 140px;
  display: flex;
  justify-content: center;
  transition:all 0.3s ease;

  &:hover{
    background: #374150;
  }
}
section .error-section{
  top: 60%;
  left: 50%;
  transform: translate(-50%, -60%);
  position: absolute;
  height: 60%;
  width: 50%;
  margin: 20px auto 0;
  display: none;
}
.error-section img{
  height: 100%;
  width: 100%;
  object-fit: contain;
}
section .data-section{
  height: 70%;
  width: 80%;
  margin:  20px auto 0;
  display: flex;
  visibility: hidden;
  pointer-events: none;
}
.flag-prt{
  width: 40%;
  height: 100%;
  padding: 10px;
}
.flag-prt img{
  height: 100%;
  width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(0,0,0,0.2));
}
.data-prt{
  height: 100%;
  width: 60%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 35px 10px 50px 10px;
}
.countryName{
  font-size: 45px;
  font-weight: 650;
  text-transform: capitalize;
}
.otherName{
  font-size: 18.5px;
  font-weight: 450;
  opacity: 0.7;
}
.middle-section{
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 10px;
  font-size: 19px;
}
.data-prt .footer{
  font-size: 19px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-weight: 600;
}
.data-prt span{
  opacity: 0.8;
  font-weight: 500;
}
/* Skeleton styles */
.skeleton {
  background: linear-gradient(
    90deg,
    #e0e0e0 25%,
    #f5f5f5 37%,
    #e0e0e0 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 3s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.data-section.loading {
  visibility: visible;
  pointer-events: none;
}

.data-section.loading .flag-prt img {
  display: none;
}

.data-section.loading .flag-prt::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #e0e0e0 25%,
    #f5f5f5 37%,
    #e0e0e0 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 3s ease-in-out infinite;
  border-radius: 8px;
}

.data-section.loading .countryName,
.data-section.loading .otherName,
.data-section.loading .middle-section h4,
.data-section.loading .footer h4 {
  color: transparent;
}

.data-section.loading .countryName::before,
.data-section.loading .otherName::before,
.data-section.loading .middle-section h4::before,
.data-section.loading .footer h4::before {
  content: "";
  display: block;
  height: 1em;
  margin: 5px 0;
  width: 60%;
  background: linear-gradient(
    90deg,
    #e0e0e0 25%,
    #f5f5f5 37%,
    #e0e0e0 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 3s ease-in-out infinite;
  border-radius: 4px;
}

.data-section.loading .middle-section h4::before {
  width: 80%;
}
/* Dropdown Suggestion Styles */
.dropdown-container {
  position: relative;
  width: 480px;
}

.dropdown {
  display: none;
  opacity: 0;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  list-style: none;
  padding: 10px;
  margin-top: 25px;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  z-index: 10;
  border-radius: 6px;
}

.dropdown-item {
  padding: 8px;
  background-color: #f8f8f8;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  text-transform: capitalize;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background-color: #F5F5F5;
}


/* Tablets and below (max-width: 768px) */
@media screen and (max-width: 768px) {
  footer{
    display: flex;
    justify-content: center;
  }
  footer p{
    margin-right: 0px;
  }
  #searchField,
  .dropdown-container {
    width: 90%;
  }

  #searchButton {
    width: 90%;
  }

  section .data-section {
    margin: 15px auto 5px;
    flex-direction: column;
    align-items: center;
    width: 90%;
    height: 100%;
    
  }
  .flag-prt{
    height: 40%;
    width: 100%;
    padding: 0px;
  }
  .data-prt{
    height: 60%;
    width: 100%;
    justify-content: space-evenly;
    padding: 15px 3px 10px;
  }
  .countryName {
    font-size: 30px;
  }
  .middle-section {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  section .error-section{
    height: 70%;
    width: 90%;
  }
}

/* Mobile devices (max-width: 480px) */
@media screen and (max-width: 480px) {
  header{
    height: 55px;
  }
  header h1 {
    font-size: 18.5px;
  }

  footer p {
    font-size: 13px;
  }
  section{
    height: calc(100vh - 65px);
  }
  .search-section,
  .dropdown-container {
    flex-direction: column;
    height: auto;
  }

  #searchField {
    width: 100%;
    font-size: 1em;
  }

  #searchButton {
    width: 90%;
    font-size: 1em;
  }

  .dropdown {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 5px;
  }

  .dropdown-item{
    padding: 9.5px;
  }
  .countryName {
    font-size: 28px;
  }
  .otherName,
  .middle-section,
  .data-prt .footer {
    font-size: 18.5px;
  }
}