/* MyAwesomeNovelz AI — Layout: Header, Sidebar, Workspace, Navigation */

/* App Header Bar - Smart Fluid Architecture */
.app-header {
  min-height: 58px;
  height: auto;
  background: rgba(15, 17, 26, 0.95);
  backdrop-filter: var(--glass-backdrop);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  z-index: 100;
  gap: 8px;
  overflow: visible !important;
  box-sizing: border-box;
  transition: var(--theme-transition);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
  overflow: visible !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--grad-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-glow);
}

.brand-title span {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Categorized Grouped Navigation Bar */
.header-center {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-dropdown-group {
  position: relative;
}

.nav-category-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-category-btn:hover, .nav-dropdown-group:hover .nav-category-btn {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-category-btn.active {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Dropdown Menu Popup & Safe-Zone Hover Bridge */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 220px;
  background: rgba(15, 18, 30, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), var(--shadow-glow);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 100000;
}


/* Invisible Hover Bridge preventing mouse dropout */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -14px;
  left: -10px;
  right: -10px;
  height: 18px;
  background: transparent;
}

.nav-dropdown-group:hover .dropdown-menu,
.nav-dropdown-group.active .dropdown-menu {
  display: flex !important;
  animation: dropdown-pop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}


.dropdown-item {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: normal;
  line-height: 1.3;
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-main);
  border-left: 3px solid var(--primary);
  padding-left: 15px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.credit-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--border-accent);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-light);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.credit-badge:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.84rem;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
  background: var(--grad-pink-violet);
  color: white;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}
.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

/* App Main Container */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Grouped Sidebar */
.sidebar {
  width: 210px;
  min-width: 210px;
  background: rgba(12, 14, 22, 0.95);
  backdrop-filter: var(--glass-backdrop);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 12px;
  flex-shrink: 0;
  overflow-y: auto;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  width: 54px !important;
  min-width: 54px !important;
  padding: 12px 4px !important;
}

.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .project-selector label,
.sidebar.collapsed .project-select-btn span,
.sidebar.collapsed .sidebar-text {
  display: none !important;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center !important;
  padding: 8px 0 !important;
}


.sidebar-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-selector {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-md);
}

.project-selector label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}

.project-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.sidebar-section-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-light);
  font-weight: 800;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
}

.sidebar-item {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.84rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.sidebar-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-item.active {
  color: var(--primary-light);
  background: rgba(139, 92, 246, 0.14);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

/* Main Viewport Workspace */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.view-panel {
  display: none;
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 20px;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

/* Page Header inside Views — Spacing & Zoom-Proof Responsive Wrap */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 20px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
  max-width: 100%;
}

.view-title-group {
  min-width: 0;
  flex: 1 1 260px;
}

.view-header .flex-center,
.view-header > div:last-child {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  max-width: 100%;
}

.view-header .btn {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.view-title-group h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  word-break: break-word;
}

.view-title-group p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 760px;
  margin-top: 4px;
}

/* Inspector Drawer Slide-over */
.inspector-drawer {
  position: fixed;
  top: 60px;
  right: -380px;
  width: 360px;
  height: calc(100vh - 60px);
  background: rgba(15, 18, 30, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--border-accent);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inspector-drawer.active {
  right: 0;
}

.inspector-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.inspector-body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   DOMAIN ACCENT ANCHORS & SPECIFIC LAYOUT TEMPLATES
   Resolves visual monotony with domain colors & distinct layout grids
   ═══════════════════════════════════════════════════════════════ */

/* Domain Theme Anchors — Vibrant Visual Hierarchy */
body[data-domain="hub-story"] {
  --domain-current: var(--domain-story);
  --border-accent: rgba(6, 182, 212, 0.4);
}
body[data-domain="hub-story"] .view-title-group h2 {
  color: var(--domain-story);
  text-shadow: 0 0 16px rgba(6, 182, 212, 0.3);
}
body[data-domain="hub-story"] .sidebar-section-title {
  border-bottom: 2px solid var(--domain-story);
  color: var(--domain-story);
}
body[data-domain="hub-story"] .ai-form-card {
  border-top: 2px solid rgba(6, 182, 212, 0.6);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.05) 0%, rgba(15, 18, 30, 0.9) 100%);
}

