/* ═══════════════════════════════════════════════════════════════
   DRO v24 Portal — Nexus Admin Shell CSS
   Shell: sidebar (left) + topbar (top) + content (main) + statusbar (bottom)
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Marketing shell: allow normal page scrolling */
.marketing-shell {
  min-height: 100vh;
  overflow-y: auto;
}

/* Admin shell: lock viewport to grid */
body:has(.dro-shell) {
  overflow: hidden;
  height: 100vh;
}

/* ── Shell Grid ────────────────────────────────────────── */
.dro-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 56px 1fr 28px;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content"
    "sidebar statusbar";
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: oklch(var(--b1, 0.97 0 0));
}

.dro-shell.sidebar-collapsed {
  grid-template-columns: 64px 1fr;
}

/* ── Sidebar ───────────────────────────────────────────── */
.dro-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: oklch(var(--b2, 0.94 0 0));
  border-right: 1px solid oklch(var(--bc, 0.3 0 0) / 0.1);
  overflow-y: auto;
  overflow-x: hidden;
  width: 260px;
  transition: width 0.2s ease;
  z-index: 40;
}

.dro-sidebar.collapsed {
  width: 64px;
}

.dro-sidebar.collapsed .dro-sidebar__logo-text,
.dro-sidebar.collapsed .dro-sidebar__section-title,
.dro-sidebar.collapsed .dro-sidebar__app-item span:not(.dro-sidebar__app-icon),
.dro-sidebar.collapsed .dro-sidebar__module-list {
  display: none;
}

/* Logo */
.dro-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  flex-shrink: 0;
}

.dro-sidebar__logo-text {
  font-size: 15px;
  font-weight: 700;
  color: oklch(var(--bc, 0.2 0 0));
  letter-spacing: -0.02em;
}

/* Nav */
.dro-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px;
}

.dro-sidebar__nav::-webkit-scrollbar {
  width: 4px;
}

.dro-sidebar__nav::-webkit-scrollbar-thumb {
  background: oklch(var(--bc, 0.3 0 0) / 0.15);
  border-radius: 2px;
}

/* Section */
.dro-sidebar__section {
  margin-bottom: 16px;
}

.dro-sidebar__section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: oklch(var(--bc, 0.3 0 0) / 0.45);
  padding: 8px 8px 4px;
}

/* App Item */
.dro-sidebar__app-group {
  margin-bottom: 1px;
}

.dro-sidebar__app-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: oklch(var(--bc, 0.2 0 0) / 0.7);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.dro-sidebar__app-item:hover {
  background: oklch(var(--bc, 0.3 0 0) / 0.06);
  color: oklch(var(--bc, 0.2 0 0) / 0.9);
}

.dro-sidebar__app-item.active {
  background: oklch(var(--p, 0.55 0.2 260) / 0.1);
  color: oklch(var(--p, 0.55 0.2 260));
  font-weight: 600;
}

/* App Icon */
.dro-sidebar__app-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* Module List (collapsible sub-nav) */
.dro-sidebar__module-list {
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 0;
  padding-left: 22px;
}

.dro-sidebar__module-list.expanded {
  max-height: 500px;
}

.dro-sidebar__module-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 400;
  color: oklch(var(--bc, 0.2 0 0) / 0.55);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.dro-sidebar__module-item:hover {
  background: oklch(var(--bc, 0.3 0 0) / 0.05);
  color: oklch(var(--bc, 0.2 0 0) / 0.85);
}

.dro-sidebar__module-item.active {
  color: oklch(var(--p, 0.55 0.2 260));
  font-weight: 600;
}

/* Footer */
.dro-sidebar__footer {
  flex-shrink: 0;
  border-top: 1px solid oklch(var(--bc, 0.3 0 0) / 0.08);
  padding: 8px;
}

/* ── Top Bar ───────────────────────────────────────────── */
.dro-topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 56px;
  background: oklch(var(--b1, 0.97 0 0));
  border-bottom: 1px solid oklch(var(--bc, 0.3 0 0) / 0.08);
  z-index: 30;
}

