/* ============================================================
   Global overrides — loaded after kendo-theme-default/all.css
   ============================================================ */

/* 1. Font — match production system sans-serif stack */
:root {
    --kendo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
}

/* 2. Primary color — override Telerik's default #ff6358 with Credem dark green */
:root {
    --kendo-color-primary:           #00421e;
    --kendo-color-primary-hover:     #005226;
    --kendo-color-primary-active:    #00331a;
    --kendo-color-primary-subtle:    #e6f2eb;
    --kendo-color-primary-subtle-hover:  #cce5d6;
    --kendo-color-primary-subtle-active: #99ccb2;
    --kendo-color-primary-emphasis:  #4d8a68;
    --kendo-color-primary-on-subtle: #00421e;
    --kendo-color-primary-on-surface:#00421e;
}

/* ============================================================
   Sidebar menu — leaf items
   NavLink renders an <a> tag as a child-component root, which
   does NOT receive Blazor CSS isolation scope attributes, so
   these rules must live in the global stylesheet.
   ============================================================ */
.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 0 24px;
    height: 40px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.menu-item:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Active NavLink — Blazor adds "active" class; matches AntD selected item */
.menu-item.active {
    color: #fff;
    background-color: #00421e;
}

.menu-item__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0.75;
    font-size: 14px;
}

.menu-item__icon .k-svg-icon {
    width: 14px;
    height: 14px;
}

.menu-item__title {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Top-level leaf items (not inside a group) — less indentation */
.sidebar__nav > .menu-item {
    padding-left: 16px;
}

/* Inactive items (no mapped Blazor route) */
.menu-item--inactive {
    cursor: default;
    opacity: 0.35;
}

.menu-item--inactive:hover {
    color: rgba(255, 255, 255, 0.65);
    background-color: transparent;
}

/* ============================================================
   Page toolbar (back arrow + page title)
   ============================================================ */
.page-toolbar {
    display: flex;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 0 !important;
}

.toolbar-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ============================================================
   Section header — title left, action button right
   ============================================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-header h5 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: rgba(0, 0, 0, 0.85);
}

/* ============================================================
   List search bar — inline input + icon button (unified border)
   ============================================================ */
