@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css");
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300&display=swap');

:root {
  --myBlue: #4466ff;
  --secondColor: #21262b;
  --secondColorLight: #273038;
  --secondColorDark: #171b1f;
  --headerHeight: 187px;
}
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: 0;
  outline: 0;
}
body {
  height: 100%;
  background: var(--secondColorDark);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif';
}

/*Custom scrollbar*/
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background-color: transparent;
  margin: 5px 5px 5px 0px;
}
::-webkit-scrollbar-thumb {
  background-color: #999;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #777;
}

#main-container {
  position: absolute;
  width: 100%;
  height: 92%;
  max-width: 550px;
  min-height: 550px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);   
  background-color: #fcfeffa1;
  border-radius: 7px;
  box-shadow: 0;
  overflow-y: hidden;
}

#empty-message {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  color: #555;
  font-family: 'Tajawal';
}

/*search bar style and position*/
#search-bar {
  position: relative;
  width: 100%;
  height: 70px;
  padding: 20px 0;
  text-align: center;
  background-color: var(--secondColor);
  display: flex;
  justify-content: space-between;
}
#search-box-container {
  position: relative;
  height: 60px;
  width: 70%;
  margin: 0 20px;
}
#search-box {
  width: 100%;
  height: 35px;
  padding:  0 0 0 35px;
  font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
  font-size: 11pt;
  line-height: 11pt;
  color: #fff;
  background-color: var(--secondColorLight);
  border-radius: 5px;
  transition: background-color 0.3s;
}
#search-box:focus {
  background-color: rgba(0, 0, 0, 0.37);
  border: 1px solid var(--myBlue);
}
#search-icon {
  position: absolute;
  top: 9px;
  left: 10px;
  color: #fff;
}
#loading-icon {
  position: absolute;
  right: 35px;
  top: 8px;
  width: 20px;
  height: 20px;
  background-image: url(assets/pics/loading.svg);
  background-size: contain;
  display: none;
}
#location-btn {
  position: absolute;
  right: 8px;
  top: 3px;
  height: 30px;
  font-size: 16px;
  color: #fff;
  background-color: transparent;
  cursor: pointer;
}
#location-btn:hover {
  color: #bbb;
}
#location-btn:active {
  color: #fff;
}

/* Tempretaure unit toggle switch*/ 
#temp-unit-checkbox {
  width: 0;
  height: 0;
  opacity: 0;
  visibility: hidden;
}
#temp-unit-container {
  position: relative;
  right: 20px;
  top: 5px;
  padding: 2px 8px;
  font-size: 18px;
  font-family: 'Segoe UI', Tahoma, Verdana;
  background-color: var(--secondColorLight);
  color: white;
  border-radius: 3px;
  cursor: pointer;
}
#toggle-thumb {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translate(0, -50%);
  width: 23px;
  height: 23px;
  background-color: var(--myBlue);
  border-radius: 3px;
  transition: transform 0.3s;
}
#temp-unit-toggle {
  z-index: 999;
}
#temp-unit-checkbox:checked + #temp-unit-container > #toggle-thumb {
  transform: translate(25px, -50%);
}

/*search results list*/
#search-resultbox {
  position: absolute;
  z-index: 999;
  left: 20px;
  top: 60px;
  width: 70%;
  font-family: 'Tajawal', Tahoma, Arial;;
  font-weight: 500;
  font-size: 12pt;
  color: #fff;
  list-style: none;
  background-color: var(--secondColor);
  border-radius: 5px;
  box-shadow: 0px 0px 5px #aaa;
  display: block;
}
#search-resultbox > li {
  width: 100%;
  height: 35px;
  text-align: left;
  padding: 7px 0 5px 10px;
  border-bottom: 1px solid #222;
  border-radius: 5px;
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
  transition: background-color 0.1s;
  cursor: pointer;
}
#search-resultbox > li:hover {
  background-color: var(--myBlue);
}

/*Topbar styling*/
#topbar {
  position: relative;
  width: 100%;
  height: 70px;
  margin-top: -1px;
  color: white;
  font-family: 'Tajawal', Tahoma, Arial;
  font-size: 12pt;
  background-color: var(--secondColor);    
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}
#topbar > div:nth-child(1) {
  margin: 5px 20px;
}
#topbar > div:nth-child(2) {
  margin: 5px 20px;
}
#current-location-info {
  max-width: 75%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*Weather forecast timespan navbar*/
#navbar {
  width: 100%;
  height: 50px;
  margin-top: -1px;
  background-color: var(--secondColor);
  text-align: center;
}
#navbar > button {
  position: relative;
  top: 50%;
  transform: translate(0, -50%);
  height: 45px;
  margin: 0 3%;
  padding: 0 10px;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, Verdana;
  font-weight: 500;
  font-size: 15pt;
  color: #fff;
  background-color: transparent;
  border-width: 4px 0 4px; 
  border-style: solid;
  border-color: transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s, border 0.2s;
}
#navbar > button:hover {
  background-color: rgba(0,0,0,0.2);
  border-color: transparent transparent var(--myBlue);
}
#navbar .current-nav {
  background-color: rgba(0,0,0,0.3);
}

