/* Base styles and resets */
:root {
  --primary-color: #6c5ce7;
  --primary-light: #a29bfe;
  --primary-dark: #5341d6;
  --text-dark: #2d3436;
  --text-light: #636e72;
  --white: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.18);
  --error-color: #e74c3c;
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --btn-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --border-radius-sm: 12px;
  --border-radius-md: 20px;
  --border-radius-lg: 30px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text-dark);
  background-color: #f5f5f5;
  overflow-x: hidden;
}

/* Background Image */
.bg-image {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("https://images.unsplash.com/photo-1553881651-43348b2ca74e?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODY2NTk1MzV8&ixlib=rb-4.0.3&q=85");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  filter: blur(3px);
  z-index: -1;
}

/* Main content area */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  width: 100%;
}

/* Glass card styling */
.glass-card {
  width: 100%;
  max-width: 480px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  box-shadow: var(--card-shadow);
  padding: 2rem;
  text-align: center;
  transition: var(--transition);
  overflow: hidden;
}

/* App title */
.app-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--white);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Search form styling */
.search-form {
  margin-bottom: 1.5rem;
}

.search-container {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
  position: relative;
}

.search-container input {
  flex: 1;
  height: 3rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-dark);
  border: none;
  border-radius: var(--border-radius-lg);
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  margin-right: 0.75rem;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(5px);
  transition: var(--transition);
}

.search-container input:focus {
  outline: none;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.25);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--white);
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-icon:active {
  transform: translateY(0);
}

.btn-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Unit toggle buttons */
.unit-toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.unit-btn {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-dark);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.unit-btn:hover {
  background: rgba(255, 255, 255, 0.8);
}

.unit-btn.active {
  background: var(--primary-color);
  color: var(--white);
  box-shadow: var(--btn-shadow);
}

/* Status messages */
.status-message {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  margin-bottom: 1rem;
  display: none;
  font-weight: 500;
}

.error {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error-color);
  border-left: 4px solid var(--error-color);
}

.loading {
  background: rgba(255, 255, 255, 0.3);
  color: var(--text-dark);
  border-left: 4px solid var(--primary-color);
}

/* Weather display section */
.weather-display {
  display: none;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.weather-icon {
  width: 130px;
  max-width: 100%;
  margin: 0 auto 0.5rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.temp {
  font-size: 3.5rem;
  font-weight: 600;
  color: var(--white);
  margin: 0;
  line-height: 1.1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.city {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 0.25rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.description {
  font-size: 1.125rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 1.5rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Weather details layout */
.weather-details {
  display: flex;
  justify-content: space-around;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-sm);
  backdrop-filter: blur(5px);
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.detail-item img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.detail-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.detail-value {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--white);
  line-height: 1.2;
}

.detail-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
}

/* Footer styling */
footer {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  color: var(--white);
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

footer a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
}

footer a:hover,
footer a:focus {
  color: var(--white);
  text-decoration: underline;
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus {
  outline: 3px solid rgba(108, 92, 231, 0.5);
  outline-offset: 2px;
}

/* Responsive design */
@media (max-width: 600px) {
  .glass-card {
    padding: 1.5rem;
  }

  .app-title {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .search-container input {
    height: 2.75rem;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
  }

  .btn-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  .temp {
    font-size: 3rem;
  }

  .city {
    font-size: 1.5rem;
  }

  .weather-icon {
    width: 110px;
  }

  .detail-value {
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .glass-card {
    padding: 1.25rem;
  }

  .app-title {
    font-size: 1.35rem;
    margin-bottom: 1rem;
  }

  .weather-details {
    flex-direction: column;
    gap: 1rem;
    padding: 0.875rem;
  }

  .detail-item {
    width: 100%;
    justify-content: flex-start;
  }

  .detail-text {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }

  .detail-value {
    font-size: 1.125rem;
  }

  .detail-label {
    font-size: 0.8125rem;
  }

  .temp {
    font-size: 2.5rem;
  }

  .city {
    font-size: 1.35rem;
  }

  .description {
    font-size: 1rem;
  }

  .weather-icon {
    width: 100px;
  }
}

@media (max-width: 360px) {
  /* Redesigned search for small screens */
  .search-container {
    position: relative;
    display: flex;
    align-items: center;
  }

  .search-container input {
    width: 100%;
    padding-right: 3.25rem;
    margin-right: 0;
  }

  .btn-icon {
    position: absolute;
    right: 0.5rem;
    width: 2.2rem;
    height: 2.2rem;
    margin-left: -0.5rem;
  }

  .btn-icon svg {
    width: 1rem;
    height: 1rem;
  }

  .unit-toggle {
    margin-top: 0.5rem;
  }
}
