/* =============================================================
   Ajustes visuais para componentes Telerik UI for Blazor
   Objetivo: harmonizar bordas, cores e espaçamentos com os
   componentes Radzen (RadzenTextBox, RadzenNumeric, etc.)
   ============================================================= */

/* --- Inputs / NumericTextBox / TextBox --- */

/* Borda exterior do input (substitui a borda preta do tema Material) */
.k-input:not(.k-switch),
.k-picker {
    border-color: #dee2e6;
    border-width: 1px;
    border-style: solid;
    border-radius: 4px;
    background-color: #fff;
}

/* Borda interior (inner) consistente com Radzen */
.k-input-inner {
    border: none;
    border-radius: 4px;
    box-shadow: none;
    background-color: transparent;
}

/* Estados focus / hover */
.k-input:not(.k-switch):focus-within,
.k-picker:focus-within {
    border-color: #26819D;
    box-shadow: 0 0 0 2px rgba(38, 129, 157, 0.2);
}

.k-input:not(.k-switch):hover:not(:focus-within),
.k-picker:hover:not(:focus-within) {
    border-color: #bfc5ca;
}

/* Estado disabled */
.k-input.k-disabled:not(.k-switch),
.k-picker.k-disabled,
.k-disabled > .k-input:not(.k-switch),
.k-disabled > .k-picker {
    border-color: #dee2e6;
    background-color: #fff;
    opacity: 1;
}


/* --- Checkbox (estilos base da v13, ausentes no tema antigo) --- */
.k-checkbox {
    margin: 0;
    padding: 0;
    line-height: initial;
    border-width: 2px;
    border-style: solid;
    border-color: #1D1B20;
    border-radius: 0.25rem;
    outline: 0;
    background-color: unset;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    display: inline-block;
    flex: none;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
}

.k-checkbox::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    mask-repeat: no-repeat;
}

.k-checkbox:checked::before,
.k-checkbox.k-checked::before {
    background-color: currentColor;
    mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='none' stroke='%23ffffff' stroke-width='3' d='M4.1,12.7 9,17.6 20.3,6.3'/%3e%3c/svg%3e");
}

.k-checkbox:indeterminate::before,
.k-checkbox.k-indeterminate::before {
    background-color: currentColor;
    mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23ffffff' stroke-width='3' d='M4 10h12'/%3e%3c/svg%3e");
}

.k-checkbox:checked,
.k-checkbox:indeterminate {
    background-color: #26819D !important;
    border-color: #26819D !important;
    color: #fff;
}

.k-checkbox:checked:focus,
.k-checkbox:indeterminate:focus {
    box-shadow: 0 0 0 2px rgba(38, 129, 157, 0.3) !important;
}

.k-checkbox:disabled,
.k-checkbox.k-disabled {
    opacity: 0.6;
    cursor: default;
}

.k-checkbox-wrap {
    flex: none;
    display: inline-flex;
    flex-flow: row nowrap;
    align-items: center;
    vertical-align: middle;
    position: relative;
}

.k-checkbox-wrap::before {
    content: "\200B";
    width: 0px;
    overflow: hidden;
    flex: none;
    display: inline-block;
    vertical-align: top;
}

/* --- Switch (estilos base da v13 material, ausentes no tema antigo) --- */
.k-switch {
    box-sizing: border-box;
    outline: 0;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
    position: relative;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    width: 52px;
    height: 32px;
}

/* Switch Small */
.k-switch.k-switch-sm {
    width: 40px;
    height: 22px;
}

.k-switch.k-switch-sm .k-switch-track {
    width: 40px;
    height: 22px;
}

.k-switch.k-switch-sm .k-switch-thumb {
    width: 16px;
    height: 16px;
}

.k-switch.k-switch-sm.k-switch-on .k-switch-thumb-wrap {
    inset-inline-start: calc(100% - 11px);
}

.k-switch.k-switch-sm.k-switch-off .k-switch-thumb-wrap {
    inset-inline-start: 11px;
}

.k-switch.k-switch-sm .k-switch-thumb::before {
    width: 32px;
    height: 32px;
}