body[data-domain="hub-visual"] {
  --domain-current: var(--domain-visual);
  --border-accent: rgba(236, 72, 153, 0.4);
}
body[data-domain="hub-visual"] .view-title-group h2 {
  color: var(--domain-visual);
  text-shadow: 0 0 16px rgba(236, 72, 153, 0.3);
}
body[data-domain="hub-visual"] .sidebar-section-title {
  border-bottom: 2px solid var(--domain-visual);
  color: var(--domain-visual);
}
body[data-domain="hub-visual"] .ai-form-card {
  border-top: 2px solid rgba(236, 72, 153, 0.6);
  background: linear-gradient(180deg, rgba(236, 72, 153, 0.05) 0%, rgba(15, 18, 30, 0.9) 100%);
}

body[data-domain="hub-audio"] {
  --domain-current: var(--domain-audio);
  --border-accent: rgba(245, 158, 11, 0.4);
}
body[data-domain="hub-audio"] .view-title-group h2 {
  color: var(--domain-audio);
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}
body[data-domain="hub-audio"] .sidebar-section-title {
  border-bottom: 2px solid var(--domain-audio);
  color: var(--domain-audio);
}
body[data-domain="hub-audio"] .ai-form-card {
  border-top: 2px solid rgba(245, 158, 11, 0.6);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, rgba(15, 18, 30, 0.9) 100%);
}

body[data-domain="hub-gameplay"] {
  --domain-current: var(--domain-gameplay);
  --border-accent: rgba(16, 185, 129, 0.4);
}
body[data-domain="hub-gameplay"] .view-title-group h2 {
  color: var(--domain-gameplay);
  text-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}
body[data-domain="hub-gameplay"] .sidebar-section-title {
  border-bottom: 2px solid var(--domain-gameplay);
  color: var(--domain-gameplay);
}
body[data-domain="hub-gameplay"] .ai-form-card {
  border-top: 2px solid rgba(16, 185, 129, 0.6);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(15, 18, 30, 0.9) 100%);
}

body[data-domain="hub-release"] {
  --domain-current: var(--domain-release);
  --border-accent: rgba(59, 130, 246, 0.4);
}
body[data-domain="hub-release"] .view-title-group h2 {
  color: var(--domain-release);
  text-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}
body[data-domain="hub-release"] .sidebar-section-title {
  border-bottom: 2px solid var(--domain-release);
  color: var(--domain-release);
}
body[data-domain="hub-release"] .ai-form-card {
  border-top: 2px solid rgba(59, 130, 246, 0.6);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.05) 0%, rgba(15, 18, 30, 0.9) 100%);
}

body[data-domain="hub-monetize"] {
  --domain-current: var(--domain-monetize);
  --border-accent: rgba(168, 85, 247, 0.4);
}
body[data-domain="hub-monetize"] .view-title-group h2 {
  color: var(--domain-monetize);
  text-shadow: 0 0 16px rgba(168, 85, 247, 0.3);
}
body[data-domain="hub-monetize"] .sidebar-section-title {
  border-bottom: 2px solid var(--domain-monetize);
  color: var(--domain-monetize);
}
body[data-domain="hub-monetize"] .ai-form-card {
  border-top: 2px solid rgba(168, 85, 247, 0.6);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.05) 0%, rgba(15, 18, 30, 0.9) 100%);
}

/* Specialized Page Layout Templates */

/* Layout 1: Story Canvas (Full width, maximized height for node editor & screenplay) */
.layout-story-canvas {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 85px);
  padding: 0 8px;
}

/* Layout 2: Hero Viewport + Side Inspector (Shaders, Weather FX, Soundscape) */
.layout-hero-inspector {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 1024px) {
  .layout-hero-inspector {
    grid-template-columns: 1fr;
  }
}

/* Layout 3: Masonry Media Gallery (Backgrounds, Characters, Art Styles, Social Banners) */
.layout-masonry-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Layout 4: Compact Focused Settings (User Profile, API Keys, EULA, Content Rating) */
.layout-settings-compact {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 860px;
  margin: 0 auto;
}
