/* Phase 6.0-R13 — Unified Portal/Supporting Layout */

/* العام */
html,
body {
  color-scheme: light !important;
}

/* لا يمس ERP */
body:not(:has(.erp-shell)) {
  background:
    radial-gradient(circle at 8% 0%, rgba(195,179,242,.30), transparent 360px),
    radial-gradient(circle at 88% 16%, rgba(91,33,217,.12), transparent 390px),
    linear-gradient(180deg, #F3F0FC 0%, #fbfaff 48%, #F3F0FC 100%) !important;
}

/* عرض موحد لكل شيء خارج ERP */
body:not(:has(.erp-shell)) .portal-topbar,
body:not(:has(.erp-shell)) .topbar,
body:not(:has(.erp-shell)) .support-header,
body:not(:has(.erp-shell)) .portal-hero,
body:not(:has(.erp-shell)) .portal-stats-grid,
body:not(:has(.erp-shell)) .portal-modules,
body:not(:has(.erp-shell)) .portal-bottom-grid,
body:not(:has(.erp-shell)) .support-wrap,
body:not(:has(.erp-shell)) .yaz-footer,
body:not(:has(.erp-shell)) footer,
body:not(:has(.erp-shell)) .footer {
  width: min(1500px, calc(100% - 32px)) !important;
  max-width: 1500px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* الهيدر الموحد */
body:not(:has(.erp-shell)) .portal-topbar,
body:not(:has(.erp-shell)) .topbar,
body:not(:has(.erp-shell)) .support-header {
  min-height: 78px !important;
  margin-top: 14px !important;
  margin-bottom: 18px !important;
  padding: 14px 22px !important;
  border-radius: 28px !important;
  overflow: visible !important;
  position: relative !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  background:
    radial-gradient(circle at 14% 0%, rgba(195,179,242,.22), transparent 280px),
    linear-gradient(135deg, #2A1649 0%, #2A1649 50%, #482A82 100%) !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  box-shadow: 0 20px 48px rgba(32,14,86,.22) !important;
}

body:not(:has(.erp-shell)) .portal-topbar,
body:not(:has(.erp-shell)) .portal-topbar *:not(.yaz-user-menu-dropdown):not(.yaz-user-menu-dropdown *),
body:not(:has(.erp-shell)) .topbar,
body:not(:has(.erp-shell)) .topbar *:not(.yaz-user-menu-dropdown):not(.yaz-user-menu-dropdown *),
body:not(:has(.erp-shell)) .support-header,
body:not(:has(.erp-shell)) .support-header *:not(.yaz-user-menu-dropdown):not(.yaz-user-menu-dropdown *) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: none !important;
}

body:not(:has(.erp-shell)) .portal-brand-text h1,
body:not(:has(.erp-shell)) .portal-brand-text p,
body:not(:has(.erp-shell)) .topbar h1,
body:not(:has(.erp-shell)) .topbar p,
body:not(:has(.erp-shell)) .support-header h1,
body:not(:has(.erp-shell)) .support-header p {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* الشعار بدون صندوق */
body:not(:has(.erp-shell)) .portal-logo,
body:not(:has(.erp-shell)) .portal-logo *,
body:not(:has(.erp-shell)) .portal-logo img,
body:not(:has(.erp-shell)) .topbar [class*="logo"],
body:not(:has(.erp-shell)) .topbar img {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* إخفاء المظهر والتكرارات */
body:not(:has(.erp-shell)) .portal-theme-form,
body:not(:has(.erp-shell)) form[action="/theme/toggle"],
body:not(:has(.erp-shell)) form[action="/my-profile/theme"],
body:not(:has(.erp-shell)) .theme-toggle,
body:not(:has(.erp-shell)) [data-theme-toggle],
body:not(:has(.erp-shell)) button[name="next_theme_mode"],
body:not(:has(.erp-shell)) input[name="theme_mode"],
body:not(:has(.erp-shell)) label:has(input[name="theme_mode"]),
body:not(:has(.erp-shell)) .card:has(input[name="theme_mode"]),
body:not(:has(.erp-shell)) .glass.card:has(input[name="theme_mode"]),
body:not(:has(.erp-shell)) .portal-header-actions > a[href="/my-profile"],
body:not(:has(.erp-shell)) .portal-header-actions > a[href="/logout"],
body:not(:has(.erp-shell)) .topbar a[href="/my-profile"],
body:not(:has(.erp-shell)) .topbar a[href="/logout"],
body:not(:has(.erp-shell)) .portal-quick-grid a[href="/my-profile"],
body:not(:has(.erp-shell)) .portal-card:has(a[href="/my-profile"]),
body:not(:has(.erp-shell)) .portal-small-card:has(a[href="/my-profile"]),
body:not(:has(.erp-shell)) .portal-small-card:has(a[href="/notifications"]) {
  display: none !important;
}

/* قائمة المستخدم */
body:not(:has(.erp-shell)) .portal-header-actions,
body:not(:has(.erp-shell)) .support-header-actions {
  overflow: visible !important;
  position: relative !important;
  z-index: 999999 !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu {
  display: inline-flex !important;
  position: relative !important;
  z-index: 999999 !important;
  align-items: center !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu-btn {
  width: 46px !important;
  height: 46px !important;
  border-radius: 16px !important;
  display: grid !important;
  place-items: center !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  cursor: pointer !important;
  background: rgba(255,255,255,.13) !important;
  border: 1px solid rgba(255,255,255,.24) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 10px 22px rgba(0,0,0,.10) !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu-btn svg {
  width: 22px !important;
  height: 22px !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu-dropdown {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  left: 0 !important;
  width: 220px !important;
  padding: 8px !important;
  border-radius: 18px !important;
  background: rgba(255,255,255,.98) !important;
  border: 1px solid rgba(69,44,139,.12) !important;
  box-shadow: 0 24px 48px rgba(37,26,91,.20) !important;
  display: none !important;
  z-index: 999999 !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu.open .yaz-user-menu-dropdown,
body:not(:has(.erp-shell)) .yaz-user-menu:hover .yaz-user-menu-dropdown,
body:not(:has(.erp-shell)) .yaz-user-menu:focus-within .yaz-user-menu-dropdown {
  display: grid !important;
  gap: 6px !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu-dropdown a {
  min-height: 42px !important;
  padding: 0 12px !important;
  border-radius: 13px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  color: #141223 !important;
  -webkit-text-fill-color: #141223 !important;
  background: transparent !important;
  border: 0 !important;
  text-decoration: none !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu-dropdown a:hover {
  background: #EAE9F9 !important;
  color: #482A82 !important;
  -webkit-text-fill-color: #482A82 !important;
}

body:not(:has(.erp-shell)) .yaz-user-menu-dropdown a.danger {
  color: #B42335 !important;
  -webkit-text-fill-color: #B42335 !important;
}

/* كروت البوابة الكبيرة */
body:not(:has(.erp-shell)) .portal-primary-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 18px !important;
}

/* أيقونات التنبيهات */
body:has(.notification-item) .compact-stats .glass.card:before,
body:has(.notification-item) .compact-stats .glass.card:after {
  display: none !important;
  content: none !important;
}

.yaz-stat-modern-icon {
  position: absolute !important;
  left: 18px !important;
  bottom: 18px !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 17px !important;
  display: grid !important;
  place-items: center !important;
  color: #482A82 !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.90), transparent 45%),
    linear-gradient(135deg, rgba(109,40,217,.13), rgba(168,85,247,.20)) !important;
  border: 1px solid rgba(109,40,217,.10) !important;
}

.yaz-stat-modern-icon svg {
  width: 24px !important;
  height: 24px !important;
}

.yaz-stat-modern-icon.icon-2 { color: #C9820F !important; }
.yaz-stat-modern-icon.icon-3 { color: #1F7A55 !important; }
.yaz-stat-modern-icon.icon-4 { color: #B86E12 !important; }

/* صفحة الدعم */
.support-page {
  direction: rtl;
  min-height: 100vh;
  padding: 0 0 28px;
  color: #141223;
  font-family: "IBM Plex Sans Arabic", "Tajawal", Arial, sans-serif;
}

.support-hero-clean {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto 16px;
  min-height: 250px;
  border-radius: 32px;
  padding: 32px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 24px;
  background:
    radial-gradient(circle at 18% 24%, rgba(195,179,242,.25), transparent 320px),
    linear-gradient(135deg, rgba(255,255,255,.95), rgba(247,243,255,.90));
  border: 1px solid rgba(69,44,139,.11);
  box-shadow: 0 18px 42px rgba(37,26,91,.065);
}

.support-pill {
  display: inline-flex;
  min-height: 30px;
  padding: 0 12px;
  align-items: center;
  border-radius: 999px;
  color: #482A82;
  background: #EAE9F9;
  font-size: 12px;
  font-weight: 950;
}

.support-hero-copy h2 {
  margin: 14px 0 10px;
  color: #141223;
  font-size: clamp(32px, 3vw, 46px);
  font-weight: 950;
}

.support-hero-copy p {
  margin: 0;
  color: #6E6777;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.9;
}

.support-hero-art {
  min-height: 160px;
  display: grid;
  place-items: center;
}

.support-art-card {
  width: 132px;
  height: 132px;
  border-radius: 40px;
  display: grid;
  place-items: center;
  color: #482A82;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.90), transparent 44%),
    linear-gradient(135deg, rgba(109,40,217,.16), rgba(168,85,247,.28));
  border: 1px solid rgba(109,40,217,.12);
  box-shadow: 0 22px 44px rgba(109,40,217,.16);
}

.support-art-card svg {
  width: 62px;
  height: 62px;
}

.support-form-card {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  border-radius: 30px;
  padding: 24px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(69,44,139,.11);
  box-shadow: 0 16px 38px rgba(37,26,91,.065);
}

.support-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.support-form-grid .full {
  grid-column: 1 / -1;
}

.support-form-grid label span {
  display: block;
  color: #6E6777;
  font-size: 12px;
  font-weight: 950;
  margin-bottom: 8px;
}

.support-form-grid input,
.support-form-grid select,
.support-form-grid textarea {
  width: 100%;
  min-height: 50px;
  border-radius: 15px;
  padding: 12px 14px;
  color: #141223;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(69,44,139,.13);
  outline: none;
  font-family: inherit;
  font-weight: 850;
}

.support-form-grid textarea {
  min-height: 160px;
  resize: vertical;
}

.support-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
}

.support-submit,
.support-secondary {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 950;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.support-submit {
  border: 0;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #482A82, #6C57A6);
  box-shadow: 0 14px 30px rgba(109,40,217,.24);
}

.support-secondary {
  color: #482A82;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(109,40,217,.14);
}

.support-alert {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 900;
}

.support-alert.success {
  color: #1F7A55;
  background: #eaf9ef;
  border: 1px solid rgba(22,163,74,.14);
}

.support-alert.error {
  color: #B42335;
  background: #fff1f2;
  border: 1px solid rgba(190,18,60,.14);
}

/* الفوتر */
body:not(:has(.erp-shell)) .yaz-footer,
body:not(:has(.erp-shell)) footer,
body:not(:has(.erp-shell)) .footer {
  direction: ltr !important;
  padding: 17px 22px !important;
  border-radius: 22px !important;
  background: rgba(255,255,255,.72) !important;
  border: 1px solid rgba(69,44,139,.10) !important;
  box-shadow: 0 12px 26px rgba(37,26,91,.04) !important;
  color: #23213A !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

body:not(:has(.erp-shell)) .yaz-footer *,
body:not(:has(.erp-shell)) footer *,
body:not(:has(.erp-shell)) .footer * {
  color: #23213A !important;
  -webkit-text-fill-color: #23213A !important;
}

.yaz-footer-brand {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.yaz-footer-dev {
  margin-left: auto;
}

@media (max-width: 900px) {
  body:not(:has(.erp-shell)) .portal-primary-grid,
  .support-hero-clean,
  .support-form-grid {
    grid-template-columns: 1fr !important;
  }

  body:not(:has(.erp-shell)) .topbar,
  body:not(:has(.erp-shell)) .support-header {
    display: grid !important;
  }

  body:not(:has(.erp-shell)) .yaz-user-menu-dropdown {
    left: auto !important;
    right: 0 !important;
  }

  .support-actions-row {
    display: grid;
  }

  body:not(:has(.erp-shell)) .yaz-footer,
  body:not(:has(.erp-shell)) footer,
  body:not(:has(.erp-shell)) .footer {
    display: grid !important;
    direction: rtl !important;
  }

  .yaz-footer-dev {
    margin-left: 0;
  }
}