.dro-topbar__spacer {
  flex: 1;
}

/* Breadcrumb */
.dro-topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.dro-topbar__breadcrumb-item {
  color: oklch(var(--bc, 0.2 0 0) / 0.5);
  text-decoration: none;
  transition: color 0.15s;
}

.dro-topbar__breadcrumb-item:hover {
  color: oklch(var(--bc, 0.2 0 0) / 0.8);
}

.dro-topbar__breadcrumb-item.current {
  color: oklch(var(--bc, 0.2 0 0));
  font-weight: 600;
}

.dro-topbar__breadcrumb-sep {
  color: oklch(var(--bc, 0.2 0 0) / 0.2);
  font-size: 11px;
}

/* Search */
.dro-topbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 8px;
  background: oklch(var(--bc, 0.3 0 0) / 0.04);
  border: 1px solid oklch(var(--bc, 0.3 0 0) / 0.1);
  font-size: 13px;
  color: oklch(var(--bc, 0.2 0 0) / 0.4);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 200px;
}

.dro-topbar__search:hover {
  border-color: oklch(var(--bc, 0.3 0 0) / 0.2);
  background: oklch(var(--bc, 0.3 0 0) / 0.06);
}

.dro-topbar__search-key {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: oklch(var(--bc, 0.3 0 0) / 0.06);
  border: 1px solid oklch(var(--bc, 0.3 0 0) / 0.1);
  font-family: monospace;
  letter-spacing: 0.02em;
}

/* Actions */
.dro-topbar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dro-topbar__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: oklch(var(--bc, 0.2 0 0) / 0.5);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.dro-topbar__action-btn:hover {
  background: oklch(var(--bc, 0.3 0 0) / 0.06);
  color: oklch(var(--bc, 0.2 0 0) / 0.8);
}

/* Avatar */
.dro-topbar__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(var(--p, 0.55 0.2 260)), oklch(var(--s, 0.6 0.2 300)));
  color: oklch(var(--pc, 0.97 0 0));
  font-size: 13px;
  font-weight: 700;
  margin-left: 4px;
  cursor: pointer;
}

/* App Switcher */
.dro-topbar__app-switcher {
  position: relative;
}

.dro-topbar__app-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: oklch(var(--b1, 0.97 0 0));
  border: 1px solid oklch(var(--bc, 0.3 0 0) / 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px oklch(0 0 0 / 0.12), 0 2px 8px oklch(0 0 0 / 0.06);
  z-index: 100;
  padding: 12px;
}

.dro-topbar__app-dropdown-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: oklch(var(--bc, 0.3 0 0) / 0.45);
  padding: 4px 8px 8px;
}

.dro-topbar__app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.dro-topbar__app-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.dro-topbar__app-grid-item:hover {
  background: oklch(var(--bc, 0.3 0 0) / 0.06);
}

.dro-topbar__app-grid-item.active {
  background: oklch(var(--p, 0.55 0.2 260) / 0.08);
}

.dro-topbar__app-grid-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: oklch(var(--bc, 0.3 0 0) / 0.06);
  color: oklch(var(--bc, 0.2 0 0) / 0.7);
  transition: background 0.15s, color 0.15s;
}

.dro-topbar__app-grid-item:hover .dro-topbar__app-grid-icon {
  background: oklch(var(--p, 0.55 0.2 260) / 0.12);
  color: oklch(var(--p, 0.55 0.2 260));
}

.dro-topbar__app-grid-item.active .dro-topbar__app-grid-icon {
  background: oklch(var(--p, 0.55 0.2 260) / 0.15);
  color: oklch(var(--p, 0.55 0.2 260));
}

