/* ============================================================
   WEATHER DASHBOARD
============================================================ */

/* ============================================================
   GOOGLE FONT
============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================================
   CSS RESET
============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  position: relative;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

button,
input {
  border: none;
  outline: none;
  font: inherit;
}

button {
  cursor: pointer;
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}


/* ============================================================
   COLOR SYSTEM
============================================================ */
:root {
  --bg: #09090b;
  --bg-secondary: #111114;
  --card: rgba(255, 255, 255, 0.06);
  --card-hover: rgba(255, 255, 255, 0.09);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --text-secondary: #b7bcc5;
  --text-muted: #7e8490;
  --primary: #4f8cff;
  --primary-hover: #74a5ff;
  --success: #27d980;
  --danger: #ff5e73;
  --warning: #ffbe55;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --transition: 0.35s ease;
}

/* ============================================================
   BACKGROUND EFFECTS (APPLE STYLE & AURORA)
============================================================ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(118, 92, 255, 0.15), transparent 28%),
    radial-gradient(circle at bottom, rgba(0, 195, 255, 0.12), transparent 32%),
    #09090b;
}

body::after {
  content: "";
  position: fixed;
  inset: -40%;
  z-index: -3;
  filter: blur(140px);
  opacity: 0.7;
  background: linear-gradient(
    45deg,
    #0a84ff,
    #5e5ce6,
    #30d158,
    #64d2ff,
    #0a84ff
  );
  animation: aurora 18s linear infinite;
}

@keyframes aurora {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   MAIN CONTAINER & LAYOUT
============================================================ */
.container {
  width: min(1250px, 92%);
  margin: auto;
}

header {
  padding: 40px 0;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  font-size: 1.4rem;
  box-shadow: var(--shadow-md);
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.logo p {
  color: var(--text-muted);
  margin-top: 2px;
}

main {
  padding-bottom: 80px;
}

/* ============================================================
   SEARCH SECTION & BUTTON
============================================================ */
.search-section {
  margin-top: 30px;
}

.search-form {
  display: flex;
  gap: 15px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius-xl);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  transition: var(--transition);
}

.search-box:hover {
  background: rgba(255, 255, 255, 0.1);
}

.search-box:focus-within {
  border-color: rgba(79, 140, 255, 0.7);
  box-shadow: 0 0 0 5px rgba(79, 140, 255, 0.15);
}

.search-box svg {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}

.search-box input {
  flex: 1;
  background: none;
  color: white;
  font-size: 1rem;
}

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

.search-btn {
  position: relative;
  overflow: hidden;
  padding: 18px 34px;
  border-radius: 22px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: white;
  font-weight: 700;
  transition: 0.35s;
  box-shadow: 0 12px 35px rgba(10, 132, 255, 0.35);
}

.search-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 45px rgba(10, 132, 255, 0.45);
}

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

.search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-btn::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.search-btn:active::after {
  animation: ripple 0.55s;
}

@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.6;
  }
  to {
    transform: scale(18);
    opacity: 0;
  }
}

/* ============================================================
   GLASS CARD & COMPONENTS
============================================================ */
.glass {
  background: var(--glass);
  backdrop-filter: blur(22px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transition: border-color 0.35s;
}

.glass:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
}

/* ============================================================
   WEATHER DASHBOARD & CARDS
============================================================ */
.weather-dashboard {
  margin-top: 45px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
  align-items: start;
}

.weather-card {
  position: relative;
  overflow: hidden;
  padding: 40px;
  min-height: 420px;
  transition: transform 0.35s, background 0.35s, box-shadow 0.35s, border-color 0.35s;
}

.weather-card::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -150px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(rgba(10, 132, 255, 0.28), transparent 70%);
  pointer-events: none;
}

.weather-card::after {
  content: "";
  position: absolute;
  bottom: -150px;
  left: -120px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(rgba(94, 92, 230, 0.18), transparent 70%);
  pointer-events: none;
}

.weather-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 70px rgba(79, 140, 255, 0.18);
}

.weather-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.location-info h2 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -1px;
}

.location-info p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.weather-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f5f5f7;
  font-weight: 600;
  transition: 0.35s;
}

.weather-status:hover {
  background: rgba(79, 140, 255, 0.18);
}

.weather-icon {
  width: 140px;
  height: 140px;
  border-radius: 36px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  animation: float-icon 5s ease-in-out infinite;
}

.weather-icon img {
  width: 90px;
  height: 90px;
}

@keyframes float-icon {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
  100% { transform: translateY(0px); }
}

