:root {
  color-scheme: dark;
  --bg: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --accent: #38bdf8;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --error: #f87171;
  --warn: #facc15;
  --success: #4ade80;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  background: linear-gradient(to bottom right, #0f172a, #1e293b);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px; /* Reduced from 32px */
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center; /* Center vertically */
  margin-bottom: 0; /* Removed margin, controlled by app gap */
  gap: 20px;
  flex-wrap: wrap;
}

.header-left {
  flex: 1;
  min-width: 200px;
}

.header-right {
  flex: 0 0 auto;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  height: 36px;
  width: auto;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status.online {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.status.offline {
  background: rgba(248, 113, 113, 0.1);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}
/* End Header */
/* Search Section (Header Right) */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.5);
  border-radius: 999px; /* Pill shape */
  padding: 4px 12px; /* More padding for pill look */
  border: 1px solid transparent;
  transition: all 0.2s;
}

.search-wrapper:focus-within {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--card-border);
}

.search-wrapper input {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  width: 180px;
}

.search-wrapper input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.location-icon {
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.location-icon:hover {
  color: var(--accent);
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  width: 240px;
  margin-top: 8px;
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
}

.search-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
  text-align: left;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-item-name {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.search-item-detail {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Card Styles */
.weather-card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  overflow: hidden;
}

.weather-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}

.delete-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}

.weather-card:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--error);
  color: white;
}

.card-header {
  margin-bottom: 20px;
  text-align: left;
}

.city-name {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.last-updated {
  font-size: 0.75rem;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

/* Icon Container */
.weather-icon-container {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  position: relative;
}

.weather-icon-container svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

/* Temp & Details */
.temp-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 24px;
}

.temp {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(to bottom, #fff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.desc {
  font-size: 1rem;
  text-transform: capitalize;
  color: var(--accent);
  font-weight: 500;
}

.detail-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 16px;
  margin-bottom: 20px;
}

/* Forecast Strip */
.forecast-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 16px 4px 4px;
  margin: 0 -4px;
  border-top: 1px solid var(--card-border);
  
  scrollbar-width: none;
}

.forecast-strip::-webkit-scrollbar {
  display: none;
}

.forecast-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 48px;
}

.forecast-time {
  font-size: 0.7rem;
  color: var(--muted);
}

.forecast-icon {
  width: 32px;
  height: 32px;
}

.forecast-temp {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* Message Toast */
.message {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 99px;
  background: #1e293b;
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.message:not(:empty) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.message.error { color: var(--error); border-color: rgba(248, 113, 113, 0.2); }
.message.warn { color: var(--warn); border-color: rgba(250, 204, 21, 0.2); }
.message.info { color: var(--accent); border-color: rgba(56, 189, 248, 0.2); }

/* Footer */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: auto;
  opacity: 0.5;
}

/* Utility */
.hidden {
  display: none;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .header-right {
    width: 100%;
    margin-top: 8px;
  }
  .search-wrapper {
    width: 100%;
    box-sizing: border-box;
  }
  .search-wrapper input {
    width: 100%;
  }
  .search-results {
    width: 100%;
    left: 0;
  }
}

