/*
 * Reusable FleetGO components. Load after fleetgo-base.css and vendor styles.
 * Components are opt-in: add classes to new pages without changing legacy UI.
 *
 * Buttons:
 *   <button type="button" class="fg-button">Back</button>
 *   <button type="submit" class="fg-button fg-button--block">Sign out</button>
 *   <button type="button" class="fg-button fg-button--ghost fg-button--icon"
 *           aria-label="Favorite"><i class="fa fa-star" aria-hidden="true"></i></button>
 *
 * EViewButtonInfo: set CssClass = "fg-button" (add modifiers as needed).
 * Existing Html.ButtonAdd/Save/etc.: wrap in fg-actions to style generated .btn
 * elements without replacing their permissions, bindings or click handlers.
 * Wrap generated paging controls in fg-pager for the same button appearance.
 * Modifiers: --block (full width), --icon (square), --ghost (transparent),
 * --subtle (muted background). Combine modifiers with the base fg-button class.
 * Override --fg-button-* properties for component-specific colors and sizing;
 * hover, focus, active and disabled states stay shared. Prefer native buttons
 * and their disabled attribute; aria-disabled only supplies disabled styling.
 */

.fg-button,
:where(.fg-actions, .fg-pager) .btn {
    --fg-button-height: 34px;
    --fg-button-color: var(--fleetgo-grays-600, #536465);
    --fg-button-background: var(--fleetgo-grays-000, #fff);
    --fg-button-border-color: var(--fleetgo-grays-200, #DEEAEB);
    --fg-button-hover-color: var(--fleetgo-branding-secondary-color-default, #2F727C);
    --fg-button-hover-background: var(--fleetgo-branding-product-color-shade-000, #E6F7F9);
    --fg-button-hover-border-color: var(--fleetgo-branding-primary-color-default, #2FC0CC);
    --fg-button-active-background: var(--fleetgo-branding-tertiary-color-hover, #BFE3E8);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    height: var(--fg-button-height);
    min-width: var(--fg-button-height);
    padding: 0 12px;
    font-family: var(--fleetgo-font-family-body, "Open Sans", Tahoma, Helvetica, sans-serif);
    font-size: var(--fleetgo-font-size-body-md, 12px);
    font-weight: 600;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--fg-button-color);
    background: var(--fg-button-background);
    border: 1px solid var(--fg-button-border-color);
    border-radius: var(--fleetgo-radius-l, 8px);
    box-shadow: none;
    text-shadow: none;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.fg-button:visited,
:where(.fg-actions, .fg-pager) .btn:visited {
    color: var(--fg-button-color);
}

.fg-button:hover,
.fg-button:focus,
:where(.fg-actions, .fg-pager) .btn:hover,
:where(.fg-actions, .fg-pager) .btn:focus {
    color: var(--fg-button-hover-color);
    background: var(--fg-button-hover-background);
    border-color: var(--fg-button-hover-border-color);
    text-decoration: none;
}

.fg-button:focus,
:where(.fg-actions, .fg-pager) .btn:focus {
    /* fleetgo-base.css suppresses link outlines with !important. */
    outline: 2px solid var(--fleetgo-branding-secondary-color-default, #2F727C) !important;
    outline-offset: 2px;
}

.fg-button:active,
:where(.fg-actions, .fg-pager) .btn:active {
    background: var(--fg-button-active-background);
    box-shadow: none;
}

.fg-button:is(:disabled, .disabled, [aria-disabled="true"]),
.fg-button:is(:disabled, .disabled, [aria-disabled="true"]):is(:hover, :focus, :active),
:where(.fg-actions, .fg-pager) .btn:is(:disabled, .disabled, [aria-disabled="true"]),
:where(.fg-actions, .fg-pager) .btn:is(:disabled, .disabled, [aria-disabled="true"]):is(:hover, :focus, :active) {
    color: var(--fg-button-color);
    background: var(--fg-button-background);
    border-color: var(--fg-button-border-color);
    box-shadow: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.fg-button--block {
    display: flex;
    width: 100%;
}

.fg-button--icon {
    width: var(--fg-button-height);
    padding: 0;
}

.fg-button--ghost {
    --fg-button-background: transparent;
    --fg-button-border-color: transparent;
    --fg-button-hover-border-color: transparent;
}

.fg-button--subtle {
    --fg-button-color: var(--fleetgo-grays-500, #707575);
    --fg-button-background: var(--fleetgo-grays-100, #F4F9F9);
    --fg-button-border-color: transparent;
    --fg-button-hover-border-color: transparent;
}

.fg-button .glyphicon,
:where(.fg-actions, .fg-pager) .btn .glyphicon {
    top: 0;
    font-size: inherit;
}

/* Layout primitives: action rows, toolbars and page headings. */
.fg-actions,
.fg-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.fg-toolbar {
    justify-content: space-between;
    gap: 12px;
}

.fg-toolbar > .fg-actions {
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.fg-pager {
    max-width: 100%;
    overflow-x: auto;
}

.fg-pager .btn-group {
    display: inline-flex;
    gap: 4px;
    vertical-align: middle;
}

.fg-pager .btn-group > .btn,
.fg-pager .btn-group > .btn-group {
    float: none;
    margin-left: 0;
}

.fg-pager .btn-group > .btn {
    /* Bootstrap's grouped first/last-child selectors otherwise square corners. */
    border-radius: var(--fleetgo-radius-l, 8px) !important;
}

.fg-page-title {
    margin: 0;
    color: var(--fleetgo-grays-800, #1B1E1E);
    font-size: var(--fleetgo-font-size-title-xxxl, 28px);
    font-weight: 600;
    line-height: var(--fleetgo-font-lineheight-xxxl, 34px);
}

/* Forms: add fg-input/fg-label to native controls or MVC helper attributes. */
.fg-input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: 34px;
    padding: 6px 10px;
    color: var(--fleetgo-grays-700, #313333);
    background: var(--fleetgo-grays-000, #fff);
    border: 1px solid var(--fleetgo-grays-200, #DEEAEB);
    border-radius: var(--fleetgo-radius-l, 8px);
    box-shadow: none;
    font-family: var(--fleetgo-font-family-body, "Open Sans", Tahoma, Helvetica, sans-serif);
    font-size: var(--fleetgo-font-size-body-md, 12px);
    line-height: var(--fleetgo-font-lineheight-xs, 18px);
}

.fg-input:focus {
    border-color: var(--fleetgo-branding-primary-color-default, #2FC0CC);
    outline: 2px solid var(--fleetgo-branding-product-color-shade-200, #97D9E0);
    outline-offset: 1px;
    box-shadow: none;
}

.fg-input:disabled,
.fg-input[readonly] {
    color: var(--fleetgo-grays-600, #536465);
    background: var(--fleetgo-grays-100, #F4F9F9);
}

.fg-label {
    display: inline-block;
    height: auto;
    padding: 0;
    margin-bottom: 6px;
    color: var(--fleetgo-grays-600, #536465);
    font-size: var(--fleetgo-font-size-body-md, 12px);
    font-weight: 600;
    line-height: var(--fleetgo-font-lineheight-xs, 18px);
}

.fg-form {
    display: grid;
    gap: 16px;
}

.fg-form > .form-group {
    margin-bottom: 0;
}

.fg-field-row {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.fg-field-row > div {
    min-width: 0;
}

.fg-field-row .fg-label {
    margin-bottom: 0;
}

/* Stack a field's label above its control. */
.fg-field-row--stacked {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
}

.fg-field-value {
    display: flex;
    align-items: center;
    min-height: 34px;
    color: var(--fleetgo-grays-600, #536465);
    font-size: var(--fleetgo-font-size-body-md, 12px);
    overflow-wrap: anywhere;
}

.fg-checkbox[type="checkbox"] {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    accent-color: var(--fleetgo-branding-secondary-color-default, #2F727C);
}

.fg-dialog {
    padding: 20px;
    color: var(--fleetgo-grays-700, #313333);
    background: var(--fleetgo-grays-000, #fff);
}

.fg-caption {
    color: var(--fleetgo-grays-600, #536465);
    font-size: var(--fleetgo-font-size-body-md, 12px);
    line-height: var(--fleetgo-font-lineheight-xs, 18px);
}

/* Opt-in Kendo adapters. The class can be on the widget or its wrapper. */
.fg-grid.k-grid,
.fg-grid .k-grid {
    border: 1px solid var(--fleetgo-grays-200, #DEEAEB);
    border-radius: var(--fleetgo-radius-l, 8px);
    background: var(--fleetgo-grays-000, #fff);
    overflow: hidden;
}

.fg-grid .k-grid-header,
.fg-grid .k-grid-header th.k-header,
.fg-grid .k-pager-wrap {
    color: var(--fleetgo-grays-600, #536465);
    background: var(--fleetgo-grays-100, #F4F9F9);
    border-color: var(--fleetgo-grays-200, #DEEAEB);
}

.fg-grid .k-grid-header th.k-header {
    font-weight: 600;
}

.fg-grid td {
    color: var(--fleetgo-grays-700, #313333);
    border-color: var(--fleetgo-grays-200, #DEEAEB);
}

.fg-grid .k-alt {
    /*background: var(--fleetgo-grays-100, #F4F9F9);*/
}

.fg-grid tbody > tr:hover > td {
    background: var(--fleetgo-branding-product-color-shade-000, #E6F7F9);
}

/*.fg-grid tr.k-state-selected > td,
.fg-grid tr.k-state-selected:hover > td {*/
    /* Override the global Kendo selection colors, which also use !important. */
    /*color: var(--fleetgo-branding-secondary-color-default, #2F727C) !important;
    background: var(--fleetgo-branding-product-color-shade-000, #E6F7F9) !important;
}*/

.fg-tabs.k-tabstrip {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: var(--fleetgo-grays-000, #fff);
    border-color: var(--fleetgo-grays-200, #DEEAEB);
    border-radius: var(--fleetgo-radius-l, 8px);
}

.fg-tabs > .k-tabstrip-items {
    flex: 0 0 auto;
}

.fg-tabs > .k-tabstrip-items .k-item {
    border-radius: var(--fleetgo-radius-l, 8px) var(--fleetgo-radius-l, 8px) 0 0;
}

.fg-tabs.k-tabstrip > .k-tabstrip-items .k-item .k-link {
    color: var(--fleetgo-grays-600, #536465);
    font-size: var(--fleetgo-font-size-body-md, 12px);
    text-transform: none;
}

.fg-tabs > .k-tabstrip-items .k-state-active {
    background: var(--fleetgo-branding-product-color-shade-000, #E6F7F9);
    border-color: var(--fleetgo-grays-200, #DEEAEB);
}

.fg-tabs.k-tabstrip > .k-tabstrip-items .k-state-active .k-link {
    /* Override the legacy tab-link foreground and global Kendo background. */
    color: var(--fleetgo-branding-secondary-color-default, #2F727C) !important;
    background: var(--fleetgo-branding-product-color-shade-000, #E6F7F9) !important;
    font-weight: 600;
}

.fg-tabs.k-tabstrip > .k-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--fleetgo-grays-200, #DEEAEB);
    background: var(--fleetgo-grays-000, #fff);
}