/*Today section styling*/
#today-weather-container {
  width: 100%;
  height: calc(100% - var(--headerHeight));
  margin-top: -1px;
  overflow-y: auto;
  display: none;
  transition: opacity 0.3s, transform 0.3s;
  cursor: default;
  background-color: white;
}
#today-weather-summary {
  position: relative;
  width: 100%;
  height: 110px;
  font-family: Tahoma, Arial;
  font-size: 24pt;
  font-weight: 500;
  color: #ccc;
  text-shadow: 2px 2px #000;
  background: url(assets/pics/thunder_night.jpg);
  background-size: cover;
  box-shadow: 0 2px 6px #222;
}
#today-location-details {
  display: block;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  font-family: 'Barlow Condensed', Tahoma, Arial;;
  font-size: 16pt;
  line-height: 20pt;
  color: #fff;
  background-color: rgba(0,0,0,0.5);
}
#today-weather-icon {
  position: absolute;
  top: 35px;
  left: 10px;
  width: 70px;
  height: 70px;
  font-size: 54px;
  background-repeat: no-repeat;
  background-size: contain;
}
#today-weather-status {
  position: absolute;
  left: 85px;
  top: 50%;
  transform: translate(0, -20%);
  font-family: 'Tajawal', Tahoma, Arial;
  font-weight: 700;
  font-size: 34pt;
  line-height: 28px;
}
#today-sky-status {
  position: relative;
  font-size: 18pt;
}
#today-details {
  height: calc(100% - 110px);
  width: 100%;
  display: grid;
  gap: 10px 20px;
  grid-template-columns: 90%;
  padding: 20px 20px;
  justify-content: center;
  font-family: 'Barlow Condensed', Tahoma, Arial;
  font-size: 16pt;
  font-weight: 700;
}
#today-details > div {
  position: relative;
  height: 35px;
  padding: 5px 0 5px 10px;
  border-left: 5px solid var(--myBlue);
}
.detail-value {
  position: absolute;
  right: 0px;
  font-weight: bold;
}

/*ّforcast sections styling*/
#hourly-container, #daily-container {
  width: 100%;
  height: calc(100% - var(--headerHeight));
  overflow-y: scroll;
  display: none;
  transition: opacity 0.3s, transform 0.3s;
}
.forecast-element {
  position: relative;
  width: 100%;
  height: 40px;
  font-family: 'Barlow Condensed', Tahoma, Arial;
  font-size: 16pt;
  border-bottom: var(--secondColor) solid 1px;
  transition: height 0.2s;
  cursor: pointer;
}
.forecast-element-time {
  position: absolute;
  left: 10px;
  top: 5px;
}
.forecast-element-icon {
  position: relative;
  display: inline-block;
  left: 110px;
  top: 8px;
  width: 24px;
  height: 24px;
  background-repeat: no-repeat;
  background-size: contain;
}
.forecast-element-temp {
  position: relative;
  left: 120px;
  top: 5px;
  font-weight: bold;
}
.forecast-element-status {
  position: relative;
  left: 130px;
  top: 5px;
}
.forecast-element-arrow {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 12pt;
  color: var(--myBlue);
  transition: transform 0.2s;
}
.forecast-element-detail {
  position: relative;
  width: 100%;
  height: 0px;
  top: 10px;
  display: grid;
  grid-template-columns: 45% 45%;
  gap: 0px 0px;
  justify-content: space-evenly;
  font-size: 16pt;
  overflow: hidden;
  transition: height 0.2s;
}
.forecast-element-detail-item {
  position: relative;
  height: 35px;
  padding: 5px 0 0 5px;
  border-bottom: var(--secondColor) solid 1px;
  font-size: 14pt;
}
.detail-icon {
  color: var(--myBlue);
}

footer {
  position: absolute;
  width: 100%;
  max-width: 550px;
  left: 50%;
  bottom: 1%;
  transform: translate(-50%, 0);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 10pt;
  color: #fff;
  display: flex;
  justify-content: space-around;
}

/*Responsive adjustements*/
@media only screen and (min-width: 480px) {
  body {
    background: linear-gradient(135deg, rgba(255,134,0,1) 8%, rgba(0,149,255,1) 85%, rgba(0,114,255,1) 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
  }
  #main-container {
    max-height: 600px;
    box-shadow: 5px 10px 7px rgba(0,0,0,0.5);
  }
  #topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  #today-details {grid-template-columns: 45% 45%;}
}