/* شريط تنقل موحّد + إشعارات + أخطاء + تحميل — يُرفق مع app-shell.js */

body.has-app-shell {
  padding-top: 0 !important;
}

#app-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  min-height: 48px;
  background: rgba(10, 10, 12, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: 'Tajawal', system-ui, sans-serif;
  box-sizing: border-box;
}

/* إخفاء شريط التنقل العلوي من جميع الصفحات */
#app-top-nav {
  display: none !important;
}

#app-top-nav,
#app-top-nav a {
  box-sizing: border-box;
}

.app-nav-brand {
  font-weight: 800;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  white-space: nowrap;
}

.app-nav-brand:hover {
  color: #a5b4fc;
}

.app-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.app-nav-links a,
.app-nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.15s, border-color 0.15s;
}

.app-nav-links a:hover,
.app-nav-cta:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.app-nav-links a.app-nav-primary,
.app-nav-cta.app-nav-primary {
  background: linear-gradient(90deg, #6164ff, #6d6dff);
  border-color: #6164ff;
  color: #fff;
}

.app-nav-links a.app-nav-primary:hover {
  filter: brightness(1.06);
}

.app-nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.app-nav-bell-wrap {
  position: relative;
}

.app-nav-bell {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s;
}

.app-nav-bell:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-nav-bell-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  background: #ef4444;
  color: #fff;
  display: none;
}

.app-nav-bell-badge[data-show="1"] {
  display: block;
}

.app-nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: min(320px, calc(100vw - 28px));
  max-height: 320px;
  overflow-y: auto;
  background: rgba(20, 20, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  display: none;
  z-index: 10001;
}

.app-nav-dropdown[data-open="1"] {
  display: block;
}

.app-nav-dropdown-h {
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav-dropdown-item {
  display: block;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.app-nav-dropdown-item:hover {
  background: rgba(97, 100, 255, 0.12);
}

.app-nav-dropdown-item[data-read="0"] {
  background: rgba(97, 100, 255, 0.08);
}

.app-nav-dropdown-empty {
  padding: 16px 12px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.app-nav-logout {
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* شريط خطأ */
#app-shell-error {
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 10px 14px;
  background: rgba(127, 29, 29, 0.95);
  border-bottom: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: 0.82rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#app-shell-error[data-visible="1"] {
  display: flex;
}

body.has-app-shell.has-app-error {
  padding-top: 96px;
}

#app-shell-error-msg {
  flex: 1;
  min-width: 200px;
}

.app-shell-retry {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}

.app-shell-retry:hover {
  background: rgba(255, 255, 255, 0.2);
}

.app-shell-dismiss {
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

/* أزرار — حالة تحميل */
button.app-shell-loading,
a.app-shell-loading {
  pointer-events: none;
  opacity: 0.72;
  position: relative;
}

button.app-shell-loading::after,
a.app-shell-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-inline-start: 8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: app-shell-spin 0.65s linear infinite;
  vertical-align: middle;
}

@keyframes app-shell-spin {
  to {
    transform: rotate(360deg);
  }
}

/* جدول / منطقة محتوى */
.app-shell-table-loading {
  position: relative;
  min-height: 80px;
}

.app-shell-table-loading::after {
  content: 'جاري التحميل…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  border-radius: inherit;
  pointer-events: none;
}

.app-empty-hint {
  text-align: center;
  padding: 24px 16px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  font-family: 'Tajawal', system-ui, sans-serif;
}
