/* Layout Styles - Page structure and layout components */
/* Extracted from site.css - Lines 286-308, 1322-1420 */

/* Title row layout */
.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.page-title {
    flex: 1;
}

.page-title .title {
    margin-bottom: 0.5rem !important;
    margin-top: 0.5rem !important;
}

/* Add margin around the text inside page headers */
.page-title .title span {
    margin: 0 0.5rem;
}

.page-title .subtitle {
    margin-bottom: 0 !important;
}

/* Column layout */
.columns.is-desktop-reversed {
    flex-direction: row;
}

@media (max-width: 1023px) {
    .columns.is-desktop-reversed {
        flex-direction: column-reverse;
    }
}

/* Content container - generic version of doc-content */
.content-container {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.content-container h1,
.content-container h2,
.content-container h3,
.content-container h4,
.content-container h5,
.content-container h6 {
    color: var(--text-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-container h1:first-child,
.content-container h2:first-child,
.content-container h3:first-child {
    margin-top: 0;
}

.content-container p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.content-container ul,
.content-container ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content-container li {
    margin-bottom: 0.5rem;
}

.content-container code {
    background: var(--bg-color-secondary);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.875em;
}

.content-container pre {
    background: var(--bg-color-secondary);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.content-container blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-color-muted);
}

/* Content list styles - generic version of doc-list */
.content-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.content-item {
    display: block;
    padding: 1rem 1.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
}

.content-item:hover {
    background: var(--bg-color-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.content-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.content-item-description {
    color: var(--text-color-muted);
    font-size: 0.875rem;
}

/* Item list styles - adapted from account-list */
.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-list-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.item-list-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.item-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.item-meta {
    color: var(--text-color-muted);
    font-size: 0.875rem;
}

/* Item details */
.item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Detail item layout */
.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    color: var(--text-color-muted);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: var(--text-color);
    font-weight: 500;
}

/* Item summary styles */
.item-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-color-secondary);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.summary-item {
    text-align: center;
}

.summary-label {
    color: var(--text-color-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.summary-value {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.summary-value.is-success {
    color: var(--success-color);
}

.summary-value.is-danger {
    color: var(--danger-color);
}

.summary-value.is-warning {
    color: var(--warning-color);
}

/* Item actions */
.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Data display layout for view mode - useful for any detail view */
.data-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.data-display-item {
    display: flex;
    flex-direction: column;
}

.data-display-label {
    color: var(--text-color-muted);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.data-display-value {
    color: var(--text-color);
    font-size: 1.125rem;
    font-weight: 500;
}

/* Loading template for iframes */
.loading-template {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: var(--bg-color-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.loading-overlay {
    display: none;
    pointer-events: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: var(--loading-overlay-bg, rgba(0,0,0,0.5)) !important;
    z-index: 9999 !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
}

.loading-overlay.is-active {
    display: flex !important;
    pointer-events: auto !important;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: var(--text-color);
    font-size: 16px;
    margin: 0;
}

@keyframes loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}/* Subtitle text margin adjustment */
.page-title .subtitle {
    margin-left: 2rem !important;
}/* Add Tool button margin */
.page-actions {
    margin-right: 1rem;
}

.page-actions .buttons {
    margin-right: 1rem;
}

/* Navbar hamburger menu for utility icons (License, Settings, About) */
.nav-hamburger-menu {
    padding: 0.5rem 0.75rem !important;
}

.nav-hamburger-menu .icon {
    font-size: 1.25rem;
}

/* Hide the default Bulma dropdown chevron on all navbar dropdown toggles.
   Previous fix only targeted .nav-hamburger-menu; users reported the chevron
   overlaying the active icon on other dropdowns (user menu, nav dropdowns). */
.navbar-dropdown-toggle > .navbar-link::after {
    display: none !important;
}

/* Navbar dropdown styling - ensure proper colors in both themes.
   A full border (not just border-top) is required so the dropdown has a
   visible container outline against similarly-colored page backgrounds. */
.navbar.is-dark .navbar-dropdown {
    background-color: var(--bg-color, #fff);
    border-top: 2px solid var(--primary-color, #3273dc);
    border-left: 1px solid var(--border-color, #dbdbdb);
    border-right: 1px solid var(--border-color, #dbdbdb);
    border-bottom: 2px solid var(--primary-color, #3273dc);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 16px rgba(10, 10, 10, 0.15);
    padding: 0.25rem 0;
}

.navbar.is-dark .navbar-dropdown .navbar-item {
    color: var(--text-color, #363636);
}

.navbar.is-dark .navbar-dropdown .navbar-item:hover {
    background-color: var(--bg-color-hover, #f5f5f5);
    color: var(--text-color, #363636);
}

/* Tighter icon–text spacing for top-level navbar items (icon + label).
   Bulma's .icon is a 1.5rem flex container; we only need a sliver of
   margin so the text doesn't touch the icon glyph. */
.nav-icon {
    margin-right: 0.15rem;
}

/* Style dropdown items with icons */
.navbar-dropdown .navbar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-dropdown .navbar-item .icon {
    width: 1.5rem;
    text-align: center;
}

/* Click-to-toggle navbar dropdowns (replaces Bulma is-hoverable) */
.navbar-dropdown-toggle > .navbar-dropdown {
    display: none;
}

.navbar-dropdown-toggle.is-active > .navbar-dropdown {
    display: block;
}

/* Show dropdown on hover as well for mouse users */
@media (hover: hover) {
    .navbar-dropdown-toggle:hover > .navbar-dropdown {
        display: block;
    }
}

/* Login button visibility — ghost buttons in navbar must use navbar-text color
   so the icon is visible against the dark navbar background in all themes.
   This fixes the login button being invisible in high-contrast and dark themes. */
.navbar .login-btn,
.navbar .login-btn .icon,
.navbar .login-btn .icon i {
    color: var(--navbar-text, #ffffff) !important;
}

.navbar .login-btn:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Navbar brand app name — ensure <strong> text is readable against navbar bg.
   In dark variants the inherited color can be too faint. */
.navbar-brand .navbar-item strong {
    color: var(--navbar-text, #ffffff) !important;
}

/* Main content spacing — prevent page heading/icon from being clipped at
   the top and last row of tiles from touching the container bottom.
   Applied directly to .container since content is injected without a
   .section wrapper (layout.gohtml: main > .container > content). */
.main-content > .container {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
}

/* Pages whose primary content is a VirtualDataGrid fill the viewport —
   the grid's autoFit pass sizes the grid to meet the page footer exactly,
   so any margin / padding rendered below the grid container becomes
   visible deadspace AND pushes the page footer past the viewport bottom
   (Bug B, #736). The autoFit calc can't see chrome that lives outside
   the grid container, so we zero out the chrome via CSS instead.

   `:has(.grid-footer)` is the grid-presence marker — every VDG creates
   a .grid-footer element inside its container in setupDOM(). It's
   strictly more permissive than the previous `:has(.vdg-toolbar)`
   marker (which only fired when the grid was constructed with the
   built-in toolbar option), so pages that use external Bulma toolbars
   above the grid now also get the chrome zeroed.

   Pages without a VDG are unaffected — they keep the 2.5rem breathing
   room above the page footer and Bulma's 1.5rem block-spacing between
   stacked cards / boxes / sections. */
/* CHROME ZERO — both axes.
   applyAutoFit() in virtual-grid.js sizes the grid via:
     available = footerRect.top - gridTop - belowExtra
   It assumes chrome ABOVE and BELOW the grid container is zeroed. Without
   that assumption the math overshoots: setting grid height = available pushes
   the page footer further down on reflow, growing docHeight past the viewport
   (Bug B / #736 regression after #779 removed the safety cap).

   So zero `padding` AND `margin` on both axes for every VDG-bearing wrapper.
   The legitimate content (title-row, toolbar) still takes its natural space —
   we just stop adding wrapper padding on top of it. */
.main-content > .container:has(.grid-footer) {
    padding-top: 0;
    padding-bottom: 0;
}

.card:has(.grid-footer) {
    margin-top: 0;
    margin-bottom: 0;
    /* Bulma's .card:not(:last-child) block-spacing rule has equal specificity
       (0,2,0) as this rule. layout.css loads after bulma.min.css so this wins
       in cascade order, but only once the :has() style recalculation has
       propagated. The JS walk (virtual-grid.js) also applies a predictive
       guard that skips marginBottom for nodes containing .grid-footer so that
       the measurement is not sensitive to :has() CSS timing (wsc-ui #826). */
    padding-bottom: 0;
}

/* `.card-content` is the inner padding wrapper inside `.card`. Templates that
   host a VDG typically add `p-0` to zero this padding, but the rule should not
   depend on every consumer remembering that class — defensively zero the
   vertical padding when a VDG lives inside. The card border itself adds no
   layout space, so this is purely the chrome-zero rule. */
.card-content:has(.grid-footer) {
    padding-top: 0;
    padding-bottom: 0;
}

.box:has(.grid-footer) {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.content-section:has(.grid-footer) {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Bulma `.section` adds 3rem padding top/bottom and is sometimes used as a
   wrapper around grid pages. Zero both so the grid's autoFit math (which
   doesn't see this padding) doesn't overshoot. */
.section:has(.grid-footer) {
    padding-top: 0;
    padding-bottom: 0;
}

/* `.notification` carries Bulma's block-spacing margin-bottom (1.5rem) plus
   its own padding. When a VDG is rendered inside a notification (rare) or
   when a hidden notification banner toggles visible above a grid, the
   margin pushes the footer. Zero both axes for any VDG-bearing notification. */
.notification:has(.grid-footer) {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Equal-height dashboard tiles — when .columns.is-multiline wraps tile
   cards, shorter cards collapse. Setting height: 100% on .box inside
   each .column stretches every card to match the tallest in the row. */
.columns.is-multiline > .column > .box {
    height: 100%;
}