.temperature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 50px;
}

.temperature h1 {
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -5px;
}

.temperature span {
  font-size: 2.2rem;
  margin-top: 10px;
  color: var(--text-secondary);
}

.weather-description {
  margin-top: 18px;
  font-size: 1.2rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.feels-like {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ============================================================
   METRICS PANEL
============================================================ */
.metrics-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.metric-card {
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s, background 0.35s, box-shadow 0.35s, border-color 0.35s;
}

.metric-card:hover {
  transform: translateY(-6px);
  background: var(--card-hover);
  box-shadow: 0 18px 45px rgba(79, 140, 255, 0.12);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: 0.4s;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.12), transparent);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.25), rgba(94, 92, 230, 0.25));
  margin-bottom: 22px;
}

.metric-icon img {
  width: 28px;
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
}

.metric-unit {
  font-size: 1rem;
  color: var(--text-secondary);
}

.highlight-card {
  grid-column: span 2;
  padding: 35px;
}

.highlight-title {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.highlight-value {
  font-size: 3rem;
  font-weight: 800;
}

.highlight-subtitle {
  margin-top: 10px;
  color: var(--text-secondary);
}

.weather-details {
  margin-top: 35px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.detail-chip {
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ============================================================
   FORECAST SECTION
============================================================ */
.forecast-section {
  margin-top: 40px;
}

.forecast-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 22px;
}

.hourly-forecast {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
}

.hourly-card {
  scroll-snap-align: start;
  padding: 22px;
  text-align: center;
  transition: var(--transition);
}

.hourly-card:hover {
  transform: translateY(-8px);
  background: var(--card-hover);
}

.hourly-card h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.hourly-card img {
  width: 60px;
  margin: 20px auto;
}

.hourly-card h2 {
  font-size: 2rem;
  font-weight: 700;
}

.daily-forecast {
  margin-top: 35px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.day-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  transition: 0.3s;
}

.day-card:hover {
  background: var(--card-hover);
}

.day-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.day-left img {
  width: 45px;
}

.day-name {
  font-weight: 600;
}

.day-temp {
  display: flex;
  gap: 14px;
}

.day-temp span:first-child {
  font-weight: 700;
}

.day-temp span:last-child {
  color: var(--text-muted);
}

.sun-grid {
  margin-top: 35px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.sun-card {
  padding: 30px;
  text-align: center;
}

.sun-card h3 {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.sun-card h2 {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.sun-card p {
  color: var(--text-secondary);
}

/* ============================================================
   WEATHER BACKGROUND DYNAMIC STATES
============================================================ */
body.sunny::before {
  background: radial-gradient(circle at top, rgba(255, 190, 85, 0.22), transparent 35%), #09090b;
}
body.cloudy::before {
  background: radial-gradient(circle at top, rgba(180, 180, 180, 0.18), transparent 35%), #09090b;
}
body.rainy::before {
  background: radial-gradient(circle at top, rgba(0, 160, 255, 0.18), transparent 35%), #09090b;
}
body.snowy::before {
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.16), transparent 35%), #09090b;
}
body.storm::before {
  background: radial-gradient(circle at top, rgba(122, 90, 255, 0.2), transparent 35%), #09090b;
}

/* ============================================================
   LOADING, SKELETON & UI STATES
============================================================ */
.loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  min-height: 420px;
  text-align: center;
}

.loading h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.loading p {
  color: var(--text-secondary);
}

.spinner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 25px rgba(79, 140, 255, 0.35);
}

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

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  animation: skeleton-loading 1.4s infinite;
}

