/* ================================
   WeatherSync – Green SaaS Theme
   Enterprise UI designed for weather 
   data visualization with glassmorphism,
   smooth animations, and responsive layout
================================ */

:root {
  /* Dark green background for professional feel - reduces eye strain */
  --bg: #071a14;
  /* Semi-transparent cards for glassmorphism effect */
  --card: rgba(15, 40, 32, 0.85);
  /* Subtle green border for visual separation */
  --border: rgba(46, 204, 113, 0.2);
  /* Light text for contrast on dark backgrounds */
  --text: #ecfdf5;
  /* Muted green for secondary text and accents */
  --muted: #8ddfc1;
  /* Primary accent color - green (weather theme) */
  --accent: #2ecc71;
  /* Darker green for hover states and emphasis */
  --accent-dark: #27ae60;
  /* Red for error states and warnings */
  --danger: #ef4444;
  /* Glass effect background with transparency */
  --glass: rgba(15, 40, 32, 0.7);
  /* Border radius for modern, rounded look */
  --radius: 16px;
  /* Soft shadow for depth without harshness */
  --shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background: radial-gradient(circle at top, #0d3b2a, #071a14 70%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header Top */
.header-top {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.logo-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: 0.2s;
}

.logo-btn:hover {
  background: rgba(46,204,113,0.1);
}

.toggle-unit {
  background: rgba(46,204,113,0.15);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.toggle-unit:hover {
  background: rgba(46,204,113,0.25);
}

/* Layout */
.container {
  width: 100%;
  max-width: 700px;
  padding: 20px;
  margin-top: 80px;
}

/* Header */
h1 {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 6px;
}

p {
  color: var(--muted);
}

/* Search */
.search {
  margin: 20px 0;
  position: relative;
}

.search-wrapper {
  display: flex;
  gap: 8px;
}

#searchInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: 0.2s;
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,204,113,0.3);
}

.search-btn {
  background: var(--accent);
  border: none;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  color: #032014;
  font-size: 1rem;
  transition: 0.2s;
}

.search-btn:hover {
  background: var(--accent-dark);
}

/* Suggestions */
#suggestions {
  list-style: none;
  position: absolute;
  width: 100%;
  background: #0c2a1f;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 6px;
  overflow: hidden;
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  /* Only show when there's content (has children) */
  display: none;
}

/* Show suggestions only when list has items */
#suggestions:not(:empty) {
  display: block;
}

#suggestions li {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#suggestions li:hover {
  background: rgba(46,204,113,0.15);
}

/* Weather Card */
.weather {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(15px);
  margin-bottom: 20px;
}

.weather h2 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.weather-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

#weatherDescription {
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

/* Temperature */
.weather h1 {
  font-size: 2.8rem;
  margin: 8px 0;
  color: var(--text);
}

.weather p {
  font-size: 0.9rem;
  margin: 4px 0;
}

#weatherIcon {
  width: 70px;
}

/* Weather Map */
.weather-map-container {
  width: 100%;
  height: 250px;
  border-radius: 12px;
  overflow: hidden;
  margin: 15px 0;
  border: 1px solid var(--border);
  background: #0a2818;
}

.weather-map-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.grid div {
  background: rgba(46,204,113,0.08);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.grid span {
  color: var(--text);
  font-weight: 600;
}

/* Metrics Grid - Professional layout for weather metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.metric {
  background: rgba(46,204,113,0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.metric-center {
  grid-column: 1 / -1;
  width: 150px;
  margin: 0 auto;
}

.metric-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.4rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.feels-like {
  font-size: 0.9rem;
  margin: 8px 0 0 0;
  color: var(--muted);
}

/* Empty State */
.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 500px;
}

.welcome-card {
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(46, 204, 113, 0.05));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 50px 40px;
  text-align: center;
  max-width: 500px;
  backdrop-filter: blur(15px);
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  display: block;
}

.welcome-card h2 {
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 10px;
}

.welcome-card > p:nth-of-type(1) {
  color: var(--muted);
  margin-bottom: 30px;
  font-size: 0.95rem;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 30px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(46, 204, 113, 0.08);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.feature i {
  color: var(--accent);
  font-size: 1.1rem;
}

.feature span {
  color: var(--text);
  font-weight: 500;
}

.welcome-hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

.empty-state.hidden {
  display: none;
}

/* Error Message */
.error-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  color: var(--danger);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error-box button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Loading Spinner - Custom animation */
#loadingSpinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  margin: 20px 0;
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

#loadingSpinner::before {
  content: '';
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}

/* Pulse animation for loading spinner
   Creates smooth breathing effect to indicate active data fetching
   Combines opacity and scale for visual feedback */
@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Forecast Container */
#forecastSection {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#forecastSection h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: var(--text);
  text-align: center;
}

.forecast-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  scroll-behavior: smooth;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

/* Hide scrollbar */
.forecast-container::-webkit-scrollbar {
  display: none;
}

.forecast-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.forecast-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  flex: 0 0 120px;
  text-align: center;
  backdrop-filter: blur(15px);
}

.forecast-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.forecast-icon {
  width: 50px;
  height: 50px;
  margin: 6px auto;
}

.forecast-description {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.forecast-temp {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.forecast-high {
  color: var(--text);
  font-weight: 600;
}

.forecast-low {
  color: var(--muted);
}

.forecast-details {
  display: flex;
  gap: 8px;
  justify-content: center;
  font-size: 0.75rem;
}

.forecast-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.forecast-detail i {
  color: var(--accent);
}

/* Mobile */
@media (max-width: 700px) {
  .container {
    padding: 20px;
  }

  .weather h1 {
    font-size: 2.2rem;
  }

  .header-top {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .logo-btn {
    font-size: 1rem;
  }
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 30px 20px 20px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

.app-footer strong {
  color: var(--accent);
  font-weight: 600;
}

/* ================================
   Back to Portfolio Button
   Fixed mobile-friendly navigation
================================ */

.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 600;
  z-index: 200;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: rgba(46, 204, 113, 0.25);
  transform: translateY(-1px);
}

/* Mobile optimization */
@media (max-width: 700px) {
  .back-btn {
    top: 12px;
    left: 12px;
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}
