/*
 * Asifah Analytics shared page chrome.
 * Standardizes watermark, sidebar, mobile drawer, theme button, and footer
 * without changing page-specific analytic content.
 */

:root {
  --asifah-shell-bg: var(--bg-color, var(--bg-primary, #e8f0f8));
  --asifah-shell-card: var(--card-bg, var(--container-bg, var(--bg-card, #ffffff)));
  --asifah-shell-border: var(--card-border, var(--border-color, #b0c8e0));
  --asifah-shell-text: var(--text-primary, #0a1628);
  --asifah-shell-muted: var(--text-muted, #4a6080);
  --asifah-shell-accent: var(--accent, var(--accent-cyan, #38bdf8));
}

[data-theme="dark"] {
  --asifah-shell-bg: var(--bg-color, var(--bg-primary, #060d1a));
  --asifah-shell-card: var(--card-bg, var(--container-bg, var(--bg-card, #0d1b2e)));
  --asifah-shell-border: var(--card-border, var(--border-color, #1e3a5f));
  --asifah-shell-text: var(--text-primary, #e2f0fb);
  --asifah-shell-muted: var(--text-muted, #4a7090);
  --asifah-shell-accent: var(--accent, var(--accent-cyan, #38bdf8));
}

body.asifah-standardized.asifah-shell-watermark-active::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110vmin;
  height: 110vmin;
  min-width: 760px;
  min-height: 760px;
  max-width: 1400px;
  max-height: 1400px;
  background-image: url('https://raw.githubusercontent.com/Asifah-Analytics-C-A-V-E/asifah-analytics/refs/heads/main/Asifah_Analytics_1_25_26_V1_LOGO.png');
  background-size: 135%;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.07;
  filter: none;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  border-radius: 50%;
}

[data-theme="dark"] body.asifah-standardized.asifah-shell-watermark-active::before {
  opacity: 0.18;
  filter: saturate(3) brightness(0.8) hue-rotate(185deg);
}

body.asifah-standardized.asifah-shell-watermark-active .watermark {
  display: none;
}

.asifah-legacy-control-hidden {
  display: none !important;
}

body.asifah-standardized .menu-toggle,
body.asifah-standardized .mobile-hamburger,
body.asifah-standardized .mobile-menu-btn:not(.asifah-mobile-menu-btn) {
  display: none !important;
}

body.asifah-standardized .mobile-drawer,
body.asifah-standardized .mobile-drawer-backdrop {
  display: none !important;
}

.asifah-header-left,
.asifah-header-right,
.asifah-header-center {
  min-width: 0;
}

.asifah-standard-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.4);
  object-fit: cover;
  flex: 0 0 auto;
}

.asifah-standard-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--asifah-shell-accent);
  background: rgba(56, 189, 248, 0.08);
  font-family: 'Times New Roman', Times, serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.asifah-standard-back:hover {
  border-color: var(--asifah-shell-accent);
  background: rgba(56, 189, 248, 0.16);
}

.asifah-theme-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.10);
  color: var(--asifah-shell-text);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.asifah-theme-button:hover {
  border-color: var(--asifah-shell-accent);
  background: rgba(56, 189, 248, 0.18);
}

.asifah-theme-switch-track {
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.asifah-theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
}

[data-theme="dark"] .asifah-theme-switch-knob {
  transform: translateX(18px);
}

body.asifah-standardized .nav-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  position: sticky;
  top: 20px;
  height: fit-content;
  align-self: flex-start;
}

body.asifah-standardized .nav-sidebar-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(56, 189, 248, 0.55);
  font-family: 'Courier New', monospace;
  margin-bottom: 4px;
  padding-left: 2px;
}

body.asifah-standardized .nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-family: 'Times New Roman', Times, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  cursor: pointer;
  overflow: hidden;
  border: 1.5px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.06) 0%, rgba(14, 165, 233, 0.04) 100%);
  color: var(--asifah-shell-text);
}

body.asifah-standardized .nav-btn:hover {
  border-color: rgba(56, 189, 248, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.16);
}

body.asifah-standardized .nav-btn-label {
  font-size: 12px;
  line-height: 1.3;
}

body.asifah-standardized .nav-btn-status {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 5px;
  opacity: 0.75;
  color: var(--asifah-shell-accent);
}

body.asifah-standardized .nav-btn.current-page {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18) 0%, rgba(22, 163, 74, 0.12) 100%);
  border-color: rgba(34, 197, 94, 0.65);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.18);
}

body.asifah-standardized .nav-btn.tracker-btn {
  border-color: rgba(245, 158, 11, 0.50);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(217, 119, 6, 0.05) 100%);
}

body.asifah-standardized .nav-btn.tracker-btn .nav-btn-status {
  color: #f59e0b;
}

body.asifah-standardized .nav-btn.tracker-btn.current-page {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.20) 0%, rgba(217, 119, 6, 0.12) 100%);
  border-color: rgba(245, 158, 11, 0.70);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.22);
}

body.asifah-standardized .nav-btn.rhetoric-btn {
  border-color: rgba(34, 197, 94, 0.40);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(22, 163, 74, 0.05) 100%);
}

body.asifah-standardized .nav-btn.rhetoric-btn .nav-btn-status {
  color: #4ade80;
}

body.asifah-standardized .nav-divider {
  height: 1px;
  background: rgba(56, 189, 248, 0.16);
  margin: 5px 0;
}

.asifah-injected-sidebar {
  position: fixed !important;
  top: 20px !important;
  left: 20px !important;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  z-index: 20;
}

body.asifah-injected-sidebar-active {
  padding-left: 230px;
}

.asifah-mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 10001;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  background: var(--asifah-shell-card);
  color: var(--asifah-shell-accent);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.asifah-mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.asifah-mobile-backdrop.open {
  display: block;
}

.asifah-mobile-drawer {
  display: block;
  position: fixed;
  inset: 0 auto 0 0;
  width: min(84vw, 320px);
  z-index: 9999;
  padding: 58px 14px 20px;
  overflow-y: auto;
  background: var(--asifah-shell-card);
  border-right: 2px solid var(--asifah-shell-accent);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
  transform: translateX(-105%);
  transition: transform 0.25s ease;
}

.asifah-mobile-drawer.open {
  transform: translateX(0);
}

.asifah-mobile-drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--asifah-shell-border);
  background: transparent;
  color: var(--asifah-shell-text);
  cursor: pointer;
}

.asifah-mobile-drawer-title {
  position: absolute;
  top: 18px;
  left: 16px;
  right: 54px;
  color: var(--asifah-shell-accent);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.asifah-footer {
  background: var(--asifah-shell-card);
  border: 1px solid var(--asifah-shell-border);
  border-radius: 12px;
  box-sizing: border-box;
  width: min(1600px, calc(100% - 40px));
  padding: 22px 24px;
  margin: 24px auto;
  text-align: center;
  color: var(--asifah-shell-text);
}

.asifah-footer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--asifah-shell-accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.asifah-footer-sources {
  font-size: 0.78rem;
  color: var(--asifah-shell-text);
  margin: 0 auto 14px;
  line-height: 1.5;
  max-width: 760px;
}

.asifah-footer-pills {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.asifah-footer-pill {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1.5px solid;
}

.asifah-footer-pill.bmc {
  background: rgba(251, 191, 36, 0.12);
  color: #f59e0b;
  border-color: rgba(251, 191, 36, 0.5);
}

.asifah-footer-pill.contact {
  background: rgba(56, 189, 248, 0.12);
  color: var(--asifah-shell-accent);
  border-color: rgba(56, 189, 248, 0.5);
}

.asifah-footer-disclaimer {
  font-size: 0.7rem;
  color: var(--asifah-shell-muted);
  font-style: italic;
  margin: 0 auto 10px;
  max-width: 760px;
  line-height: 1.5;
}

.asifah-footer-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.asifah-footer-links a {
  color: var(--asifah-shell-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--asifah-shell-muted);
}

.asifah-footer-links a:hover {
  color: var(--asifah-shell-accent);
  border-bottom-color: var(--asifah-shell-accent);
}

@media (max-width: 1199px) {
  body.asifah-standardized .nav-sidebar {
    display: none !important;
  }

  body.asifah-injected-sidebar-active {
    padding-left: 0;
  }

  .asifah-mobile-menu-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  body.asifah-standardized.asifah-shell-watermark-active::before {
    min-width: 520px;
    min-height: 520px;
    opacity: 0.05;
  }

  [data-theme="dark"] body.asifah-standardized.asifah-shell-watermark-active::before {
    opacity: 0.12;
  }
}
