/* Finalytics UI - Global Theming Layer
 *
 * A native-first theme: the desk keeps Frappe's own
 * design system (fonts, radii, compact controls). We only *tint* it via
 * a clean set of --fy-* brand tokens. Custom fleet pages carry their own
 * Element Plus + Phosphor styling (see the fleet_management app).
 */

/* The UI Kit (tokens + components) lives in a separate file; import it here so
   it always loads with this stylesheet (app_include_css also lists it). */
@import url("/assets/finalytics_ui/css/fy_kit.css?v=1");

:root {
    --fy-primary: #1976d2;
    --fy-primary-dark: #1565c0;
    --fy-primary-light: #42a5f5;
    --fy-primary-bg: rgba(25, 118, 210, 0.08);
    --fy-card-shadow: 0 2px 10px rgba(20, 40, 80, 0.07);
    --fy-hover-shadow: 0 8px 24px rgba(20, 40, 80, 0.12);

    /* Tint Frappe's own tokens with the brand color (single re-skin point).
       Fonts / radii / sizes stay Frappe-native. */
    --primary: var(--fy-primary);
    --primary-color: var(--fy-primary);
    --btn-primary: var(--fy-primary);
    --btn-primary-hover: var(--fy-primary-dark);
    --border-primary: var(--fy-primary);
    --checkbox-gradient: linear-gradient(180deg, var(--fy-primary), var(--fy-primary));
    --progress-bar-bg: var(--fy-primary);
    --scrollbar-thumb-color: var(--gray-400);
}

/* ------------------------------------------------------------
   Top navbar (solid brand blue) - scoped to the navbar only
   ------------------------------------------------------------ */
.navbar {
    background-color: var(--fy-primary) !important;
}

.navbar .es-icon,
.navbar #navbar-breadcrumbs a,
.navbar #navbar-breadcrumbs a:before,
.navbar .ellipsis.title-text {
    color: #ffffff !important;
}

.navbar .es-icon {
    stroke: #ffffff !important;
}

/* ------------------------------------------------------------
   Page / workspace header - soft brand tint, native typography
   ------------------------------------------------------------ */
.page-head {
    margin-bottom: 0px !important;
    background: linear-gradient(45deg, var(--fy-primary), transparent);
}

.container.page-body {
    max-width: 100% !important;
}

/* Workspace header (desk workspaces) - gradient brand banner */
.workspace-header {
    background: linear-gradient(135deg, var(--fy-primary) 0%, var(--fy-primary-light) 100%) !important;
    color: #ffffff !important;
    padding: 1.5rem 2rem !important;
    border-radius: 0 0 16px 16px !important;
    margin-bottom: 1.5rem !important;
}

.workspace-header .page-title {
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* ------------------------------------------------------------
   Content surfaces - subtle, native-ish
   ------------------------------------------------------------ */
.layout-main-section {
    background: var(--gray-50) !important;
}

.main-section .sticky-top .navbar.navbar-expand .container {
    width: 100% !important;
    max-width: 100% !important;
    background-color: var(--fy-primary);
}

/* Sidebar - clean white, keep mobile fix (no backdrop-filter on mobile) */
.layout-side-section {
    background: #ffffff !important;
    border-right: 1px solid var(--border-color) !important;
}

@media (min-width: 992px) {
    .layout-side-section {
        backdrop-filter: blur(10px) !important;
    }
}

/* Sidebar items - subtle, no bouncy transforms */
.desk-sidebar .sidebar-item {
    border-radius: 8px !important;
    margin: 2px 6px !important;
    padding: 8px 12px !important;
}

.desk-sidebar .sidebar-item:hover {
    background: var(--fy-primary-bg) !important;
    color: var(--fy-primary) !important;
}

.desk-sidebar .sidebar-item.selected {
    background: var(--fy-primary) !important;
    color: #ffffff !important;
}

/* ------------------------------------------------------------
   Widgets / cards - keep a light gradient accent bar, native radii
   ------------------------------------------------------------ */
.widget-group {
    background: #ffffff !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--fy-card-shadow) !important;
    margin-bottom: 1rem !important;
    overflow: hidden !important;
    position: relative;
}

.widget-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--fy-primary), var(--fy-primary-light));
    z-index: 1;
}

.widget-group .widget-head {
    padding: 1rem 1.25rem !important;
    background: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.widget-group .widget-body {
    padding: 1.25rem !important;
}

.shortcut-widget-box {
    background: #ffffff !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--fy-card-shadow) !important;
}

.widget.shortcut-widget-box {
    padding: 14px 16px !important;
    display: flex !important;
    align-items: center !important;
}

/* ------------------------------------------------------------
   Buttons - compact, Frappe-native sizing, brand tint only
   ------------------------------------------------------------ */
.btn-primary,
.btn-new {
    background: var(--fy-primary) !important;
    border-color: var(--fy-primary) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-new:hover {
    background: var(--fy-primary-dark) !important;
    border-color: var(--fy-primary-dark) !important;
}

/* ------------------------------------------------------------
   Lists & forms - native surfaces, subtle hover only
   ------------------------------------------------------------ */
.list-row:hover {
    background: var(--fy-primary-bg) !important;
}

.list-row-checkbox:checked {
    background: var(--fy-primary) !important;
}

/* ------------------------------------------------------------
   Child tables (form grids) - native, with a tinted header
   NOTE: no overflow:hidden here — it clips the absolutely
   positioned awesomplete dropdowns of link fields in child tables.
   ------------------------------------------------------------ */
.form-grid {
    border-radius: 8px !important;
    border-color: var(--table-border-color) !important;
}

.form-grid .grid-heading-row {
    background: linear-gradient(90deg, var(--fy-primary), var(--fy-primary-light)) !important;
    color: #ffffff !important;
    border-bottom: none !important;
}

.form-grid .grid-heading-row .grid-static-col,
.form-grid .grid-heading-row .static-area {
    color: #ffffff !important;
}

.form-grid .grid-heading-row .grid-row-check .checkbox {
    --checkbox-gradient: linear-gradient(180deg, #ffffff, #ffffff) !important;
    --checkbox-color: #ffffff !important;
}

.form-grid .grid-body .data-row:hover {
    background: var(--fy-primary-bg) !important;
}

/* ------------------------------------------------------------
   Tooltips - brand tint
   ------------------------------------------------------------ */
.tooltip .tooltip-inner {
    background: var(--fy-primary) !important;
    border-radius: 6px !important;
}

/* Hide default help dropdown for a cleaner header */
.dropdown-help {
    display: none !important;
}

/* ------------------------------------------------------------
   Page-header document titles as small badge pills
   Applies to every h3.title-text in a page head (form titles,
   "X with Y" composite titles, list headers). White translucence
   pill, no border, 5px right gap before status pills.
   ------------------------------------------------------------ */
.page-head h3.ellipsis.title-text {
    display: inline-flex !important;
    align-items: center;
    max-width: 100%;
    margin: 0 5px 0 0 !important;
    padding: 2px 10px !important;
    font-size: 12px !important;
    font-weight: 600;
    line-height: 1.6;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ------------------------------------------------------------
   Quick-add "+" icon buttons (btn-new icon buttons e.g. page-head
   "New Patient Encounter") - punchy bright-white icon
   ------------------------------------------------------------ */
.btn-new.btn-secondary.icon-btn svg.icon,
button.btn-new.icon-btn svg.icon {
    color: #ffffff !important;
    stroke: #ffffff !important;
    --icon-stroke: #ffffff !important;
    --icon-fill: #ffffff !important;
    fill: none;
    stroke-width: 2px;
    opacity: 1;
}
