/* ===========================================
   AGD TELERIK DARK THEME OVERRIDES
   Force dark background on all Telerik components
   =========================================== */

/* ===== SCHEDULER ===== */

/* Main scheduler container */
[data-theme="dark"] .k-scheduler {
    background: #1e1e1e !important;
    background-color: #1e1e1e !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .k-scheduler-layout {
    background: #1e1e1e !important;
}

/* Scheduler table cells */
[data-theme="dark"] .k-scheduler-table,
[data-theme="dark"] .k-scheduler-table tbody,
[data-theme="dark"] .k-scheduler-table tr,
[data-theme="dark"] .k-scheduler-table td,
[data-theme="dark"] .k-scheduler-table th {
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Working hours - dark grey background */
[data-theme="dark"] .k-scheduler-content td,
[data-theme="dark"] .k-scheduler-body td {
    background: #1e1e1e !important;
    background-color: #1e1e1e !important;
}

/* NON-WORKING HOURS - slightly lighter grey to show difference */
[data-theme="dark"] .k-scheduler-content td.k-nonwork-hour,
[data-theme="dark"] .k-scheduler-body td.k-nonwork-hour,
[data-theme="dark"] .k-scheduler .k-nonwork-hour,
[data-theme="dark"] .k-nonwork-hour,
[data-theme="dark"] td.k-nonwork-hour,
[data-theme="dark"] .k-scheduler-body .k-scheduler-cell.k-nonwork-hour,
[data-theme="dark"] .k-scheduler .k-slot-cell.k-nonwork-hour {
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
}

/* Alternative: Non-work cells might have different class in newer Telerik */
[data-theme="dark"] .k-scheduler-body td.k-resource-cell.k-nonwork-hour,
[data-theme="dark"] .k-scheduler-body .k-nonwork-hour,
[data-theme="dark"] .k-scheduler [class*="nonwork"] {
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
}

/* Scheduler header - PURPLE in dark mode */
[data-theme="dark"] .k-scheduler-header,
[data-theme="dark"] .k-scheduler-header-wrap,
[data-theme="dark"] .k-scheduler-head,
[data-theme="dark"] .k-scheduler-head th,
[data-theme="dark"] .k-scheduler-header th,
[data-theme="dark"] .k-scheduler-header td,
[data-theme="dark"] .k-scheduler-header-all-day,
[data-theme="dark"] .k-scheduler-head-wrap,
[data-theme="dark"] .k-scheduler-head .k-scheduler-group,
[data-theme="dark"] .k-scheduler-head .k-scheduler-group-cell,
[data-theme="dark"] .k-scheduler-datecolumn,
[data-theme="dark"] .k-scheduler-times-all-day {
    background: #2d2352 !important;
    background-color: #2d2352 !important;
    color: #f8fafc !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
}

/* Day/Week column headers */
[data-theme="dark"] .k-scheduler-head .k-link,
[data-theme="dark"] .k-scheduler-header .k-link {
    color: #f8fafc !important;
}

/* Times column (left side) - PURPLE */
[data-theme="dark"] .k-scheduler-times,
[data-theme="dark"] .k-scheduler-times td,
[data-theme="dark"] .k-scheduler-times th,
[data-theme="dark"] .k-scheduler-times-wrap {
    background: #2d2352 !important;
    background-color: #2d2352 !important;
    color: #c4b5fd !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
}

/* Today highlight */
[data-theme="dark"] .k-scheduler .k-today,
[data-theme="dark"] .k-scheduler td.k-today,
[data-theme="dark"] .k-today {
    background: rgba(99, 102, 241, 0.15) !important;
    background-color: rgba(99, 102, 241, 0.15) !important;
}

/* Scheduler all-day row and header rows - PURPLE (only in head, not body) */
[data-theme="dark"] .k-scheduler-head .k-scheduler-group,
[data-theme="dark"] .k-scheduler-head .k-scheduler-group td,
[data-theme="dark"] .k-scheduler-layout-flex .k-scheduler-head,
[data-theme="dark"] .k-scheduler-head .k-scheduler-row {
    background: #2d2352 !important;
    background-color: #2d2352 !important;
}

/* HIDE Telerik's built-in toolbar - we use our own custom toolbar */
.k-scheduler-toolbar,
.k-scheduler-navigation,
.k-scheduler > .k-toolbar,
.k-scheduler-footer {
    display: none !important;
}

/* Month view cells */
[data-theme="dark"] .k-scheduler-monthview .k-scheduler-table td,
[data-theme="dark"] .k-scheduler-monthview .k-scheduler-content td {
    background: #1e1e1e !important;
}

[data-theme="dark"] .k-scheduler-monthview .k-other-month {
    background: #2a2a2a !important;
}

/* ===== INPUT FIELDS / DROPDOWNS / COMBOBOXES ===== */

/* All input types base */
[data-theme="dark"] .k-input,
[data-theme="dark"] .k-textbox,
[data-theme="dark"] .k-textarea,
[data-theme="dark"] .k-maskedtextbox,
[data-theme="dark"] .k-numerictextbox,
[data-theme="dark"] .k-dropdownlist,
[data-theme="dark"] .k-dropdown,
[data-theme="dark"] .k-combobox,
[data-theme="dark"] .k-autocomplete,
[data-theme="dark"] .k-multiselect,
[data-theme="dark"] .k-datepicker,
[data-theme="dark"] .k-datetimepicker,
[data-theme="dark"] .k-timepicker,
[data-theme="dark"] .k-picker,
[data-theme="dark"] .k-picker-solid {
    background: #252542 !important;
    background-color: #252542 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
}

/* Input inner wrapper */
[data-theme="dark"] .k-input-inner,
[data-theme="dark"] .k-input-value-text,
[data-theme="dark"] .k-input-values {
    background: transparent !important;
    color: #f8fafc !important;
}

/* Placeholder text */
[data-theme="dark"] .k-input::placeholder,
[data-theme="dark"] .k-input-inner::placeholder,
[data-theme="dark"] input::placeholder {
    color: #64748b !important;
}

/* ===== DROPDOWN POPUP LISTS ===== */

/* Popup containers */
[data-theme="dark"] .k-popup,
[data-theme="dark"] .k-animation-container .k-popup,
[data-theme="dark"] .k-list-container,
[data-theme="dark"] .k-animation-container-shown .k-popup {
    background: #252542 !important;
    background-color: #252542 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

/* List inside popup */
[data-theme="dark"] .k-list,
[data-theme="dark"] .k-list-content,
[data-theme="dark"] .k-list-ul {
    background: #252542 !important;
    background-color: #252542 !important;
}

/* List items */
[data-theme="dark"] .k-list-item,
[data-theme="dark"] .k-list-optionlabel {
    background: transparent !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .k-list-item:hover,
[data-theme="dark"] .k-list-item.k-hover,
[data-theme="dark"] .k-list-item.k-focus {
    background: rgba(255, 255, 255, 0.08) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .k-list-item.k-selected,
[data-theme="dark"] .k-list-item.k-selected:hover {
    background: #6366f1 !important;
    background-color: #6366f1 !important;
    color: white !important;
}

/* ===== CALENDAR / DATE PICKER POPUP ===== */

[data-theme="dark"] .k-calendar,
[data-theme="dark"] .k-calendar-container,
[data-theme="dark"] .k-calendar-view {
    background: #252542 !important;
    background-color: #252542 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .k-calendar-header,
[data-theme="dark"] .k-calendar-header .k-button {
    background: transparent !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .k-calendar th,
[data-theme="dark"] .k-calendar-th,
[data-theme="dark"] .k-calendar td,
[data-theme="dark"] .k-calendar-td {
    color: #f8fafc !important;
}

[data-theme="dark"] .k-calendar .k-today .k-link {
    background: #6366f1 !important;
    color: white !important;
    border-radius: 50%;
}

[data-theme="dark"] .k-calendar .k-selected .k-link,
[data-theme="dark"] .k-calendar .k-range-start .k-link,
[data-theme="dark"] .k-calendar .k-range-end .k-link {
    background: #6366f1 !important;
    color: white !important;
}

[data-theme="dark"] .k-calendar td:hover .k-link,
[data-theme="dark"] .k-calendar-td:hover .k-link {
    background: rgba(99, 102, 241, 0.2) !important;
}

/* ===== TIME PICKER ===== */

[data-theme="dark"] .k-time-list,
[data-theme="dark"] .k-time-list-wrapper,
[data-theme="dark"] .k-time-container {
    background: #252542 !important;
    background-color: #252542 !important;
}

[data-theme="dark"] .k-time-list-wrapper .k-item {
    color: #f8fafc !important;
}

[data-theme="dark"] .k-time-list-wrapper .k-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* ===== BUTTONS ===== */

[data-theme="dark"] .k-button {
    background: #252542 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .k-button:hover {
    background: #303055 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .k-button-solid-primary,
[data-theme="dark"] .k-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    border-color: #6366f1 !important;
    color: white !important;
}

[data-theme="dark"] .k-button-solid-primary:hover,
[data-theme="dark"] .k-primary:hover {
    background: #818cf8 !important;
    border-color: #818cf8 !important;
}

[data-theme="dark"] .k-button-flat {
    background: transparent !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .k-button-flat:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}

/* ===== WINDOW / DIALOG ===== */

[data-theme="dark"] .k-window,
[data-theme="dark"] .k-dialog {
    background: rgba(30, 30, 60, 0.95) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .k-window-titlebar,
[data-theme="dark"] .k-dialog-titlebar {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .k-window-content,
[data-theme="dark"] .k-dialog-content {
    background: transparent !important;
    color: #f8fafc !important;
}

/* ===== CHECKBOX ===== */

[data-theme="dark"] .k-checkbox {
    background: #252542 !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

[data-theme="dark"] .k-checkbox:checked,
[data-theme="dark"] .k-checkbox.k-checked {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
}

/* ===== MULTISELECT CHIPS/TAGS ===== */

[data-theme="dark"] .k-chip,
[data-theme="dark"] .k-chip-solid {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
    color: white !important;
}

[data-theme="dark"] .k-chip .k-chip-remove-action {
    color: white !important;
}

/* ===== CONTEXT MENU ===== */

[data-theme="dark"] .k-menu,
[data-theme="dark"] .k-menu-popup,
[data-theme="dark"] .k-context-menu {
    background: #252542 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .k-menu-item {
    color: #f8fafc !important;
}

[data-theme="dark"] .k-menu-item:hover,
[data-theme="dark"] .k-menu-item.k-hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* ===== SPINNER BUTTONS ===== */

[data-theme="dark"] .k-spinner-increase,
[data-theme="dark"] .k-spinner-decrease,
[data-theme="dark"] .k-select {
    background: #252542 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .k-spinner-increase:hover,
[data-theme="dark"] .k-spinner-decrease:hover,
[data-theme="dark"] .k-select:hover {
    background: #303055 !important;
    color: #f8fafc !important;
}

/* ===== FORM LABELS ===== */

[data-theme="dark"] .k-form-label,
[data-theme="dark"] .k-label,
[data-theme="dark"] label {
    color: #94a3b8 !important;
}

/* ===== LOADING INDICATOR ===== */

[data-theme="dark"] .k-loading-mask {
    background: rgba(15, 15, 26, 0.8) !important;
}

/* TelerikLoader - Purple color */
.k-loader,
[data-theme="dark"] .k-loader {
    color: #6366f1 !important;
}

/* Loader segments/dots */
.k-loader-segment,
[data-theme="dark"] .k-loader-segment,
.k-loader .k-loader-segment {
    background-color: #6366f1 !important;
}

/* Loader canvas (for spinner type) */
.k-loader-canvas,
[data-theme="dark"] .k-loader-canvas {
    color: #6366f1 !important;
}

/* Spinner stroke */
.k-loader-spin .k-loader-segment::after,
[data-theme="dark"] .k-loader-spin .k-loader-segment::after {
    border-color: #6366f1 transparent transparent transparent !important;
}

/* Primary loader variant */
.k-loader-primary,
[data-theme="dark"] .k-loader-primary {
    color: #6366f1 !important;
}

.k-loader-primary .k-loader-segment,
[data-theme="dark"] .k-loader-primary .k-loader-segment {
    background-color: #6366f1 !important;
}

/* ===== SCHEDULER EVENTS/APPOINTMENTS ===== */

[data-theme="dark"] .k-event {
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .k-event:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* ===== MONTH VIEW STYLES =====
   Keep it simple - just styling without breaking layout
*/

/* Month view body cells */
.k-scheduler-monthview .k-scheduler-body .k-slot-cell {
    background-color: #1e1e1e !important;
}

/* Remove any hover effects on body groups */
.k-scheduler-monthview .k-scheduler-body .k-scheduler-group,
.k-scheduler-monthview .k-scheduler-body .k-scheduler-row,
.k-scheduler-monthview .k-scheduler-body .k-group-cell {
    background: transparent !important;
}

/* ===== MONTH VIEW HEIGHT =====
   Make month view fill available height
*/
.k-scheduler-layout-flex.k-scheduler-monthview {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.k-scheduler-monthview .k-scheduler-pane {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Keep head compact */
.k-scheduler-monthview .k-scheduler-head {
    flex: 0 0 auto !important;
}

.k-scheduler-monthview .k-scheduler-body {
    flex: 1 !important;
}

/* Remove hover effect from scheduler layout */
.k-scheduler-layout:hover,
.k-scheduler-layout-flex:hover,
.k-scheduler-table:hover,
.k-scheduler-content:hover,
.k-scheduler-body:hover {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Disable any transition effects on scheduler body that cause flicker */
.k-scheduler-monthview .k-scheduler-body,
.k-scheduler-monthview .k-scheduler-body * {
    transition: none !important;
}

/* ===== LOCK WORKING HOURS BACKGROUND =====
   Prevent ANY state changes from altering the working hours background
   This fixes the purple flash when mouse leaves calendar
   Using the darker neutral color the user prefers
*/

/* Lock all scheduler body cells to dark grey color */
[data-theme="dark"] .k-scheduler-body td,
[data-theme="dark"] .k-scheduler-body td:hover,
[data-theme="dark"] .k-scheduler-body td:focus,
[data-theme="dark"] .k-scheduler-body td:active,
[data-theme="dark"] .k-scheduler-body td:focus-within,
[data-theme="dark"] .k-scheduler-content td,
[data-theme="dark"] .k-scheduler-content td:hover,
[data-theme="dark"] .k-scheduler-content td:focus,
[data-theme="dark"] .k-scheduler-content td:active,
[data-theme="dark"] .k-scheduler .k-scheduler-cell,
[data-theme="dark"] .k-scheduler .k-scheduler-cell:hover,
[data-theme="dark"] .k-scheduler .k-scheduler-cell:focus {
    background: #1e1e1e !important;
    background-color: #1e1e1e !important;
}

/* NON-WORKING HOURS - lighter grey (MUST come after working hours with higher specificity) */
[data-theme="dark"] .k-scheduler .k-scheduler-body td.k-nonwork-hour,
[data-theme="dark"] .k-scheduler .k-scheduler-body td.k-nonwork-hour:hover,
[data-theme="dark"] .k-scheduler .k-scheduler-body td.k-nonwork-hour:focus,
[data-theme="dark"] .k-scheduler .k-scheduler-body .k-scheduler-cell.k-nonwork-hour,
[data-theme="dark"] .k-scheduler .k-scheduler-content td.k-nonwork-hour,
[data-theme="dark"] .k-scheduler td.k-nonwork-hour,
[data-theme="dark"] .k-scheduler .k-nonwork-hour,
[data-theme="dark"] .k-scheduler-body .k-slot-cell.k-nonwork-hour,
[data-theme="dark"] td.k-scheduler-cell.k-nonwork-hour {
    background: #2a2a2a !important;
    background-color: #2a2a2a !important;
}

/* Lock scheduler body and groups - prevent purple on focus/blur */
[data-theme="dark"] .k-scheduler-body,
[data-theme="dark"] .k-scheduler-body:hover,
[data-theme="dark"] .k-scheduler-body:focus,
[data-theme="dark"] .k-scheduler-body:focus-within,
[data-theme="dark"] .k-scheduler-body .k-scheduler-group,
[data-theme="dark"] .k-scheduler-body .k-scheduler-group:hover,
[data-theme="dark"] .k-scheduler-body .k-scheduler-row,
[data-theme="dark"] .k-scheduler-body .k-scheduler-row:hover,
[data-theme="dark"] .k-scheduler-body .k-group-cell,
[data-theme="dark"] .k-scheduler-body .k-group-cell:hover {
    background: transparent !important;
    background-color: transparent !important;
}

/* Scheduler container focus states - keep dark grey */
[data-theme="dark"] .k-scheduler:focus,
[data-theme="dark"] .k-scheduler:focus-within,
[data-theme="dark"] .k-scheduler:active,
[data-theme="dark"] .k-scheduler-layout:focus,
[data-theme="dark"] .k-scheduler-layout:focus-within,
[data-theme="dark"] .k-scheduler-layout-flex:focus,
[data-theme="dark"] .k-scheduler-layout-flex:focus-within {
    background: #1e1e1e !important;
    background-color: #1e1e1e !important;
    outline: none !important;
}

/* Remove any outline or box-shadow on scheduler focus */
[data-theme="dark"] .k-scheduler,
[data-theme="dark"] .k-scheduler *,
[data-theme="dark"] .k-scheduler-body *,
[data-theme="dark"] .k-scheduler-content * {
    outline: none !important;
}

/* Disable transitions on scheduler to prevent color flash */
[data-theme="dark"] .k-scheduler-body td,
[data-theme="dark"] .k-scheduler-content td,
[data-theme="dark"] .k-scheduler .k-scheduler-cell {
    transition: none !important;
}

/* ===== DARK TABSTRIP (for dialogs/windows) ===== */

[data-theme="dark"] .agd-dark-tabstrip,
[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-items-wrapper,
[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-items {
    background: #1e1e3c !important;
    background-color: #1e1e3c !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-item,
[data-theme="dark"] .agd-dark-tabstrip .k-item {
    background: transparent !important;
    color: #94a3b8 !important;
    border-color: transparent !important;
}

[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-item:hover,
[data-theme="dark"] .agd-dark-tabstrip .k-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-item.k-active,
[data-theme="dark"] .agd-dark-tabstrip .k-item.k-active,
[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-item.k-selected,
[data-theme="dark"] .agd-dark-tabstrip .k-item.k-selected {
    background: #252542 !important;
    color: #f8fafc !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    border-bottom-color: #252542 !important;
}

[data-theme="dark"] .agd-dark-tabstrip .k-tabstrip-content,
[data-theme="dark"] .agd-dark-tabstrip .k-content {
    background: #252542 !important;
    background-color: #252542 !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Tab link text */
[data-theme="dark"] .agd-dark-tabstrip .k-link {
    color: inherit !important;
}
