/* ==========================================================
   نظام التصميم — خدمات الموظفين (هيئة الأرصاد الجوية)
   الفكرة: هوية بصرية مستوحاة من السما وتدرّج الوقت خلال اليوم،
   بما إنه تطبيق لهيئة أرصاد جوية فعليًا.
   ========================================================== */

:root {
  --sky-deep: #0F3057;
  --sky-mid: #1B6FA8;
  --dawn-amber: #E8A33D;
  --cloud-white: #F7F9FB;
  --mist-grey: #9FB3C8;
  --storm-red: #C1443C;
  --ink: #0B2338;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-1: 0 2px 10px rgba(15, 48, 87, 0.08);
  --shadow-2: 0 8px 24px rgba(15, 48, 87, 0.14);

  --font-display: "Cairo", sans-serif;
  --font-body: "Tajawal", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cloud-white);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button, input {
  font-family: inherit;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ===== حالات العرض ===== */
.view { width: 100%; min-height: 100dvh; }
.view[hidden] { display: none; }

/* ===== شاشة الدخول ===== */
.view--login {
  display: flex;
  flex-direction: column;
}

.sky-header {
  position: relative;
  overflow: hidden;
  padding: 56px 24px 64px;
  background: linear-gradient(160deg, var(--sky-deep) 0%, var(--sky-mid) 100%);
  color: #fff;
  border-radius: 0 0 32px 32px;
}

.sky-header .wind-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.18;
}
.sky-header .wind-lines path {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

.sky-header__content { position: relative; z-index: 1; }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.75);
  margin-bottom: 6px;
}

.sky-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  margin: 0;
}

.login-card {
  flex: 1;
  margin: -32px 20px 20px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 24px 20px;
  position: relative;
  z-index: 2;
}

.login-card__hint {
  margin: 0 0 16px;
  color: var(--sky-deep);
  font-weight: 500;
  font-size: 15px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  border: 2px solid #E3EAF0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 17px;
  text-align: center;
  letter-spacing: 0.05em;
  outline: none;
  transition: border-color 0.15s ease;
}
.login-form input:focus {
  border-color: var(--sky-mid);
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--dawn-amber);
  color: var(--sky-deep);
}
.btn--primary:disabled { opacity: 0.6; }

.error-text {
  color: var(--storm-red);
  font-size: 14px;
  margin: 12px 4px 0;
  text-align: center;
}

/* ===== التطبيق الرئيسي ===== */
.view--app { display: flex; flex-direction: column; padding-bottom: 12px; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  background: linear-gradient(160deg, var(--sky-deep) 0%, var(--sky-mid) 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
}
.app-header__greeting { margin: 0; font-size: 13px; color: rgba(255,255,255,0.75); }
.app-header__name { margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 20px; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.tabbar {
  display: flex;
  gap: 6px;
  padding: 14px 16px 0;
  overflow-x: auto;
}
.tab {
  flex: 1;
  white-space: nowrap;
  border: none;
  background: #EAF1F7;
  color: var(--sky-deep);
  font-weight: 700;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab--active {
  background: var(--sky-mid);
  color: #fff;
}

.content { padding: 16px; flex: 1; }

.panel { display: none; }
.panel--active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== كروت الملخص ===== */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.summary-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-1);
  min-height: 84px;
}

.summary-card.skeleton {
  background: linear-gradient(90deg, #EEF2F6 25%, #E4EAF0 37%, #EEF2F6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.summary-card__label {
  font-size: 12.5px;
  color: var(--mist-grey);
  margin: 0 0 6px;
}
.summary-card__value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--sky-deep);
  margin: 0;
}
.summary-card__unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--mist-grey);
}

.note-card {
  margin-top: 12px;
  background: #FFF4E4;
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.note-card__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--dawn-amber);
  margin-bottom: 4px;
}
.note-card p { margin: 0; font-size: 14px; color: var(--ink); }

/* ===== قوائم السجلات (إجازات / أذونات) ===== */
.section-total {
  background: var(--sky-deep);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 12px;
}

.record-list { display: flex; flex-direction: column; gap: 8px; }

.record-row {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
}
.record-row__main { color: var(--ink); }
.record-row__main strong { display: block; font-size: 14px; margin-bottom: 2px; }
.record-row__badge {
  background: #EAF1F7;
  color: var(--sky-mid);
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--mist-grey);
  padding: 40px 16px;
  font-size: 14px;
}

/* ===== قائمة "المزيد" ===== */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.menu-tile {
  background: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 20px 12px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}
.menu-tile__icon { font-size: 26px; }

/* ===== النافذة المنبثقة (Bottom Sheet) ===== */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(11, 35, 56, 0.45);
  display: flex; align-items: flex-end;
  z-index: 50;
}
.sheet-overlay[hidden] { display: none; }

.sheet {
  background: #fff;
  width: 100%;
  max-height: 82vh;
  border-radius: 24px 24px 0 0;
  padding: 8px 20px 24px;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet__handle {
  width: 40px; height: 4px;
  background: #E3EAF0;
  border-radius: 999px;
  margin: 10px auto 14px;
}

.sheet__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.sheet__header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  color: var(--sky-deep);
}

.sheet__body { font-size: 14.5px; line-height: 1.7; }

.form-field {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
}
.form-field label { font-size: 13px; font-weight: 700; color: var(--sky-deep); }
.form-field input, .form-field textarea {
  border: 2px solid #E3EAF0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  font-family: var(--font-body);
}
.form-field textarea { min-height: 100px; resize: vertical; }

.link-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid #F0F3F6;
  color: var(--sky-mid);
  text-decoration: none;
  font-weight: 500;
}
.link-row:last-child { border-bottom: none; }

.faq-item { margin-bottom: 16px; }
.faq-item strong { display: block; color: var(--sky-deep); margin-bottom: 4px; font-size: 14.5px; }
.faq-item p { margin: 0; color: #4A6478; }

/* ===== إشعار توست ===== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--sky-deep);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-2);
  z-index: 100;
}
.toast[hidden] { display: none; }
.toast--error { background: var(--storm-red); }

/* ===== شاشات أوسع (تابلت/ديسكتوب) ===== */
@media (min-width: 640px) {
  .view--login { align-items: center; }
  .login-card { max-width: 420px; margin-inline: auto; margin-top: -40px; }
  .view--app { max-width: 480px; margin-inline: auto; box-shadow: var(--shadow-2); min-height: 100dvh; }
}