.list-search-bar {
    display: flex;
    align-items: stretch;
    margin-bottom: 16px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.list-search-input-wrap {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.list-search-input-wrap .k-textbox {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.list-search-bar > .k-button {
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 14px;
}

/* ============================================================
   Driver list — card-list layout matching reference
   ============================================================ */
.driver-list {
    border-top: 1px solid #e8e8e8;
    margin-bottom: 0;
}

.driver-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.driver-list-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.driver-list-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #00421e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.driver-list-icon .k-svg-icon svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.driver-list-content {
    flex: 1 1 0;
    min-width: 0;
}

.driver-list-name {
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 2px;
}

.driver-list-desc {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-list-pager {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.driver-list-pager .k-pager-first,
.driver-list-pager .k-pager-last {
    display: none;
}

/* Force numeric buttons — override responsive collapse */
.driver-list-pager .k-pager-numbers {
    display: inline-flex !important;
}

.driver-list-pager .k-pager-input {
    display: none !important;
}

.page-toolbar h4 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: rgba(0, 0, 0, 0.85);
}

/* ============================================================
   Horizontal form layout — matches AntD labelCol=7 wrapperCol=10
   ============================================================ */
.form-horizontal .form-field {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

/* Label column: 29% (~7/24), right-aligned with colon */
.form-horizontal .form-field-label {
    flex: 0 0 29%;
    max-width: 29%;
    text-align: right;
    padding-right: 8px;
    padding-top: 5px;
    color: rgba(0, 0, 0, 0.65);
    line-height: 1.5715;
    word-break: break-word;
}

.form-horizontal .form-field-label::after {
    content: ':';
    margin: 0 8px 0 2px;
}

/* Red asterisk before required labels */
.form-horizontal .form-field-label.required::before {
    display: inline-block;
    margin-right: 4px;
    color: #ff4d4f;
    font-size: 14px;
    line-height: 1;
    content: '*';
}

/* Input/control column: 42% (~10/24) */
.form-horizontal .form-field-control {
    flex: 0 0 42%;
    max-width: 42%;
    min-width: 0;
}

/* Section titles inside forms */
.form-section-title {
    font-size: 16px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 20px;
    margin-top: 24px;
}

.form-section-title:first-of-type {
    margin-top: 0;
}

/* ============================================================
   Notification — AntD message style (white card, colored icon)
   ============================================================ */
.k-notification-group {
    top: 16px !important;
}

.k-notification {
    background-color: #fff !important;
    color: rgba(0, 0, 0, 0.85) !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 10px 16px !important;
    box-shadow: 0 3px 6px -4px rgba(0, 0, 0, .12),
                0 6px 16px 0 rgba(0, 0, 0, .08),
                0 9px 28px 8px rgba(0, 0, 0, .05) !important;
    font-size: 14px !important;
    min-width: 0 !important;
}

.k-notification .k-notification-content {
    color: rgba(0, 0, 0, 0.85) !important;
}

/* Colored icon per type, white background */
.k-notification-success .k-icon {
    color: #52c41a !important;
}

.k-notification-error .k-icon {
    color: #ff4d4f !important;
}

.k-notification-warning .k-icon {
    color: #faad14 !important;
}

.k-notification-info .k-icon {
    color: #1890ff !important;
}

/* ============================================================
   Grid rows — clean white background (no green tint)
   Telerik applies selected-row color to td, not tr
   ============================================================ */
.k-grid .k-table-row td,
.k-grid .k-table-alt-row td {
    background-color: #fff;
}

.k-grid .k-selected td {
    background-color: transparent !important;
}

.k-grid .k-table-row:hover td,
.k-grid .k-table-alt-row:hover td {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

/* ============================================================
   Grid — prevent action buttons in locked cells from wrapping
   ============================================================ */
.k-grid .k-grid-content-sticky {
    white-space: nowrap;
}

/* ============================================================
   TabFasiProgetto — add-procedure inline row
   ============================================================ */
.fasi-add-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fasi-add-label {
    white-space: nowrap;
    color: rgba(0, 0, 0, 0.65);
    font-size: 14px;
}

.fasi-add-row .k-combobox {
    flex: 1 1 0;
    min-width: 0;
}

/* ============================================================
   TabFasiProgetto — procedure chips bar
   ============================================================ */
.fasi-procedure-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.fasi-proc-prefix {
    color: rgba(0, 0, 0, 0.45);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 2px;
}

.fasi-proc-sep {
    color: rgba(0, 0, 0, 0.25);
    padding: 0 2px;
}

.fasi-proc-name {
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    color: #00421e;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.fasi-proc-name:hover {
    color: #005226;
    text-decoration: underline;
}

.fasi-proc-name.fasi-proc-active {
    color: #00421e;
    font-weight: 700;
}

.fasi-proc-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #00421e;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    vertical-align: middle;
}

.fasi-proc-delete:hover {
    background-color: #c0392b;
}

/* ============================================================
   TabRiepilogo — PanelBar: keep headers neutral (no primary
   green on expanded/selected state, matching reference)
   ============================================================ */
.riepilogo-panelbar .k-panelbar .k-link {
    background-color: #f5f5f5;
    color: rgba(0, 0, 0, 0.85);
}

.riepilogo-panelbar .k-panelbar .k-link.k-selected,
.riepilogo-panelbar .k-panelbar .k-link.k-focus,
.riepilogo-panelbar .k-panelbar .k-link:focus {
    background-color: #f5f5f5 !important;
    color: rgba(0, 0, 0, 0.85) !important;
    box-shadow: none !important;
}

.riepilogo-panelbar .k-panelbar .k-link:hover,
.riepilogo-panelbar .k-panelbar .k-link.k-selected:hover {
    background-color: #ebebeb !important;
    color: rgba(0, 0, 0, 0.85) !important;
}

/* ============================================================
   TabRiepilogo — table rows: sage-green tint matching reference
   ============================================================ */
.riepilogo-table tbody tr td {
    background-color: #6b7c6e;
    color: #fff;
}

.riepilogo-table tbody tr:hover td {
    background-color: #5e6e60 !important;
}

/* ============================================================
   Notifications — keep above Telerik Window overlay (z 10001)
   ============================================================ */
.k-notification-group {
    z-index: 11000;
}
