body {
  margin: 0;
  padding: 0;
  font-family: 'Cairo', Arial, sans-serif;
  background: #e6f0fa;
  min-height: 100vh;
  color: #222;
  transition: background 0.5s, color 0.4s;
  position: relative;
  overflow-x: hidden;
  letter-spacing: 0.01em;
}
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: -10;
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  background-size: 200% 200%;
  animation: gradientMove 8s ease-in-out infinite;
  filter: blur(2px);
}
@keyframes gradientMove {
  0% {background-position: 0% 50%;}
  50% {background-position: 100% 50%;}
  100% {background-position: 0% 50%;}
}
body.dark {
  background: linear-gradient(135deg, #101c2c 0%, #203659 50%, #302f4e 100%);
  color: #e0e6f5;
}
body.dark .animated-bg {
  background: linear-gradient(135deg, #182c3d 0%, #384e68 70%, #3b2a4b 100%);
  filter: blur(3px) brightness(0.93);
}
.glass {
  background: rgba(255,255,255,0.88);
  border-radius: 22px;
  box-shadow: 0 6px 32px #2193b033, 0 1.5px 7px #fff4;
  backdrop-filter: blur(14px);
  padding: 1.2rem 1.1rem;
  margin-bottom: 1rem;
  transition: background 0.3s, color 0.3s;
}
body.dark .glass {
  background: rgba(37, 45, 66, 0.94);
  color: #ecf3ff;
  box-shadow: 0 8px 32px 0 rgba(43,86,128,0.19);
  border: 1.5px solid rgba(110,148,255,0.06);
}
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.6rem 1rem 0.6rem 1rem;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 2px 12px #2193b022;
  background: rgba(255,255,255,0.95);
  margin-bottom: 0.7em;
  position: sticky;
  top: 0;
  z-index: 20;
}
body.dark .main-header {
  background: rgba(32, 42, 70, 0.97);
  color: #ecf3ff;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 1px;
  text-shadow: 0 2px 10px #2193b044;
}
nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.circle-btn {
  border: none;
  background: #e8f4fa;
  color: #2193b0;
  border-radius: 50%;
  width: 43px;
  height: 43px;
  font-size: 1.3rem;
  cursor: pointer;
  margin-inline: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px #2193b032;
  font-weight: 700;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.circle-btn:active, .circle-btn:focus {
  background: #b8e4fa;
  color: #176e8a;
  box-shadow: 0 0 0 3px #4fd1e822;
}
body.dark .circle-btn {
  background: #2a3a4b;
  color: #7dc6ff;
  box-shadow: 0 2px 15px #0c223833;
}
.lang-select {
  padding: 0.4em 1em;
  border-radius: 10px;
  background: #e8f4fa;
  border: none;
  font-size: 1em;
  outline: none;
  cursor: pointer;
  margin-inline: 1px;
  font-weight: 700;
}
body.dark .lang-select {
  background: #22324a;
  color: #b9d0fa;
  border: 1.5px solid #44618a;
}
.hero {
  text-align: center;
  padding: 1.1rem 0.3rem 1.4rem 0.3rem;
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  margin: 0.8rem 0 1.2rem 0;
  box-shadow: 0 4px 18px #2193b022;
  font-weight: 700;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 40%, #6dd5ed44 0%, #2193b011 90%);
  z-index: 0;
}
body.dark .hero-bg {
  background: radial-gradient(circle at 70% 40%, #325d8c44 0%, #24344a 100%);
}
.hero-icon {
  font-size: 2.7rem;
  color: #2193b0;
  margin-bottom: 0.26rem;
  background: #e9f7ff;
  border-radius: 50%;
  padding: 0.39em 0.42em;
  box-shadow: 0 0 28px #2193b044;
  margin-bottom: 0.19em;
}
body.dark .hero-icon {
  background: #2a3648;
  color: #7dc6ff;
  box-shadow: 0 0 22px #3b6caacc;
}
#hero-title {
  font-size: 1.32em;
  font-weight: 900;
  color: #0b4a58;
  letter-spacing: 1px;
}
body.dark #hero-title {
  color: #dcecff;
  text-shadow: 0 3px 10px #3b6caacc;
}
#hero-desc {
  font-size: 1em;
  color: #0b4a58d9;
  font-weight: 500;
  margin: 0.7em 0 0 0;
}
body.dark #hero-desc {
  color: #b6d7ff;
}
.search-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: 0.1rem;
}
#city-input {
  flex: 1 1 150px;
  min-width: 100px;
  max-width: 200px;
  padding: 0.9em 1.1em;
  border-radius: 18px;
  border: 1.5px solid #b5e0f7;
  font-size: 1.16em;
  outline: none;
  background: #f7fbfe;
  box-shadow: 0 2px 10px #2193b022;
  margin-bottom: 0.1em;
  transition: border 0.2s;
  font-weight: 700;
}
body.dark #city-input {
  background: #182c3d;
  color: #e9e2fe;
  border: 1.5px solid #3b6caac9;
}
#city-input:focus {
  border: 1.8px solid #2193b0;
}
body.dark #city-input:focus {
  border: 1.8px solid #7dc6ff;
}
.main-btn {
  background: linear-gradient(90deg, #2193b0 0%, #6dd5ed 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 0.68em 1.2em;
  font-size: 1.15em;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 2px 14px #2193b044;
  transition: background 0.17s, color 0.15s;
  align-items: center;
  gap: 0.4em;
  letter-spacing: 0.01em;
}
.main-btn:active, .main-btn:focus {
  background: linear-gradient(90deg, #3ca4c4 0%, #4fd1e8 100%);
  color: #fff;
}
body.dark .main-btn {
  background: linear-gradient(90deg, #3b6caaff 0%, #22324a 100%);
  color: #e8f7ff;
}
.favorites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  min-height: 1.4em;
  margin-bottom: 1.2em;
  justify-content: center;
}
.favorite-city {
  background: #d6f5ff;
  color: #2193b0;
  border-radius: 17px;
  padding: 0.38em 1.1em 0.38em 0.7em;
  display: flex;
  align-items: center;
  gap: 0.32em;
  font-weight: bold;
  cursor: pointer;
  font-size: 1.08em;
  box-shadow: 0 2px 8px #2193b022;
}
body.dark .favorite-city {
  background: #22324a;
  color: #b9d0fa;
}
.favorite-city .remove-fav {
  background: transparent;
  border: none;
  color: #c22;
  font-size: 1.3em;
  cursor: pointer;
  margin-left: 2.5px;
}
.weather-info {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 1.2rem;
  min-height: 110px;
}
.weather-card {
  min-width: 206px;
  max-width: 370px;
  margin: auto;
  padding: 1.6em 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.12em;
  border-radius: 24px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 2px 18px #2193b033;
  position: relative;
  z-index: 2;
}
body.dark .weather-card {
  background: rgba(42, 58, 77, 0.97);
  color: #e9f7ff;
  box-shadow: 0 2px 18px #3b6caacc;
}
.weather-card h2 {
  font-size: 1.18em;
  font-weight: bold;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5em;
  justify-content: center;
  flex-wrap: wrap;
}
.weather-card i.fa-solid {
  font-size: 2.7em;
  color: #2193b0;
  margin-bottom: 0.23em;
  text-shadow: 0 0 18px #2093b033;
}
body.dark .weather-card i.fa-solid {
  color: #7dc6ff;
  text-shadow: 0 0 22px #23587c88;
}
.weather-card .weather-desc {
  font-size: 1.13em;
  font-weight: bold;
  color: #2193b0;
  letter-spacing: 1px;
}
body.dark .weather-card .weather-desc {
  color: #b9d0fa;
}
.weather-card .weather-temp {
  font-size: 2.3em;
  font-weight: 900;
  margin: 0.1em 0;
  color: #ffa726;
  text-shadow: 0 1px 12px #ffa72633;
}
body.dark .weather-card .weather-temp {
  color: #ffe2b9;
  text-shadow: 0 1px 12px #fff4;
}
.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9em 1.5em;
  margin: 0.8em auto 1.2em auto;
  max-width: 400px;
  font-size: 1.07em;
}
.weather-details .detail {
  display: flex;
  align-items: center;
  gap: 0.48em;
  background: rgba(33,147,176,0.08);
  border-radius: 15px;
  padding: 0.38em 0.7em;
  font-size: 1em;
  box-shadow: 0 1px 6px #2193b012;
  font-weight: 700;
}
body.dark .weather-details .detail {
  background: rgba(43, 86, 128, 0.13);
  color: #e3f3ff;
  box-shadow: 0 1px 6px #3b6caacc;
}
.forecast-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: center;
  align-items: stretch;
  margin: 1.2em 0 0 0;
}
.forecast-card {
  min-width: 140px;
  max-width: 168px;
  flex: 1 1 140px;
  text-align: center;
  padding: 1.35em 0.7em 1.35em 0.7em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55em;
  border-radius: 18px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 12px #2193b022;
}
body.dark .forecast-card {
  background: rgba(37, 45, 66, 0.92);
  color: #e8f7ff;
  box-shadow: 0 2px 12px #3b6caacc;
}
.forecast-card h3 {
  margin: 0 0 0.25em 0;
  font-size: 1.08em;
  font-weight: bold;
  color: #2193b0;
}
body.dark .forecast-card h3 {
  color: #b9d0fa;
}
.forecast-card i {
  font-size: 2em;
  color: #2193b0;
}
body.dark .forecast-card i {
  color: #7dc6ff;
}
.hourly-section {
  margin: 1.5em auto 1.1em auto;
  max-width: 430px;
  text-align: center;
  border-radius: 19px;
}
body.dark .hourly-section {
  background: rgba(37, 45, 66, 0.95);
  color: #ecf3ff;
}
#hourly-chart {
  width: 100% !important;
  max-width: 99vw;
  margin-top: 0.8em;
}
.settings {
  display: none;
  position: fixed;
  top: 52px;
  right: 0;
  left: 0;
  margin: auto;
  max-width: 420px;
  z-index: 111;
  box-shadow: 0 4px 32px rgba(33,147,176,0.18);
  border-radius: 19px;
  padding: 1.7em 1.2em;
}
body.dark .settings {
  background: rgba(37, 45, 66, 0.97);
  color: #dfd6ff;
}
.settings.active {
  display: block;
  animation: fadeIn 0.25s;
}
.setting-row {
  margin: 1.2em 0;
  display: flex;
  align-items: center;
  gap: 0.7em;
  font-size: 1.05em;
  justify-content: space-between;
  font-weight: 700;
}
.setting-row label {
  flex: 1 1 70%;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.setting-row select,
.setting-row input[type="checkbox"] {
  border-radius: 7px;
  padding: 0.2em 0.7em;
  border: 1px solid #b5e0f7;
  font-size: 1em;
  outline: none;
}
body.dark .setting-row select,
body.dark .setting-row input[type="checkbox"] {
  background: #22324a;
  color: #b9d0fa;
  border: 1.5px solid #44618a;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(30px);}
  to   { opacity: 1; transform: none;}
}
.loader {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.68);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.loader::after {
  content: "";
  display: block;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: 7px solid #2193b0;
  border-top: 7px solid #f5fafd;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {transform: rotate(360deg);}
}
/* الفوتر */
footer {
  margin-top: 2em;
  text-align: center;
  font-size: 1em;
  padding: 1.4em 0 0.7em 0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -2px 18px #2193b044;
  background: rgba(255,255,255,0.9);
  position: relative;
  z-index: 10;
  font-weight: 800;
  letter-spacing: 0.05em;
}
body.dark footer {
  background: rgba(37, 45, 66, 0.93);
  color: #e0e6f5;
}
.footer-icons {
  display: flex;
  gap: 0.7em;
  justify-content: center;
  font-size: 1.25em;
  margin-bottom: 0.7em;
}
body.dark .footer-icons i {
  color: #7dc6ff;
  text-shadow: 0 2px 8px #3b6caacc;
}
.animate {
  animation: fadeIn 0.65s;
}
/* ==== Bottom nav bar for mobiles ==== */
.bottom-nav {
  display: none;
}
@media (max-width: 700px) {
  .main-header, .hero, .glass, .settings { max-width: 100vw; }
  .forecast-card { min-width: 110px; }
  .weather-details { max-width: 100vw; }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.98);
    box-shadow: 0 -2px 18px #2193b044;
    z-index: 111;
    justify-content: space-around;
    align-items: center;
    border-radius: 18px 18px 0 0;
    height: 62px;
    padding: 0;
    margin: 0;
  }
  body.dark .bottom-nav {
    background: rgba(37, 45, 66, 0.97);
    box-shadow: 0 -2px 18px #3b6caacc;
  }
  .bottom-nav .circle-btn {
    width: 49px;
    height: 49px;
    font-size: 1.32em;
    margin: 0 3px;
    background: #e8f4fa;
  }
  body.dark .bottom-nav .circle-btn {
    background: #22324a;
    color: #7dc6ff;
    box-shadow: 0 2px 15px #3b6caacc;
  }
  main {
    padding-bottom: 62px;
    box-sizing: border-box;
  }
}
@media (max-width: 450px) {
  .main-header { padding: 0.5em 0.5em 0.7em 0.5em; }
  .logo { font-size: 1em; }
  .hero { padding: 1.1em 0.06em 1.3em 0.06em; }
  .weather-card { font-size: 1em; }
  .forecast-card { font-size: 0.95em; }
  .settings { padding: 1.1em 0.4em; }
  .footer-icons { font-size: 1em; }
}
@media (max-width: 370px) {
  html { font-size: 14.3px; }
}
input, select, button {
  font-family: inherit;
  font-size: 1em;
  border-radius: 9px;
  outline: none;
  border: none;
  margin-bottom: 0 !important;
  font-weight: 700;
  letter-spacing: 0.01em;
}
input:focus, select:focus { box-shadow: 0 0 0 2px #2193b033; }
::-webkit-scrollbar { width: 8px; background: #e8f4fa;}
::-webkit-scrollbar-thumb { background: #b6e2f7; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #2193b0; }
body.dark ::-webkit-scrollbar-thumb { background: #3b6caacc; }
a { color: #2193b0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* زر التحميل الكبير في الهيدر */
@media (max-width: 900px) {
  .main-header #download-btn {
    display: none;
  }
}
@media (min-width: 901px) {
  .bottom-nav #nav-download-btn {
    display: none;
  }
}

/* دعم SVG للأيقونات في صورة التحميل */
.ws-icon svg {
  display: inline-block;
  vertical-align: middle;
  width: 3.5rem;
  height: 3.5rem;
}

/* تحسين مظهر صورة التحميل ودعم العربية */
.weather-share-image {
  font-family: 'Cairo', 'Tajawal', Arial, Tahoma, 'Amiri', sans-serif !important;
  direction: rtl;
  background: linear-gradient(135deg, #283751 0%, #1c2330 100%);
  border-radius: 32px;
  box-shadow: 0 6px 32px #2193b022, 0 1.5px 7px #fff4;
  padding: 2.2rem 2.5rem 1.7rem 2.5rem;
  width: 370px;
  color: #e5e9f7;
  text-align: center;
  position: relative;
  overflow: hidden;
  letter-spacing: 0 !important;
  word-spacing: 0 !important;
}
.weather-share-image .ws-city {
  font-weight: 800;
  font-size: 1.8rem;
  margin-bottom: .2em;
  color: #7dc6ff;
  letter-spacing: 0 !important;
  word-spacing: 0 !important;
}
.weather-share-image .ws-date {
  font-size: 1.14rem;
  font-weight: 600;
  margin-bottom: 1.0em;
  color: #b9d0fa;
}
.weather-share-image .ws-icon {
  font-size: 3.5rem;
  margin-bottom: .35em;
  color: #ffe2b9;
}
.weather-share-image .ws-temp {
  font-weight: bold;
  font-size: 2.4rem;
  margin-bottom: .27em;
  color: #ffe2b9;
}
.weather-share-image .ws-desc {
  font-size: 1.25rem;
  font-weight: 600;
  color: #7dc6ff;
  margin-bottom: .7em;
}
.weather-share-image .ws-details {
  font-size: 1.09rem;
  margin: 1.4em 0 .6em 0;
  color: #cce3fa;
}
.weather-share-image .ws-copyright {
  font-size: 1.04rem;
  font-weight: 600;
  color: #7dc6ff88;
  margin-top: 1.1em;
  letter-spacing: 0.02em;
  direction: ltr;
  text-align: center;
}