/* ════════════════════════════════════════════════════════════════════════════
   CODEREYX UNIVERSAL ECOSYSTEM SHELL & APP SWITCHER (WAFFLE MENU)
   Standardized navigation component across Central, Guard, TrustCheck, LeadFlow & ProtoStudio
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  --cdx-shell-bg: #0c121e;
  --cdx-shell-surface: #111827;
  --cdx-shell-border: #1e293b;
  --cdx-shell-border-active: rgba(0, 212, 255, 0.4);
  --cdx-shell-cyan: #00d4ff;
  --cdx-shell-purple: #7c3aed;
  --cdx-shell-green: #10b981;
  --cdx-shell-amber: #f59e0b;
  --cdx-shell-pink: #d946ef;
  --cdx-shell-red: #ef4444;
  --cdx-shell-text: #f8fafc;
  --cdx-shell-muted: #94a3b8;
}

/* Waffle button trigger */
.cdx-waffle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--cdx-shell-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
  padding: 0;
  outline: none;
  flex-shrink: 0;
}

.cdx-waffle-btn:hover,
.cdx-waffle-btn.active {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.35);
  color: var(--cdx-shell-cyan);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.15);
}

.cdx-waffle-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.cdx-waffle-btn:hover svg {
  transform: rotate(90deg);
}

/* Hub Home Quick Button */
.cdx-hub-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--cdx-shell-cyan);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.cdx-hub-link:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--cdx-shell-cyan);
  color: #fff;
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.25);
  transform: translateY(-1px);
}

.cdx-hub-link svg {
  width: 14px;
  height: 14px;
}

/* Dropdown Overlay / Backdrop */
#cdx-waffle-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(4, 7, 13, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#cdx-waffle-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Dropdown Container */
#cdx-waffle-dropdown {
  position: fixed;
  top: 60px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 80px);
  background: var(--cdx-shell-bg);
  border: 1px solid var(--cdx-shell-border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 212, 255, 0.15);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95) translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
}

#cdx-waffle-dropdown.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Dropdown Header */
.cdx-waffle-header {
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--cdx-shell-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cdx-waffle-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.cdx-waffle-brand-logo {
  height: 20px;
  width: auto;
}

.cdx-waffle-brand-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.cdx-waffle-badge-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(0, 212, 255, 0.1);
  color: var(--cdx-shell-cyan);
  border: 1px solid rgba(0, 212, 255, 0.25);
  letter-spacing: 0.04em;
}

/* Products Grid */
.cdx-waffle-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cdx-waffle-body::-webkit-scrollbar {
  width: 4px;
}

.cdx-waffle-body::-webkit-scrollbar-thumb {
  background: var(--cdx-shell-border);
  border-radius: 2px;
}

.cdx-waffle-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  text-decoration: none !important;
  color: var(--cdx-shell-text);
  transition: all 0.18s ease;
  position: relative;
}

.cdx-waffle-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}

.cdx-waffle-item.current {
  background: rgba(0, 212, 255, 0.07);
  border-color: rgba(0, 212, 255, 0.28);
}

.cdx-waffle-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cdx-waffle-info {
  flex: 1;
  min-width: 0;
}

.cdx-waffle-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.cdx-waffle-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cdx-waffle-pill-current {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.2);
  color: var(--cdx-shell-cyan);
  border: 1px solid rgba(0, 212, 255, 0.4);
  text-transform: uppercase;
}

.cdx-waffle-desc {
  font-size: 11.5px;
  color: var(--cdx-shell-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cdx-waffle-arrow {
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.cdx-waffle-item:hover .cdx-waffle-arrow {
  color: var(--cdx-shell-cyan);
  transform: translateX(2px);
}

/* Footer & Utilities */
.cdx-waffle-footer {
  padding: 10px 14px;
  background: rgba(10, 15, 26, 0.8);
  border-top: 1px solid var(--cdx-shell-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cdx-waffle-footer-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--cdx-shell-muted);
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.cdx-waffle-footer-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.cdx-waffle-footer-link.logout:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

/* Universal Standalone Header Strip for Products without Topbars (e.g. Guard) */
.cdx-top-strip {
  width: 100%;
  height: 52px;
  background: rgba(12, 18, 30, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--cdx-shell-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-sizing: border-box;
}

.cdx-top-strip-left,
.cdx-top-strip-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cdx-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.cdx-product-tag span.badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