@keyframes skeleton-loading {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-title {
  width: 220px;
  height: 28px;
  margin-bottom: 20px;
}

.skeleton-temp {
  width: 180px;
  height: 90px;
  margin: 35px 0;
}

.skeleton-text {
  width: 150px;
  height: 18px;
  margin-top: 15px;
}

.skeleton-card {
  width: 100%;
  height: 140px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  text-align: center;
  padding: 50px;
}

.empty-state img {
  width: 180px;
  margin-bottom: 35px;
  opacity: 0.9;
}

.empty-state h2 {
  font-size: 2rem;
  margin-bottom: 18px;
}

.empty-state p {
  max-width: 550px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 22px;
  min-height: 420px;
  padding: 45px;
  border-radius: 30px;
  background: rgba(255, 94, 115, 0.08);
  border: 1px solid rgba(255, 94, 115, 0.22);
}

.error-icon {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: rgba(255, 94, 115, 0.18);
}

.error-card h2 {
  font-size: 2rem;
}

.error-card p {
  max-width: 500px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.retry-btn {
  margin-top: 10px;
  padding: 16px 34px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  transition: 0.3s;
}

.retry-btn:hover {
  transform: translateY(-3px);
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 30px;
  right: 30px;
  min-width: 320px;
  padding: 18px 22px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: white;
  backdrop-filter: blur(18px);
  background: rgba(25, 25, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg);
  transform: translateX(420px);
  opacity: 0;
  z-index: 9999;
}

.toast.show {
  animation: toast-in 0.45s forwards;
}

.toast.hide {
  animation: toast-out 0.45s forwards;
}

.toast-success {
  border-left: 5px solid var(--success);
}

.toast-error {
  border-left: 5px solid var(--danger);
}

.toast-warning {
  border-left: 5px solid var(--warning);
}

@keyframes toast-in {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  to {
    transform: translateX(420px);
    opacity: 0;
  }
}

/* History & Badges */
.search-history {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.history-chip {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: 0.3s;
  cursor: pointer;
  color: var(--text-secondary);
}

.history-chip:hover {
  transform: translateY(-3px);
  background: rgba(79, 140, 255, 0.15);
  border-color: rgba(79, 140, 255, 0.45);
}

.favorite-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 210, 0, 0.25), rgba(255, 180, 0, 0.15));
  border: 1px solid rgba(255, 210, 0, 0.25);
  color: #ffd95a;
  font-weight: 600;
}

/* ============================================================
   ANIMATIONS
============================================================ */
.fade-in,
.weather-top,
.temperature,
.weather-details,
.metrics-panel {
  animation: fade-in 0.55s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scale-in {
  animation: scale-in 0.4s ease;
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Transition Card Group */
.metric-card,
.weather-card,
.day-card,
.hourly-card,
.sun-card {
  transition: transform 0.35s, background 0.35s, box-shadow 0.35s, border-color 0.35s;
}

/* ============================================================
   FOOTER
============================================================ */
.app-footer {
  margin-top: 45px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.app-footer strong {
  color: white;
}

/* ============================================================
   ACCESSIBILITY & SELECTION
============================================================ */
button:focus-visible,
input:focus-visible,
.history-chip:focus-visible {
  outline: 3px solid rgba(79, 140, 255, 0.55);
  outline-offset: 4px;
}

::selection {
  background: rgba(79, 140, 255, 0.35);
  color: white;
}

/* ============================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
============================================================ */
@media (min-width: 1500px) {
  .container {
    width: 1400px;
  }
}

@media (max-width: 1100px) {
  .weather-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .sun-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .search-btn {
    width: 100%;
  }

  .weather-card {
    padding: 30px;
  }

  .weather-top {
    flex-direction: column;
  }

  .weather-icon {
    width: 120px;
    height: 120px;
  }

  .temperature h1 {
    font-size: 4.8rem;
  }

  .metrics-panel {
    grid-template-columns: 1fr;
  }

  .highlight-card {
    grid-column: span 1;
  }

  .loading {
    min-height: 320px;
  }

  .empty-state {
    padding: 35px;
  }

  .empty-state img {
    width: 130px;
  }

  .toast {
    left: 20px;
    right: 20px;
    min-width: auto;
  }
}

@media (max-width: 600px) {
  .weather-dashboard {
    gap: 20px;
  }

  .hourly-forecast {
    grid-auto-columns: 120px;
  }

  .hourly-card,
  .day-card {
    padding: 18px;
  }

  .forecast-title {
    font-size: 1.4rem;
  }
}

@media (max-width: 520px) {
  .location-info h2 {
    font-size: 2rem;
  }

  .temperature {
    margin-top: 35px;
  }

  .temperature h1 {
    font-size: 4rem;
    letter-spacing: -3px;
  }

  .metric-value {
    font-size: 1.6rem;
  }

  .weather-details {
    gap: 12px;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .temperature h1 {
    font-size: 3.4rem;
  }

  .weather-icon {
    width: 95px;
    height: 95px;
  }

  .metric-card {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .search-section,
  .toast,
  .spinner {
    display: none;
  }
}

/* ============================================================
   UTILITY CLASSES
============================================================ */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.grid {
  display: grid;
}

.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.w-100 {
  width: 100%;
}

.text-muted {
  color: var(--text-muted);
}

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

.rounded {
  border-radius: var(--radius-lg);
}

.shadow {
  box-shadow: var(--shadow-lg);
}
