/* Phase 6.0-R8 — Final Clean UX Hotfix */

html, body {
  color-scheme: light !important;
}

.portal-topbar,
body:not(:has(.erp-shell)) .topbar {
  width: min(1500px, calc(100% - 32px)) !important;
  margin: 14px auto 18px !important;
  min-height: 78px !important;
  border-radius: 28px !important;
}

/* Portal title contrast */
html body .portal-shell .portal-topbar .portal-brand-text h1,
html body .portal-shell .portal-topbar .portal-brand-text p,
html body .portal-shell .portal-topbar .portal-brand,
html body .portal-shell .portal-topbar .portal-brand * {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: none !important;
}

/* Logo without box */
.portal-logo,
.portal-logo *,
.portal-logo img,
.topbar [class*="logo"],
.topbar img {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  object-fit: contain !important;
}

/* Hide dark/light + duplicate profile/logout */
.portal-theme-form,
form[action="/theme/toggle"],
form[action="/my-profile/theme"],
.theme-toggle,
[data-theme-toggle],
button[name="next_theme_mode"],
input[name="theme_mode"],
label:has(input[name="theme_mode"]),
.card:has(input[name="theme_mode"]),
.glass.card:has(input[name="theme_mode"]),
.portal-header-actions > a[href="/my-profile"],
.portal-header-actions > a[href="/logout"],
.topbar a[href="/my-profile"],
.topbar a[href="/logout"],
.portal-quick-grid a[href="/my-profile"],
.portal-card:has(a[href="/my-profile"]),
.portal-small-card:has(a[href="/my-profile"]),
.portal-small-card:has(a[href="/notifications"]) {
  display: none !important;
}

/* User menu */
.yaz-user-menu {
  position: relative !important;
  z-index: 99999 !important;
  display: inline-flex !important;
  align-items: center !important;
}

.yaz-user-menu-btn {
  width: 46px !important;
  height: 46px !important;
  border-radius: 16px !important;
  display: grid !important;
  place-items: center !important;
  color: #ffffff !important;
  cursor: pointer !important;
  background: rgba(255,255,255,.11) !important;
  border: 1px solid rgba(255,255,255,.20) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 10px 22px rgba(0,0,0,.08) !important;
}

.yaz-user-menu-btn svg {
  width: 22px !important;
  height: 22px !important;
}

.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,.18) !important;
  display: none !important;
}

.yaz-user-menu.open .yaz-user-menu-dropdown {
  display: grid !important;
  gap: 6px !important;
}

.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;
  background: transparent !important;
  border: 0 !important;
  text-decoration: none !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

.yaz-user-menu-dropdown a:hover {
  background: #EAE9F9 !important;
  color: #482A82 !important;
}

.yaz-user-menu-dropdown a.danger {
  color: #B42335 !important;
}

/* Notification modern stat icons */
body:has(.notification-item) .compact-stats .glass.card {
  position: relative !important;
  overflow: hidden !important;
}

body:has(.notification-item) .compact-stats .glass.card:before,
body:has(.notification-item) .compact-stats .glass.card:after {
  display: 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; }

/* Health page cleanup */
body:has(.health-title) .glass.card:first-of-type:before,
body:has(.health-title) .glass.card:first-of-type:after,
body:has(.health-title) .health-hero:before,
body:has(.health-title) .health-hero:after {
  display: none !important;
  content: none !important;
}

body:has(.health-title) .glass.card:first-of-type,
body:has(.health-title) .health-hero {
  min-height: 200px !important;
}

/* Footer */
.yaz-footer,
.yaz-portal-footer,
footer,
.footer {
  width: min(1500px, calc(100% - 32px)) !important;
  margin: 28px auto 20px !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;
  color: #23213A !important;
  box-shadow: 0 12px 26px rgba(37,26,91,.04) !important;
  display: flex !important;
  justify-content: space-between !important;
  gap: 12px !important;
  align-items: center !important;
  flex-wrap: wrap !important;
}

.yaz-footer *,
.yaz-portal-footer *,
footer *,
.footer * {
  color: #23213A !important;
}

/* Support page */
.support-shell {
  direction: rtl;
  min-height: 100vh;
  padding: 14px 16px 28px;
  color: #141223;
  font-family: "IBM Plex Sans Arabic", "Tajawal", Arial, sans-serif;
}

.support-wrap {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
}

.support-hero {
  min-height: 230px;
  padding: 32px !important;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: 20px;
  border-radius: 32px !important;
}

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

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

.support-illustration {
  min-height: 140px;
  display: grid;
  place-items: center;
}

.support-illustration span {
  width: 120px;
  height: 120px;
  border-radius: 36px;
  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);
  position: relative;
}

.support-illustration span:after {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #482A82;
  font-size: 56px;
  font-weight: 950;
}

.support-card {
  margin-top: 16px;
  padding: 24px !important;
  border-radius: 30px !important;
}

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

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

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

.support-form input,
.support-form select,
.support-form textarea {
  width: 100%;
  border-radius: 15px;
  min-height: 48px;
  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: 800;
}

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

.support-submit {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: 950;
  background: linear-gradient(135deg, #482A82, #6C57A6);
  box-shadow: 0 14px 30px rgba(109,40,217,.24);
}

.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);
}

@media (max-width: 900px) {
  .support-hero,
  .support-form {
    grid-template-columns: 1fr;
  }

  .yaz-user-menu-dropdown {
    left: auto !important;
    right: 0 !important;
  }
}
