/* Global Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Merriweather Sans', sans-serif;
  background: linear-gradient(to bottom right, #112d4e, #3f72af);
  color: #F9F7F7;
  overflow: hidden;
}

/* Wrapper Layout */
.wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

/* Heading */
.heading {
  text-align: center;
  text-transform: uppercase;
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

/* Tabs */
.tab-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.1);
}

.tab.current-tab {
  background-color: rgba(219, 226, 239, 0.5);
}

/* Weather Container */
.weather-container {
  flex: 1;
  overflow-y: auto;
}

/* Sub Containers */
.sub-container {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
}

.sub-container.active,
.loading-container.active,
.user-info-container.active,
.form-container.active {
  display: flex;
}

/* Grant Location */
.grant-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 10px 0;
}

.grant-subtitle {
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.btn {
  padding: 10px 30px;
  background-color: #3f72af;
  border: none;
  border-radius: 5px;
  color: white;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn:hover {
  background-color: #2e5d8f;
}

/* Form Styles */
.form-container {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 20px auto;
  max-width: 550px;
}

.form-container input {
  padding: 10px 20px;
  width: 100%;
  max-width: 400px;
  border: none;
  border-radius: 10px;
  background-color: rgba(219, 226, 239, 0.5);
  color: #fff;
}

.form-container input::placeholder {
  color: rgba(255, 255, 255, 0.7);
  text-transform: capitalize;
}

.form-container input:focus {
  outline: 3px solid rgba(255, 255, 255, 0.7);
}

.search-button {
    width: 42px;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 10px;
}

.search-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.search-button img {
    width: 20px;
    height: 20px;
    filter: invert(0); /* show dark icon */
}

/* Loading */
.loading-container img {
  width: 100px;
  height: 100px;
  margin-bottom: 10px;
}

.loading-text {
  text-transform: uppercase;
  font-size: 1.2rem;
}

/* User Weather Info */
.user-info-container {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 2rem;
}

.name img {
  width: 30px;
  height: 30px;
}

.weather-desc {
  font-size: 1.25rem;
  font-weight: 500;
  margin-top: 8px;
}

.weather-icon {
  width: 90px;
  height: 90px;
  margin-top: 10px;
}

.temperature {
  font-size: 2.5rem;
  font-weight: 600;
  margin-top: 12px;
}

/* Parameters */
.parameter-container {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.parameter {
  width: 160px;
  max-width: 200px;
  padding: 1rem;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.parameter img {
  width: 50px;
  height: 50px;
}

.label {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

.value {
  font-size: 0.95rem;
  font-weight: 300;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #112d4e;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #3f72af;
    border-radius: 10px;
    border: 2px solid #112d4e;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a8bd8;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #3f72af #112d4e;
}

/* ====== MEDIA QUERIES ====== */

/* Mobile Portrait (320px - 480px) */
@media screen and (max-width: 480px) {
  .wrapper {
    padding: 15px;
  }
  
  .heading {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }
  
  .tab-container {
    gap: 10px;
    margin-bottom: 2rem;
  }
  
  .tab {
    padding: 8px 15px;
    font-size: 0.75rem;
    min-width: 80px;
  }
  
  .sub-container {
    padding: 1rem;
  }
  
  .grant-title {
    font-size: 1.2rem;
  }
  
  .grant-subtitle {
    font-size: 0.85rem;
  }
  
  .form-container {
    flex-direction: column;
    gap: 15px;
    max-width: 100%;
  }
  
  .form-container input {
    max-width: 100%;
    padding: 12px 20px;
  }
  
  .search-button {
    margin-left: 0;
    width: 100%;
    max-width: 120px;
    height: 45px;
    border-radius: 10px;
  }
  
  .name {
    font-size: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .weather-desc {
    font-size: 1.1rem;
  }
  
  .weather-icon {
    width: 70px;
    height: 70px;
  }
  
  .temperature {
    font-size: 2rem;
  }
  
  .parameter-container {
    gap: 15px;
    margin-top: 1.5rem;
  }
  
  .parameter {
    width: 140px;
    padding: 0.8rem;
  }
  
  .parameter img {
    width: 40px;
    height: 40px;
  }
  
  .label {
    font-size: 0.9rem;
  }
  
  .value {
    font-size: 0.85rem;
  }
  
  .loading-container img {
    width: 80px;
    height: 80px;
  }
  
  .loading-text {
    font-size: 1rem;
  }
}

/* Mobile Landscape (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
  .wrapper {
    padding: 18px;
  }
  
  .heading {
    font-size: 2.2rem;
    margin-bottom: 1.8rem;
  }
  
  .tab-container {
    gap: 15px;
    margin-bottom: 2.2rem;
  }
  
  .tab {
    padding: 9px 18px;
    font-size: 0.8rem;
  }
  
  .form-container {
    max-width: 500px;
  }
  
  .form-container input {
    max-width: 350px;
  }
  
  .name {
    font-size: 1.8rem;
  }
  
  .weather-desc {
    font-size: 1.15rem;
  }
  
  .weather-icon {
    width: 80px;
    height: 80px;
  }
  
  .temperature {
    font-size: 2.2rem;
  }
  
  .parameter-container {
    gap: 18px;
  }
  
  .parameter {
    width: 150px;
    padding: 0.9rem;
  }
  
  .parameter img {
    width: 45px;
    height: 45px;
  }
  
  .loading-container img {
    width: 90px;
    height: 90px;
  }
  
  .loading-text {
    font-size: 1.1rem;
  }
}

/* Tablet Portrait (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .wrapper {
    padding: 25px;
  }
  
  .parameter-container {
    max-width: 600px;
    margin: 2rem auto 0;
  }
  
  .parameter {
    width: 170px;
  }
  
  .form-container {
    max-width: 600px;
  }
}

/* Desktop Small (1025px - 1200px) */
@media screen and (min-width: 1025px) and (max-width: 1200px) {
  .parameter-container {
    max-width: 700px;
    margin: 2rem auto 0;
  }
  
  .parameter {
    width: 180px;
  }
}

/* Desktop Large (1201px and up) */
@media screen and (min-width: 1201px) {
  .wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
  }
  
  .parameter-container {
    max-width: 800px;
    margin: 2rem auto 0;
  }
  
  .parameter {
    width: 190px;
    padding: 1.2rem;
  }
}

/* Landscape Orientation Adjustments */
@media screen and (orientation: landscape) and (max-height: 600px) {
  .wrapper {
    padding: 10px 20px;
  }
  
  .heading {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }
  
  .tab-container {
    margin-bottom: 1.5rem;
  }
  
  .sub-container {
    padding: 1rem;
  }
  
  .parameter-container {
    margin-top: 1.5rem;
    gap: 15px;
  }
  
  .parameter {
    padding: 0.8rem;
  }
  
  .weather-icon {
    width: 70px;
    height: 70px;
  }
  
  .temperature {
    font-size: 2rem;
    margin-top: 8px;
  }
}

/* High DPI / Retina Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
  .search-button img,
  .name img,
  .parameter img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .search-button,
  .tab {
    transition: none;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  /* Already using dark theme, but can add specific dark mode adjustments if needed */
}

/* Print Styles */
@media print {
  html, body {
    background: white;
    color: black;
  }
  
  .wrapper {
    padding: 20px;
  }
  
  .tab-container,
  .btn,
  .search-button {
    display: none;
  }
  
  .user-info-container {
    display: block !important;
  }
}