/* Switch Large */
.k-switch.k-switch-lg {
    width: 60px;
    height: 36px;
}

.k-switch.k-switch-lg .k-switch-track {
    width: 60px;
    height: 36px;
}

.k-switch.k-switch-lg .k-switch-thumb {
    width: 28px;
    height: 28px;
}

.k-switch.k-switch-lg.k-switch-on .k-switch-thumb-wrap {
    inset-inline-start: calc(100% - 18px);
}

.k-switch.k-switch-lg.k-switch-off .k-switch-thumb-wrap {
    inset-inline-start: 18px;
}

.k-switch.k-switch-lg .k-switch-thumb::before {
    width: 44px;
    height: 44px;
}

.k-switch *,
.k-switch *::before,
.k-switch *::after {
    box-sizing: border-box;
}

.k-switch [type=checkbox] {
    display: none;
}

.k-switch-track {
    border-width: 1px;
    border-style: solid;
    border-radius: 9999px;
    outline: 0;
    display: flex;
    flex-flow: row nowrap;
    flex: 1 0 auto;
    position: relative;
    width: 52px;
    height: 32px;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.k-switch-thumb-wrap {
    width: 0;
    height: 0;
    overflow: visible;
    position: absolute;
    inset-block-start: 50%;
}

.k-switch-thumb {
    border-width: 0;
    border-style: solid;
    border-radius: 9999px;
    display: block;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: all 0.2s;
    width: 24px;
    height: 24px;
}

.k-switch-label-on,
.k-switch-label-off {
    display: none;
}

/* Switch ON */
.k-switch-on .k-switch-thumb-wrap {
    inset-inline-start: calc(100% - 16px);
}

.k-switch-on .k-switch-track {
    border-color: #26819D;
    background-color: #26819D;
}

.k-switch-on .k-switch-thumb {
    background-color: #fff;
}

/* Switch OFF */
.k-switch-off .k-switch-thumb-wrap {
    inset-inline-start: 16px;
}

.k-switch-off .k-switch-track {
    border-color: #b0adb8;
    background-color: #f0eef2;
}

.k-switch-off .k-switch-thumb {
    background-color: #8a8694;
}

/* Switch hover */
.k-switch .k-switch-thumb::before {
    content: "";
    border-radius: 100%;
    display: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    position: absolute;
    z-index: -1;
    top: 50%;
    left: 50%;
    pointer-events: none;
    width: 40px;
    height: 40px;
    background-color: #26819D;
}

.k-switch:hover .k-switch-thumb::before {
    display: block;
    opacity: 0.08;
}

.k-switch:focus .k-switch-thumb::before {
    display: block;
    opacity: 0.2;
}

/* Switch disabled */
.k-switch:disabled,
.k-switch.k-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.k-switch.k-disabled .k-switch-track,
.k-switch:disabled .k-switch-track {
    border-color: #d0ced6;
    background-color: #f5f4f6;
}

.k-switch.k-disabled .k-switch-thumb,
.k-switch:disabled .k-switch-thumb {
    background-color: #c8c6ce;
}

.k-switch.k-disabled.k-switch-on .k-switch-track,
.k-switch:disabled.k-switch-on .k-switch-track {
    border-color: #26819D;
    background-color: #26819D;
    opacity: 0.4;
}

/* RTL */
.k-switch[dir=rtl] .k-switch-thumb,
[dir=rtl] .k-switch .k-switch-thumb {
    transform: translate(50%, -50%);
}

/* --- RadioButton (estilos base da v13, ausentes no tema antigo) --- */
.k-radio {
    margin: 0;
    padding: 0;
    line-height: initial;
    border-width: 2px;
    border-style: solid;
    border-color: #1D1B20;
    border-radius: 50%;
    outline: 0;
    background-color: unset;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    display: inline-block;
    flex: none;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
}

.k-radio::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: transparent;
    transform: scale(0);
    transform-origin: center center;
    transition: transform 0.2s;
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
}

.k-radio:checked::before,
.k-radio.k-checked::before {
    background-color: #26819D;
    transform: scale(0.5);
}

