/* setting defaults */
:root {
  --bg-gradient: linear-gradient(135deg, #34495e 0%, #5dade2 100%); /* overrided by javascript*/
  --card-bg: rgba(255, 255, 255, 0.30);
  --text-color: #ffffff;
  --border-radius: 15px; /* rounded corners */
  --spacing: 15px;
}

/* global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box; /* include padding and border in element's width/height */
}

body {
font-family: 'Quicksand', 'Varela Round', 'Comfortaa', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-color, #fff);
}
.container {
  max-width: 1200px;
  margin: 0 auto; /* center */
  padding: 20px;
}
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px); /* blur items behind the navbar */
  border-radius: var(--border-radius);
  padding: 15px 20px;
  margin-bottom: 20px; /* space below */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  gap: 15px;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-height: 60px;
  position: sticky;
  top: 20px; /* stick to top with some space*/
  z-index: 100; /* stays above other content */
}


.search-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.controls-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease; /* page loading animation */
  min-width: 150px;
  max-width: 300px;
}

#search-input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

#search-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

button {
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.2);
  color: #333;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

button:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px); /* lift effect */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
button:active {
  transform: translateY(0); /* reset position when clicked */
}
#geo-btn {
  min-width: auto;
}

/* --------------------------------
   RESPONSIVE BREAKPOINTS
-------------------------------- */
/* medium screen (tablets) */
@media (max-width: 900px) {
  #geo-btn {
    font-size: 0.8rem;     /* smaller font */
    padding: 10px 12px;    /* less padding */
  }
}

/* mobile landscape */
@media (max-width: 768px) {
  #search-btn {
    padding: 10px 12px;    /* less padding */
    font-size: 0.8rem;     /* smaller font */
  }
  
  #geo-btn {
    padding: 10px 8px;     /* even less padding */
    font-size: 0.75rem;    /* even smaller font */
  }
  
  #search-input {
    font-size: 0.85rem;    /* smaller input font */
    min-width: 120px;      /* smaller minimum width */
  }
}

/* --------------------------------
   MOBILE LAYOUT (PORTRAIT)
-------------------------------- */
@media (max-width: 600px) {
  .navbar {
    padding: 15px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  
  /* search section on top */
  .search-section {
    display: flex;
    align-items: center;
    width: 100%;
    order: 1;
  }
  
  #search-input {
    width: 100%;
    font-size: 0.9rem;
    padding: 12px 15px;
    border-radius: 25px;
    min-width: unset;
    max-width: unset;
    flex: 1;
  }
  
  /* controls section BELOW search */
  .controls-section {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
    order: 2;
  }
  
  /* all control buttons equal in width */
  #geo-btn,
  #favorites-btn,
  .favorites-wrapper {
    flex: 1;
    height: 45px;
    max-width: none;
  }
  
  #geo-btn {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-indent: -9999px; /* hide text */
    position: relative;
    overflow: hidden;
  }
  
  #geo-btn::after {
    content: "📍";
    font-size: 1.1rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-indent: 0;
  }
  
  #favorites-btn {
    width: 100%;
    height: 45px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-indent: -9999px; /* hide text */
    position: relative;
    overflow: hidden;
  }
  
  #favorites-btn::after {
    content: "⭐";
    font-size: 1.1rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-indent: 0;
  }
  
  #unit-selector {
    flex: 1;
    height: 45px;
    font-size: 0.85rem;
    text-align: center;
    min-width: unset;
    max-width: unset;
  }

  #favorites-menu {
    right: 0;
    left: auto;
    min-width: 180px;
    margin-top: 5px;
  }
}

/* ================================
   VERY SMALL SCREENS
   ================================ */
@media (max-width: 480px) {
  .navbar {
    padding: 12px;
    gap: 10px;
  }
  
  .controls-section {
    gap: 6px;
  }
  
  #geo-btn,
  #favorites-btn,
  .favorites-wrapper {
    flex: 1;
    height: 42px;
  }
  
  #unit-selector {
    flex: 1;
    height: 42px;
    font-size: 0.8rem;
  }
  
  #search-input {
    font-size: 0.85rem;
    padding: 10px 12px;
  }
}

#unit-selector {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  color: #333;
  padding: 10px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  min-width: 60px;
  flex-shrink: 0;
}

