/* ==========================================================================
   LAYOUT & GLOBAL APP SHELL STYLES
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* App Master Shell */
#app-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Universal Top Switcher Bar (Visible on all views for fast testing & seamless role switching) */
.universal-topbar {
  background: #060A13;
  color: #94A3B8;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
  position: sticky;
  top: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(211, 47, 47, 0.2);
  color: #FF8A80;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.topbar-badge .pulse-dot {
  width: 7px;
  height: 7px;
  background: #EF4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #EF4444;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #EF4444; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.view-switcher-group {
  display: flex;
  align-items: center;
  background: #111C35;
  border: 1px solid #24324F;
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.view-switch-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  padding: 0.25rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.view-switch-btn:hover {
  color: #FFFFFF;
}

.view-switch-btn.active {
  background: var(--brand-red);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.4);
}

.role-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-select {
  background: #111C35;
  border: 1px solid #24324F;
  color: #E2E8F0;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
}

.role-select:focus {
  border-color: var(--brand-red);
}

/* Master Header for Newsroom CMS */
.newsroom-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 900;
}

.brand-logo-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.brand-logo-icon, .brand-logo-img-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(196, 18, 26, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.9);
  position: relative;
  overflow: hidden;
  background: #C4121A;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Noto Sans Devanagari', 'Mukta', var(--font-sans);
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #FFFFFF;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-title span {
  font-family: 'Inter', var(--font-sans);
  font-weight: 900;
  color: #FACC15;
  filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.5));
}

.brand-subtitle {
  font-family: 'Mukta', 'Noto Sans Devanagari', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #FDE047;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}


/* Newsroom Navigation Items */
.newsroom-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
}

.newsroom-nav-item {
  position: relative;
}

.newsroom-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.newsroom-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.newsroom-nav-btn.active {
  background: rgba(211, 47, 47, 0.15);
  color: #FF8A80;
  font-weight: 700;
}

.newsroom-nav-btn .nav-badge {
  background: var(--brand-red);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Newsroom Workspace Container */
.newsroom-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--topbar-height) - var(--header-height));
  background: var(--bg-body);
}

/* 3-Column Layout for News Editor */
.editor-workspace {
  display: grid;
  grid-template-columns: var(--newsroom-sidebar-w) 1fr var(--newsroom-right-w);
  width: 100%;
  height: calc(100vh - var(--topbar-height) - var(--header-height));
  overflow: hidden;
}

.editor-sidebar-left {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.editor-canvas-center {
  background: var(--bg-body);
  overflow-y: auto;
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.editor-sidebar-right {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Generic View Container */
.main-view-container {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Touch Friendly Scroll Helper */
.scroll-touch-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll-touch-x::-webkit-scrollbar {
  display: none;
}

/* Mobile Navigation Drawer */
.mobile-nav-toggle-btn {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #FFFFFF;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
}

.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: calc(var(--topbar-height) + var(--header-height));
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 19, 43, 0.98);
  backdrop-filter: blur(15px);
  z-index: 9999;
  padding: 1.5rem;
  overflow-y: auto;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-nav-drawer.active {
  display: flex;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.mobile-nav-link.active, .mobile-nav-link:hover {
  background: rgba(211, 47, 47, 0.15);
  border-color: var(--brand-red);
  color: #FF8A80;
}

/* Responsive adjustments across all viewports */
@media (max-width: 1280px) {
  .editor-workspace {
    grid-template-columns: 220px 1fr 310px;
  }
}

@media (max-width: 1024px) {
  .editor-workspace {
    grid-template-columns: 1fr 320px;
  }
  .editor-sidebar-left {
    display: none;
  }
  .newsroom-nav-links {
    display: none;
  }
  .mobile-nav-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .universal-topbar {
    height: auto;
    min-height: var(--topbar-height);
    padding: 0.4rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .topbar-left, .topbar-right {
    gap: 0.65rem;
    flex-wrap: wrap;
  }
  .newsroom-header {
    padding: 0 1rem;
    height: auto;
    min-height: var(--header-height);
  }
  .brand-title {
    font-size: 1rem;
  }
  .brand-subtitle {
    font-size: 0.62rem;
  }
  .editor-workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .editor-sidebar-right {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .editor-canvas-center {
    padding: 1.25rem 0.85rem;
  }
  .topbar-left span.hide-mobile, .topbar-right span.hide-mobile {
    display: none;
  }
}

@media (max-width: 480px) {
  .universal-topbar {
    padding: 0.35rem 0.5rem;
  }
  .view-switch-btn {
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
  }
  .topbar-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
  }
  .brand-logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
  .role-select {
    font-size: 0.72rem;
    padding: 0.15rem 0.4rem;
    max-width: 130px;
  }
}
