:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1c1e21;
  --text-2: #6b7280;
  --text-3: #9aa1ab;
  --border: rgba(0, 0, 0, 0.08);
  --blue: #185fa5;
  --blue-soft: #e6f1fb;
  --amber: #ba7517;
  --amber-soft: #faeeda;
  --red: #a32d2d;
  --green: #3b6d11;
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --surface: #20242a;
    --surface-2: #2a2f37;
    --text: #f1f3f5;
    --text-2: #a7aeb8;
    --text-3: #7a828d;
    --border: rgba(255, 255, 255, 0.1);
    --blue: #85b7eb;
    --blue-soft: #0c447c;
    --amber: #ef9f27;
    --amber-soft: #633806;
    --red: #f09595;
    --green: #97c459;
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 880px; margin: 0 auto; padding: 24px 18px 48px; }

/* Header */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--blue-soft); display: flex; align-items: center; justify-content: center;
}
.brand__text h1 { font-size: 26px; font-weight: 700; line-height: 1; }
.brand__sub { font-size: 11px; color: var(--text-3); letter-spacing: 1px; }

.controls { display: flex; align-items: center; gap: 10px; }
.controls__label { font-size: 13px; color: var(--text-2); }
select {
  font-family: var(--font); font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 14px; min-width: 150px; cursor: pointer;
}
select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
  transition: background .15s, transform .15s;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon:active { transform: scale(0.95); }
.btn-icon.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }

/* Status */
.status { font-size: 13px; border-radius: var(--radius-sm); padding: 8px 14px; margin-bottom: 16px; }
.status--mock { background: var(--amber-soft); color: var(--amber); }
.status--live { background: var(--blue-soft); color: var(--blue); }
.status--error { background: #fceaea; color: #a32d2d; }
.status:empty { display: none; }

/* Hero */
.hero {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.hero__loc { font-size: 14px; color: var(--text-2); }
.hero__temp { font-size: 52px; font-weight: 500; line-height: 1.05; }
.hero__temp .unit { font-size: 24px; color: var(--text-2); margin-right: 2px; }
.hero__summary { font-size: 18px; font-weight: 500; margin-top: 4px; }
.hero__cond { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.hero__icon {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--amber-soft); color: var(--amber);
  display: flex; align-items: center; justify-content: center; font-size: 48px;
}

/* Tips */
.tips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tips:empty { display: none; }
.tip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; color: var(--text);
}
.tip__emoji { font-size: 16px; }

/* Tiles */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
}
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.tile__lbl { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tile__word { font-size: 21px; font-weight: 500; line-height: 1.2; }
.tile__sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.tile__ic { font-size: 17px; }
.tile--warn .tile__word { color: var(--amber); }
.tile--bad .tile__word { color: var(--red); }
.tile--info .tile__word { color: var(--blue); }
.tile--good .tile__word { color: var(--green); }

/* Forecast */
.fc { margin-top: 22px; }
.fc__title { font-size: 16px; font-weight: 500; margin-bottom: 10px; }

.hourly {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: thin;
}
.hour {
  flex: 0 0 auto; width: 72px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 6px;
}
.hour__time { font-size: 12px; color: var(--text-2); }
.hour__emoji { font-size: 22px; margin: 6px 0; }
.hour__temp { font-size: 16px; font-weight: 500; }
.hour__pop { font-size: 11px; color: var(--blue); margin-top: 2px; min-height: 14px; }

.daily { display: flex; flex-direction: column; gap: 8px; }
.day {
  display: grid; grid-template-columns: 1.4fr 0.6fr auto 1.2fr;
  align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 16px;
}
.day__name { font-size: 15px; font-weight: 500; }
.day__cond { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.day__pop { font-size: 12px; color: var(--blue); min-width: 36px; text-align: center; }
.day__temps { font-size: 14px; text-align: left; white-space: nowrap; }
.day__max { font-weight: 500; }
.day__min { color: var(--text-3); margin-right: 8px; }

/* Footer */
.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-top: 18px; font-size: 12px; color: var(--text-3);
}

@media (max-width: 520px) {
  .hero__temp { font-size: 44px; }
  .hero__icon { width: 76px; height: 76px; font-size: 40px; }
}