.k-radio:checked,
.k-radio.k-checked {
    border-color: #26819D;
    background-image: none;
}

.k-radio:checked:focus,
.k-radio.k-checked:focus {
    box-shadow: 0 0 0 2px rgba(38, 129, 157, 0.3);
}

.k-radio:disabled,
.k-radio.k-disabled {
    opacity: 0.6;
    cursor: default;
}

.k-radio-wrap {
    flex: none;
    display: inline-flex;
    flex-flow: row nowrap;
    align-items: center;
    vertical-align: middle;
    position: relative;
}

.k-radio-wrap::before {
    content: "\200B";
    width: 0px;
    overflow: hidden;
    flex: none;
    display: inline-block;
    vertical-align: top;
}

.k-radio-label,
.k-radio-list-item .k-radio-label {
    margin-left: 4px;
    cursor: pointer;
    vertical-align: middle;
}

.k-radio-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-flow: column nowrap;
    gap: 8px;
}

.k-radio-list.k-radio-list-horizontal,
.k-radio-list-horizontal {
    flex-flow: row nowrap;
    gap: 16px;
}

.k-radio-list-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* --- DropDownList / ComboBox / AutoComplete --- */
.k-dropdownlist,
.k-combobox,
.k-autocomplete,
.k-multiselect {
    border-color: #dee2e6;
}

.k-dropdownlist:focus-within,
.k-combobox:focus-within,
.k-autocomplete:focus-within,
.k-multiselect:focus-within {
    border-color: #26819D;
    box-shadow: 0 0 0 2px rgba(38, 129, 157, 0.2);
}

/* Item selecionado nos popups */
.k-list-item.k-selected,
.k-selected.k-list-optionlabel {
    background-color: #26819D !important;
    color: #fff !important;
}

.k-list-item:hover,
.k-list-optionlabel:hover {
    background-color: rgba(38, 129, 157, 0.1);
}

/* --- DatePicker / TimePicker --- */
.k-datepicker,
.k-timepicker,
.k-datetimepicker {
    border-color: #dee2e6;
}

.k-datepicker:focus-within,
.k-timepicker:focus-within,
.k-datetimepicker:focus-within {
    border-color: #26819D;
    box-shadow: 0 0 0 2px rgba(38, 129, 157, 0.2);
}

/* Botão do calendário */
.k-datepicker .k-input-button,
.k-timepicker .k-input-button,
.k-datetimepicker .k-input-button {
    color: #26819D;
}

/* --- Spin buttons do NumericTextBox --- */
.k-numerictextbox .k-input-spinner,
.k-numerictextbox .k-spin-button {
    border-color: #dee2e6;
}

.k-numerictextbox .k-input-spinner .k-button,
.k-numerictextbox .k-spin-button .k-button {
    border-color: #dee2e6;
}

.k-numerictextbox .k-spin-button .k-button:hover {
    background-color: rgba(38, 129, 157, 0.15);
    color: #26819D;
}

/* --- NumericTextBox - placeholder não cortado --- */
.k-numerictextbox .k-input-inner {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    padding: 4px 6px !important;
}

/* --- Grid Toolbar - espaçamento interno --- */
.k-grid > .k-grid-toolbar,
.k-grid > .k-toolbar {
    padding: 8px 8px;
}

/* --- Grid Header - reduzir padding lateral do .k-link --- */
.k-cell-inner > .k-link,
.k-grid-md .k-table-th > .k-cell-inner > .k-link {
    padding: 8px 0px !important;
}

/* --- Grid Header - corrigir desvio dos nomes das colunas --- */
.k-grid-header th {
    padding-left: 0px !important;
}

.k-column-title {
    padding-left: 0px;
    margin-left: 2px;
    font-size: 14px;
    line-height: 28px;
}

/* --- Alinhamento de colunas TelerikGrid --- */
th.align-right .k-cell-inner > .k-link {
    justify-content: right;
    margin-right: 27px;
}

th.align-center .k-cell-inner > .k-link {
    justify-content: center;
}
