/* Complete redesign with modern glassmorphism and professional color scheme */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0f172a;
  --secondary: #1e293b;
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border: rgba(148, 163, 184, 0.2);
  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(148, 163, 184, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: var(--text-primary);
  overflow-x: hidden;
}

body {
  transition: background 1s ease-in-out;
}

/* Weather backgrounds */
body.weather-clear {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 50%, #0f172a 100%);
}

body.weather-clouds {
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #0f172a 100%);
}

body.weather-rain {
  background: linear-gradient(135deg, #1e293b 0%, #475569 50%, #0f172a 100%);
}

body.weather-snow {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 50%, #7dd3fc 100%);
  color: #0f172a;
}

body.weather-thunderstorm {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #0f172a 100%);
}

body.weather-mist {
  background: linear-gradient(135deg, #64748b 0%, #475569 50%, #1e293b 100%);
}

/* Main Container */
.main-container {
  min-height: 100vh;
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
  animation: slideDown 0.6s ease-out;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.logo i {
  font-size: 2.5rem;
  color: var(--accent);
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Search Section */
.search-section {
  margin-bottom: 3rem;
}

.search-container {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3.5rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border);
  border-radius: 1rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

/* Location suggestions dropdown styling */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 1rem 1rem;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  margin-top: -1px;
}

.suggestions-dropdown.hidden {
  display: none;
}

.suggestions-list {
  padding: 0.5rem 0;
}

.suggestion-item {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
}

.suggestion-item:hover {
  background: rgba(6, 182, 212, 0.1);
  border-left-color: var(--accent);
  color: var(--text-primary);
}

.suggestion-item-main {
  font-weight: 500;
  color: var(--text-primary);
}

.suggestion-item-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Button Group */
.button-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--primary);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: var(--accent);
}

/* Recent Searches */
.recent-searches {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.recent-searches.hidden {
  display: none;
}

.recent-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.recent-item {
  padding: 0.5rem 1rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.recent-item:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent);
}

/* Weather Section */
.weather-section {
  margin-bottom: 3rem;
  animation: fadeIn 0.6s ease-out;
}

.weather-section.hidden {
  display: none;
}

.current-weather-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 2rem;
  padding: 2.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.city-name {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.current-date {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.temp-toggle {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.temp-toggle:hover {
  background: rgba(6, 182, 212, 0.3);
  border-color: var(--accent);
}

.weather-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: center;
}

.weather-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.weather-icon {
  width: 120px;
  height: 120px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 15px rgba(6, 182, 212, 0.2));
}

.temperature-display {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.temperature {
  font-size: 4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.degree {
  font-size: 2rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

.weather-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.detail-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.detail-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.detail-icon {
  font-size: 1.5rem;
  color: var(--accent);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 182, 212, 0.1);
  border-radius: 0.75rem;
}

.detail-content {
  flex: 1;
}

.detail-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.detail-value {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.weather-description {
  text-align: center;
  padding: 1.5rem;
  background: rgba(6, 182, 212, 0.1);
  border-radius: 1rem;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.weather-description p {
  font-size: 1.1rem;
  color: var(--text-primary);
  text-transform: capitalize;
}

/* Forecast Section */
.forecast-section {
  margin-bottom: 2rem;
  animation: fadeIn 0.6s ease-out;
}

.forecast-section.hidden {
  display: none;
}

.forecast-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.forecast-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.forecast-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.2);
}

.forecast-day {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.forecast-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.forecast-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
}

.forecast-temp {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.forecast-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-bottom: 1rem;
}

.forecast-details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.forecast-detail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.forecast-detail-icon {
  color: var(--accent);
  font-size: 1rem;
}

.forecast-detail-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.loading-overlay.hidden {
  display: none;
}

.spinner-container {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.modal-header i {
  font-size: 1.5rem;
}

.error-modal .modal-header i {
  color: var(--error);
}

.alert-modal .modal-header i {
  color: var(--warning);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-container {
    padding: 1rem;
  }

  .header h1 {
    font-size: 2rem;
  }

  .search-wrapper {
    flex-direction: column;
  }

  .button-group {
    width: 100%;
  }

  .btn {
    flex: 1;
    justify-content: center;
  }

  .weather-main {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .weather-details-grid {
    grid-template-columns: 1fr 1fr;
  }

  .temperature {
    font-size: 3rem;
  }

  .forecast-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .current-weather-card {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .tagline {
    font-size: 0.9rem;
  }

  .search-container {
    padding: 1.5rem;
  }

  .weather-details-grid {
    grid-template-columns: 1fr;
  }

  .temperature {
    font-size: 2.5rem;
  }

  .forecast-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
  }
}
