:root {
  /* Light theme colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #a1a1a6;
  --accent: #007aff;
  --accent-hover: #0056cc;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-light: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.12);
  --divider: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  /* Dark theme colors */
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --text-primary: #ffffff;
  --text-secondary: #98989d;
  --text-tertiary: #636366;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --card-bg: rgba(28, 28, 30, 0.8);
  --card-border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(28, 28, 30, 0.9);
  --glass-border: rgba(255, 255, 255, 0.15);
  --shadow-light: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.4);
  --divider: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", system-ui, sans-serif;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Gradient */
.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  z-index: -1;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: 100vh;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  grid-template-areas:
    "header header"
    "current-weather right-panel"
    "current-weather right-panel"
    "daily-forecast daily-forecast";
}

/* Layout assignments */
.header {
  grid-area: header;
}

.current-weather {
  grid-area: current-weather;
  margin-bottom: 0;
}

.weather-details {
  margin-bottom: 0;
}

.hourly-forecast {
  margin-bottom: 0;
}

.daily-forecast {
  grid-area: daily-forecast;
  margin-bottom: 0;
}

/* Right panel container */
.weather-details,
.hourly-forecast {
  grid-column: 2;
}

/* Glass Effect */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  margin-bottom: 16px;
  padding: 20px;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-top: 8px;
}

.location-name {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.current-time {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.search-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.search-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: scale(1.02);
  border-color: var(--accent);
}

.search-btn:active {
  transform: scale(0.98);
}

/* Search Modal */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding-top: 120px;
}

.search-modal.active {
  display: flex;
}

.search-container {
  position: relative;
  width: 90%;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 16px 50px 16px 20px;
  border: none;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 17px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
  border: 1px solid var(--glass-border);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

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

.search-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card-bg);
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.search-close:hover {
  background: var(--accent);
  color: #ffffff;
}

/* Current Weather */
.current-weather {
  text-align: center;
  padding: 32px 20px;
}

.weather-icon img {
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
}

.temperature {
  font-size: 72px;
  font-weight: 100;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.temp-unit {
  font-size: 36px;
  font-weight: 200;
  color: var(--text-secondary);
}

.weather-description {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: capitalize;
  font-weight: 400;
}

.temp-range {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Weather Details */
.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-icon {
  width: 36px;
  height: 36px;
  background: var(--card-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  border: 1px solid var(--card-border);
}

.detail-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-label {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Section Titles */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Hourly Forecast */
.hourly-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.hourly-scroll::-webkit-scrollbar {
  display: none;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 64px;
  padding: 16px 12px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  transition: all 0.15s ease;
  cursor: pointer;
}

.hourly-item:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-2px);
  border-color: var(--accent);
}

.hourly-item:hover .hour,
.hourly-item:hover .hourly-temp {
  color: #ffffff;
}

.hour {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

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

.hourly-temp {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Daily Forecast */
.daily-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.daily-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
  transition: all 0.15s ease;
  cursor: pointer;
}

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

.daily-item:hover {
  background: var(--card-bg);
  margin: 0 -16px;
  padding: 16px;
  border-radius: 8px;
  border-bottom: 1px solid transparent;
}

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

.day {
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 400;
  min-width: 90px;
  text-align: left;
}

.daily-icon {
  width: 32px;
  height: 32px;
  margin: 0 16px;
}

.daily-temps {
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-high {
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 500;
  min-width: 32px;
  text-align: right;
}

.daily-low {
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 400;
  min-width: 32px;
  text-align: right;
}

/* Loading Animation */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--card-border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    max-width: 428px;
    display: block;
    grid-template-areas: none;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .header,
  .current-weather,
  .weather-details,
  .hourly-forecast,
  .daily-forecast {
    grid-area: auto;
    grid-column: auto;
    margin-bottom: 16px;
  }

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

  .temperature {
    font-size: 64px;
  }

  .temp-unit {
    font-size: 32px;
  }

  .location-name {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 16px 12px;
  }
}

/* Dark mode specific adjustments */
[data-theme="dark"] .weather-icon img {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

[data-theme="dark"] .search-modal {
  background: rgba(0, 0, 0, 0.6);
}

/* Keep weather icons in their original colors */
.hourly-icon,
.daily-icon {
  filter: none;
}

[data-theme="dark"] .hourly-icon,
[data-theme="dark"] .daily-icon {
  filter: none;
}

.hourly-item:hover .hourly-icon,
.daily-item:hover .daily-icon {
  filter: none;
}

/* Focus states for accessibility */
.search-btn:focus,
.search-input:focus,
.search-close:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hourly-item:focus,
.daily-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
