/**
 * Frontend Isolation - Prevents admin CSS bleeding into frontend pages
 *
 * CREATED: 2026-01-29
 * UPDATED: 2026-01-30 - Hide secondary toolbar on ALL frontend pages (fixes BigPipe duplicate ID bug)
 *
 * PURPOSE: When logged-in users view frontend pages, the Gin admin
 * theme adds CSS and a secondary toolbar which causes BigPipe issues.
 * The secondary toolbar duplicates IDs causing BigPipe to fail.
 */

/* ==========================================================================
   GLOBAL: HIDE SECONDARY TOOLBAR ON ALL FRONTEND PAGES
   This fixes the BigPipe duplicate ID issue where user menu doesn't work
   ========================================================================== */

/* Hide secondary toolbar on ALL non-admin pages - ONLY for anonymous users */
body:not(.path-admin):not(.user-logged-in) .gin-secondary-toolbar,
body:not(.path-admin):not(.user-logged-in) .gin-secondary-toolbar--frontend,
body:not(.path-admin):not(.user-logged-in) #toolbar-administration-secondary {
  display: none !important;
}

/* Also hide on user pages specifically - ONLY for anonymous users */
body.path-user:not(.user-logged-in) .gin-secondary-toolbar,
body.path-user:not(.user-logged-in) .gin-secondary-toolbar--frontend,
body.path-user:not(.user-logged-in) #toolbar-administration-secondary {
  display: none !important;
}

/* ==========================================================================
   FRONTEND NODE SELECTORS
   Target both meeting and conference node types
   ========================================================================== */

/* Reset Gin body padding - the gin--vertical-toolbar class adds left padding */
body.gin--vertical-toolbar.path-node.page-node-type-meeting:not(.path-node-edit),
body.gin--vertical-toolbar.path-node.page-node-type-conference:not(.path-node-edit) {
  padding-left: 0 !important;
  padding-top: 0 !important;
  margin-left: 0 !important;
}

/* Also target without gin--vertical-toolbar in case it's horizontal */
body.path-node.page-node-type-meeting:not(.path-node-edit),
body.path-node.page-node-type-conference:not(.path-node-edit) {
  background-color: #f5f5f5 !important;
  padding-left: 0 !important;
  padding-top: 0 !important;
}

/* ==========================================================================
   HIDE GIN SECONDARY TOOLBAR
   The breadcrumb bar that appears at the top on frontend
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit):not(.user-logged-in) .gin-secondary-toolbar,
body.path-node.page-node-type-meeting:not(.path-node-edit):not(.user-logged-in) .gin-secondary-toolbar--frontend,
body.path-node.page-node-type-conference:not(.path-node-edit):not(.user-logged-in) .gin-secondary-toolbar,
body.path-node.page-node-type-conference:not(.path-node-edit):not(.user-logged-in) .gin-secondary-toolbar--frontend {
  display: none !important;
}

/* ==========================================================================
   PAGE WRAPPER AND LAYOUT CONTAINER
   Reset Gin's layout adjustments
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) .page-wrapper,
body.path-node.page-node-type-conference:not(.path-node-edit) .page-wrapper {
  margin-left: 0 !important;
  padding-left: 0 !important;
  padding-top: 0 !important;
}

body.path-node.page-node-type-meeting:not(.path-node-edit) .layout-container,
body.path-node.page-node-type-conference:not(.path-node-edit) .layout-container {
  margin: 0 !important;
  padding: 20px !important;
  max-width: 100% !important;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) .page-content,
body.path-node.page-node-type-meeting:not(.path-node-edit) main.page-content,
body.path-node.page-node-type-conference:not(.path-node-edit) .page-content,
body.path-node.page-node-type-conference:not(.path-node-edit) main.page-content {
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
}

/* ==========================================================================
   ARTICLE/NODE CONTENT CARD
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) article,
body.path-node.page-node-type-conference:not(.path-node-edit) article {
  background: #fff !important;
  border-radius: 8px !important;
  padding: 30px !important;
  margin: 20px auto !important;
  max-width: 1200px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) h1,
body.path-node.page-node-type-conference:not(.path-node-edit) h1 {
  font-size: 2rem !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin-bottom: 1.5rem !important;
  line-height: 1.3 !important;
}

body.path-node.page-node-type-meeting:not(.path-node-edit) h1 .field,
body.path-node.page-node-type-conference:not(.path-node-edit) h1 .field {
  font-size: inherit !important;
  font-weight: inherit !important;
  color: inherit !important;
}

/* ==========================================================================
   FIELD LABELS AND ITEMS
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) .field__label,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__label {
  font-weight: 600 !important;
  color: #555 !important;
  font-size: 0.85rem !important;
  text-transform: uppercase !important;
  margin-bottom: 0.25rem !important;
  letter-spacing: 0.5px !important;
}

body.path-node.page-node-type-meeting:not(.path-node-edit) .field__item,
body.path-node.page-node-type-meeting:not(.path-node-edit) .field__items,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__item,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__items {
  color: #333 !important;
  font-size: 1rem !important;
  margin-bottom: 0.5rem !important;
}

body.path-node.page-node-type-meeting:not(.path-node-edit) .field,
body.path-node.page-node-type-conference:not(.path-node-edit) .field {
  margin-bottom: 1.25rem !important;
}

/* ==========================================================================
   LINKS
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) .field__item a,
body.path-node.page-node-type-meeting:not(.path-node-edit) .field__items a,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__item a,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__items a {
  color: #0066cc !important;
  text-decoration: none !important;
}

body.path-node.page-node-type-meeting:not(.path-node-edit) .field__item a:hover,
body.path-node.page-node-type-meeting:not(.path-node-edit) .field__items a:hover,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__item a:hover,
body.path-node.page-node-type-conference:not(.path-node-edit) .field__items a:hover {
  text-decoration: underline !important;
}

/* ==========================================================================
   HIDE CONTEXTUAL LINKS (the pencil edit icon)
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit):not(.user-logged-in) .contextual,
body.path-node.page-node-type-conference:not(.path-node-edit):not(.user-logged-in) .contextual {
  display: none !important;
}

/* ==========================================================================
   DATETIME FORMATTING
   ========================================================================== */