.dro-topbar__app-grid-label {
  font-size: 11px;
  font-weight: 500;
  color: oklch(var(--bc, 0.2 0 0) / 0.65);
  text-align: center;
  line-height: 1.2;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main Content ──────────────────────────────────────── */
.dro-content {
  grid-area: content;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  background: oklch(var(--b1, 0.97 0 0));
}

.dro-content::-webkit-scrollbar {
  width: 6px;
}

.dro-content::-webkit-scrollbar-thumb {
  background: oklch(var(--bc, 0.3 0 0) / 0.12);
  border-radius: 3px;
}

/* ── Status Bar ────────────────────────────────────────── */
.dro-statusbar {
  grid-area: statusbar;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 11px;
  color: oklch(var(--bc, 0.2 0 0) / 0.4);
  background: oklch(var(--b2, 0.94 0 0));
  border-top: 1px solid oklch(var(--bc, 0.3 0 0) / 0.08);
}

.dro-statusbar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(var(--su, 0.7 0.2 150));
}

.dro-statusbar span:last-child {
  margin-left: auto;
}

/* ── Flash Messages ────────────────────────────────────── */
[data-phx-main] .flash {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  animation: flash-in 0.3s ease;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .dro-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "content"
      "statusbar";
  }

  .dro-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    transition: left 0.3s ease;
    z-index: 50;
    box-shadow: none;
  }

  .dro-sidebar.mobile-open {
    left: 0;
    box-shadow: 0 0 40px oklch(0 0 0 / 0.25);
  }

  #mobile-menu-btn {
    display: flex !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DRO v24 Honeycomb 6D Motion Matrix (D6)
   Native CSS implementation of Dimension 6 characteristics
   ═══════════════════════════════════════════════════════════════ */

/* 1. Entry & Scroll Reveals */
[data-reveal] {
  opacity: 0;
  will-change: transform, opacity, filter;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal="fade-in"].is-revealed { opacity: 1; transform: none; filter: none; }
[data-reveal="fade-up"] { transform: translateY(30px); }
[data-reveal="fade-up"].is-revealed { opacity: 1; transform: translateY(0); filter: none; }
[data-reveal="fade-left"] { transform: translateX(30px); }
[data-reveal="fade-left"].is-revealed { opacity: 1; transform: translateX(0); filter: none; }
[data-reveal="fade-right"] { transform: translateX(-30px); }
[data-reveal="fade-right"].is-revealed { opacity: 1; transform: translateX(0); filter: none; }

[data-reveal="blur-in"] { filter: blur(8px); transform: scale(0.95); }
[data-reveal="blur-in"].is-revealed { opacity: 1; filter: blur(0); transform: scale(1); }

[data-reveal="stagger-children"] > * {
  opacity: 0;
  transform: translateY(30px);
  will-change: transform, opacity;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1) var(--reveal-delay, 0ms),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) var(--reveal-delay, 0ms);
}
[data-reveal="stagger-children"].is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* 2. Hover & Interaction */
[data-hover="lift"] {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  will-change: transform, box-shadow;
}
[data-hover="lift"]:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px oklch(var(--bc) / 0.1), 0 8px 10px -6px oklch(var(--bc) / 0.1);
}

[data-hover="glow"] {
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
[data-hover="glow"]:hover {
  box-shadow: 0 0 15px oklch(var(--p) / 0.3);
  border-color: oklch(var(--p));
}

/* 3. Continuous & Background Loops */
@keyframes bg-pan {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

[data-bg="mesh-grid"] {
  background-image: radial-gradient(oklch(var(--bc) / 0.1) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: 0 0;
  animation: mesh-pan 60s linear infinite;
}

@keyframes mesh-pan {
  0% { background-position: 0 0; }
  100% { background-position: 32px 32px; }
}

[data-bg="waves"] {
  background-image: 
    repeating-linear-gradient(45deg, oklch(var(--b2)) 25%, transparent 25%, transparent 75%, oklch(var(--b2)) 75%, oklch(var(--b2))),
    repeating-linear-gradient(45deg, oklch(var(--b2)) 25%, oklch(var(--b1)) 25%, oklch(var(--b1)) 75%, oklch(var(--b2)) 75%, oklch(var(--b2)));
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  animation: bg-pan 30s linear infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

[data-loop="float"] {
  animation: float 4s ease-in-out infinite;
}

/* 4. Complex Structural Effects */
/* Hide scrollbar for swipe-slider but keep functionality */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
