/*
 * WBSP Framework Styles
 * Loaded after vendor and theme styles so framework components and deliberate
 * overrides remain centralized and predictable.
 */
/* Core WBSP layout and theme rules */
body {
    background-color: var(--w-bg);
    color: var(--w-text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: all 0.15s ease-in-out;
}

.card {
    background-color: var(--w-card-bg) !important;
    border-radius: var(--w-radius) !important;
    box-shadow: var(--w-shadow-spec) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    color: var(--w-text) !important;
}

.form-control,
.form-select,
.btn,
.list-group-item {
    border-radius: var(--w-radius) !important;
}

.fs-7 {
    font-size: 0.75rem;
}

.font-mono {
    font-family: var(--bs-font-monospace);
}

.app-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-subnav .nav-link {
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.app-subnav .nav-link:hover {
    color: #0f172a;
}

.app-subnav .nav-link.active {
    color: var(--w-primary);
    border-bottom-color: var(--w-primary);
}

/* Smooth custom horizontal drag scrollbar for touch devices */
.w-scroll-nav::-webkit-scrollbar {
    height: 4px;
}

.w-scroll-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}



.wbsp-field-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0.3rem;
    color: var(--bs-secondary-color, #6c757d);
    cursor: help;
    line-height: 1;
    vertical-align: middle;
    outline: none;
}

.wbsp-field-help:hover,
.wbsp-field-help:focus,
.wbsp-field-help:focus-within {
    color: var(--w-primary, var(--bs-primary, #0d6efd));
}

.wbsp-field-help-bubble {
    display: none;
    position: absolute;
    z-index: 1080;
    left: 50%;
    bottom: calc(100% + 0.65rem);
    width: max-content;
    max-width: min(22rem, 80vw);
    padding: 0.55rem 0.7rem;
    border-radius: 0.4rem;
    background: #212529;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    box-shadow: 0 0.35rem 0.9rem rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 0.2rem);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

.wbsp-field-help-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    border: 0.35rem solid transparent;
    border-top-color: #212529;
    transform: translateX(-50%);
}

.wbsp-field-help:hover .wbsp-field-help-bubble,
.wbsp-field-help:focus .wbsp-field-help-bubble,
.wbsp-field-help:focus-within .wbsp-field-help-bubble {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* Alternating list rows; explicit cells override Bootstrap table hover paints. */
.table > tbody > tr.wbsp-row-banded:not(.wbsp-row-today) > * {
    --bs-table-bg: #f2f5f9;
    background-color: #f2f5f9;
    box-shadow: inset 0 0 0 9999px #f2f5f9;
}
.table-hover > tbody > tr.wbsp-row-banded:not(.wbsp-row-today):hover > * {
    background-color: #e9eff6;
    box-shadow: inset 0 0 0 9999px #e9eff6;
}

/* List widget: emphasize records whose configured date field is today.
 * Bootstrap 5 paints table states with an inset box-shadow, so both the
 * table state variables and that shadow must be overridden. */
.table > tbody > tr.wbsp-row-today > * {
    --bs-table-bg: #fff8dc;
    --bs-table-accent-bg: #fff8dc;
    --bs-table-striped-bg: #fff8dc;
    --bs-table-active-bg: #fff8dc;
    --bs-table-hover-bg: #fff2bd;
    background-color: #fff8dc !important;
    box-shadow: inset 0 0 0 9999px #fff8dc !important;
}

.table-hover > tbody > tr.wbsp-row-today:hover > * {
    --bs-table-bg-state: #fff2bd;
    --bs-table-hover-bg: #fff2bd;
    background-color: #fff2bd !important;
    box-shadow: inset 0 0 0 9999px #fff2bd !important;
}

/* Chart cards in a shared 12-column dashboard row match the tallest card.
   The grid itself determines each row's height; this only stretches charts
   inside their own grid cell and does not affect widgets on later rows. */
.app-area-widget-grid > .app-area-widget-item:has(> .row > .app-chart-panel) {
    display: flex;
    flex-direction: column;
}
.app-area-widget-grid > .app-area-widget-item:has(> .row > .app-chart-panel) > .row {
    flex: 1 1 auto;
    min-height: 0;
}
.app-area-widget-grid > .app-area-widget-item > .row > .app-chart-panel {
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
}
.app-area-widget-grid > .app-area-widget-item > .row > .app-chart-panel > .card {
    flex: 1 1 auto;
    min-width: 0;
}