body.path-node.page-node-type-meeting:not(.path-node-edit) time.datetime,
body.path-node.page-node-type-conference:not(.path-node-edit) time.datetime {
  color: #333 !important;
  font-size: 1rem !important;
}

/* ==========================================================================
   USER PROFILE PAGES
   Styling for /user/1 (View profile) pages
   ========================================================================== */

/* Body background and layout */
body.path-user:not(.path-user-edit):not(.path-user-login):not(.path-user-register) {
  background-color: #f5f5f5 !important;
}

/* Reset Gin body padding for user pages */
body.gin--vertical-toolbar.path-user:not(.path-user-edit) {
  padding-left: 0 !important;
  padding-top: 39px !important;
}

/* Page wrapper */
body.path-user:not(.path-user-edit) .page-wrapper {
  margin-left: 0 !important;
  padding-left: 0 !important;
}

/* Layout container */
body.path-user:not(.path-user-edit) .layout-container {
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 20px !important;
}

/* Content header with breadcrumb */
body.path-user:not(.path-user-edit) .content-header {
  background: #fff !important;
  border-bottom: 1px solid #e0e0e0 !important;
  padding: 15px 0 !important;
  margin-bottom: 20px !important;
}

/* User profile article card */
body.path-user:not(.path-user-edit) article.profile {
  background: #fff !important;
  border-radius: 8px !important;
  padding: 30px !important;
  margin: 20px auto !important;
  max-width: 800px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Page title */
body.path-user:not(.path-user-edit) .page-title,
body.path-user:not(.path-user-edit) h1.page-title {
  font-size: 1.75rem !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin-bottom: 1rem !important;
}

/* Field labels (like "Member for") */
body.path-user:not(.path-user-edit) .label,
body.path-user:not(.path-user-edit) h4.label {
  font-weight: 600 !important;
  color: #555 !important;
  font-size: 0.9rem !important;
  margin-bottom: 0.25rem !important;
}

/* Form items in profile display */
body.path-user:not(.path-user-edit) .form-item {
  margin-bottom: 1rem !important;
  color: #333 !important;
}

/* Local tasks (tabs like View, Edit, Shortcuts) - Match admin theme style */
body.path-user:not(.path-user-edit) .tabs-wrapper {
  margin-bottom: 20px !important;
  max-width: 800px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.path-user:not(.path-user-edit) .tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  margin: 0 0 20px 0 !important;
  padding: 0 !important;
  border: 1px solid #d3d4d9 !important;
  border-radius: 4px !important;
  background: #fff !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  list-style: none !important;
}

body.path-user:not(.path-user-edit) .tabs__tab {
  display: block !important;
  position: relative !important;
  border-bottom: none !important;
  border-right: 1px solid #d3d4d9 !important;
  background-color: #f5f5f5 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
}

body.path-user:not(.path-user-edit) .tabs__tab:last-child {
  border-right: none !important;
}

body.path-user:not(.path-user-edit) .tabs__tab.is-active {
  background-color: #fff !important;
  border-left: 3px solid #0066cc !important;
}

body.path-user:not(.path-user-edit) .tabs__link {
  display: block !important;
  padding: 12px 20px !important;
  color: #333 !important;
  text-decoration: none !important;
}

body.path-user:not(.path-user-edit) .tabs__tab:hover {
  background-color: #e8f4fc !important;
}

body.path-user:not(.path-user-edit) .tabs__tab.is-active .tabs__link {
  color: #0066cc !important;
  font-weight: 700 !important;
}