#unit-selector:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.5);
}

#unit-selector:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

#unit-selector option {
  background: var(--card-bg);
  color: #333;
  padding: 8px;
}

.favorites-wrapper {
  position: relative;
  flex-shrink: 0;
}

#favorites-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  padding: 10px;
  margin-top: 10px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  z-index: 1000;
}

#favorites-menu.hidden {
  display: none;
}

.fav-item {
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
  color: #333;
}

.fav-item:hover {
  background: rgba(166, 166, 166, 0.2);
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#current-weather {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding-bottom: 60px; /* space for the favorites button */
}

#current-weather div { /* take up available space */
  flex: 1;
}

#current-weather h1 {
  font-size: 2rem;
  margin-bottom: 10px;
}

#current-weather .temp {
  font-size: 4rem;
  font-weight: bold;
  margin: 10px 0;
  margin-bottom: 10px;
}

#current-weather img {
  max-width: 120px;
  height: auto;
}


#fav-star {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: #333;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(15px);
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#fav-star:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.4));
  border-color: rgba(255, 255, 255, 0.9);
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#current-weather p:last-of-type {
  margin-bottom: 10px;
}

.hourly-container {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding: 10px 0;
}

.hour-item {
  flex: 0 0 auto;
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  min-width: 80px;
}

.hour-item .time {
  font-size: 0.9rem;
  margin-bottom: 8px;
  opacity: 0.9;
}

.hour-item img {
  width: 40px;
  height: 40px;
  margin: 5px 0;
}

.hour-item .temp {
  font-weight: bold;
  margin-top: 8px;
}

.forecast-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.day img {
  width: 50px;
  height: 50px;
}

#comparison-chart {
  max-height: 400px;
  margin: 10px 0;
}

.card canvas {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
}

.timezone-info {
  text-align: center;
  margin-bottom: 10px;
  opacity: 0.8;
  font-style: italic;
}

.timezone-info small {
  font-size: 0.9rem;
  color: var(--text-color);
}

.inline-cards {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.inline-card {
  flex: 1;
  text-align: center;
  padding: 20px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.inline-card h3 {
  margin: 0 0 15px 0;
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 500;
}

.metric-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.metric-value .value {
  font-size: 2.5rem;
  font-weight: bold;
  color: #333;
}

.metric-value .label {
  font-size: 0.9rem;
  opacity: 0.8;
  color: #666;
}


/* CHANGE SOME THINGS HERE CAUSE THE COLORS DON'T SHOW UP AT ALL

/* UV Index color coding */
.uv-low { color: #4CAF50; }
.uv-moderate { color: #FFC107; }
.uv-high { color: #FF9800; }
.uv-very-high { color: #F44336; }
.uv-extreme { color: #9C27B0; }

/* Humidity color coding */
.humidity-low { color: #FF9800; }
.humidity-normal { color: #4CAF50; }
.humidity-high { color: #2196F3; }

/* Responsive */
@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    gap: 8px;
  }
  
  #current-weather {
    flex-direction: column;
    text-align: center;
  }
  
  .forecast-container {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  
  .inline-cards {
    gap: 15px;
  }
  
  .inline-card {
    padding: 15px;
    min-height: 100px;
  }
  
  .inline-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
  }
  
  .metric-value .value {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .inline-cards {
    flex-direction: column;
    gap: 15px;
  }
  
  .inline-card {
    min-height: 80px;
    padding: 15px;
  }
  
  .metric-value .value {
    font-size: 1.8rem;
  }
}

/* Current weather card positioning */
#current-weather {
  position: relative; /* Enable positioning for child elements */
  padding-bottom: 60px; /* Add space for the button */
}

/* Favorites star button positioning */
#fav-star {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: #333;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(15px);
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#fav-star:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.4));
  border-color: rgba(255, 255, 255, 0.9);
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Ensure the current weather content doesn't overlap with the button */
#current-weather .temp {
  margin-bottom: 10px;
}

#current-weather p:last-of-type {
  margin-bottom: 10px;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
  #current-weather {
    padding-bottom: 55px; /* Slightly less space on mobile */
  }
  
  #fav-star {
    bottom: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  #current-weather {
    padding-bottom: 50px;
  }
  
  #fav-star {
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
}