/* ==========================================================================
   AIVYTVORY — SWISS MINIMALIST DESIGN SYSTEM
   Clean Neutral Surfaces, Hairline Borders, Disciplined Typography
   ========================================================================== */

:root {
    --bg-canvas: #FAFAFA;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F4F4F5;
    --border-hairline: #E4E4E7;
    --border-strong: #D4D4D8;
    --text-primary: #09090B;
    --text-secondary: #52525B;
    --text-muted: #71717A;
    --accent: #09090B;
    --accent-blue: #0066FF;
}

html.dark {
    --bg-canvas: #0A0A0B;
    --bg-surface: #111113;
    --bg-subtle: #18181B;
    --border-hairline: #27272A;
    --border-strong: #3F3F46;
    --text-primary: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --accent: #FAFAFA;
    --accent-blue: #3B82F6;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Clean Surface Card */
.surface-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.surface-card:hover {
    border-color: var(--border-strong);
}

/* Solid Primary Button (High-Contrast Ink) */
.btn-primary {
    background-color: #09090B;
    color: #FFFFFF;
    transition: background-color 150ms ease, opacity 150ms ease;
}

.btn-primary:hover {
    background-color: #27272A;
}

html.dark .btn-primary {
    background-color: #FAFAFA;
    color: #09090B;
}

html.dark .btn-primary:hover {
    background-color: #E4E4E7;
}

/* Subtle Secondary Button */
.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-hairline);
    transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-secondary:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-strong);
}

/* Subtle scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 9999px;
}

::selection {
    background-color: #0066FF;
    color: #FFFFFF;
}

/* ==========================================================================
   SYNCFUSION GRID, TOOLBAR, SEARCH & DIALOG STYLING (SHIFT_PLAN_PRO STYLE)
   ========================================================================== */

.tw-grid-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
}

html.dark .tw-grid-wrapper {
    border-color: #1e293b;
    background-color: #0f172a;
}

.tw-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: color 150ms, background-color 150ms, border-color 150ms;
    cursor: pointer;
}

.tw-btn-sm {
    padding: 0.3rem 0.625rem;
    font-size: 0.75rem;
}

.tw-btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    border: 1px solid #2563eb;
}

.tw-btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.tw-btn-secondary {
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #0f172a;
}

.tw-btn-secondary:hover:not(:disabled) {
    background-color: #f1f5f9;
}

html.dark .tw-btn-secondary {
    border-color: #334155;
    background-color: #1e293b;
    color: #f1f5f9;
}

html.dark .tw-btn-secondary:hover:not(:disabled) {
    background-color: #334155;
}

.tw-btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    border: 1px solid #dc2626;
}

.tw-btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
}

.tw-btn:disabled,
.tw-btn[disabled] {
    cursor: not-allowed !important;
    opacity: 0.45 !important;
    filter: grayscale(70%) !important;
}

/* Custom Search Container in Syncfusion Toolbar */
.custom-search-container {
    position: relative;
    display: inline-block;
}

.custom-search-input {
    padding: 4px 60px 4px 10px !important;
    border-radius: 0.375rem;
    border: 1px solid #cbd5e1;
    font-size: 0.75rem;
    line-height: 1.5;
    background-color: #ffffff;
    color: #0f172a;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.custom-search-input:focus {
    border-color: #3b82f6;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.custom-search-icon-btn {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.custom-search-icon-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.custom-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.custom-search-clear:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

html.dark .custom-search-input {
    background-color: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

html.dark .custom-search-icon-btn,
html.dark .custom-search-clear {
    color: #94a3b8;
}

html.dark .custom-search-icon-btn:hover,
html.dark .custom-search-clear:hover {
    background-color: #334155;
    color: #ffffff;
}

/* Fix Syncfusion grid toolbar overflow for dropdowns */
.e-toolbar,
.e-toolbar .e-toolbar-items {
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

.e-grid, .e-grid .e-gridheader, .e-grid .e-toolbar, .e-grid .e-headercontent {
    z-index: 1 !important;
}

/* Syncfusion Grid Light Mode */
html:not(.dark) .e-grid {
    background-color: #ffffff;
    border-color: #e2e8f0;
    color: #0f172a;
}

html:not(.dark) .e-grid .e-gridheader {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

html:not(.dark) .e-grid .e-headercell,
html:not(.dark) .e-grid .e-detailheadercell {
    background-color: #f8fafc;
    color: #334155;
    border-color: #e2e8f0;
}

html:not(.dark) .e-grid .e-headercelldiv {
    color: #334155;
    font-weight: 600;
}

html:not(.dark) .e-grid .e-toolbar,
html:not(.dark) .e-grid .e-toolbar .e-toolbar-items {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

html:not(.dark) .e-grid .e-gridpager,
html:not(.dark) .e-pager {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    color: #475569;
}

html:not(.dark) .e-grid .e-row:hover .e-rowcell,
html:not(.dark) .e-grid .e-row.e-hover .e-rowcell {
    background-color: #f8fafc !important;
}

/* Syncfusion Grid Dark Mode (Dark Slate Blue - SHIFT_PLAN_PRO style) */
html.dark .e-grid {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark .e-grid .e-gridheader {
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}

html.dark .e-grid .e-headercell,
html.dark .e-grid .e-detailheadercell {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

html.dark .e-grid .e-headercell:hover {
    background-color: #334155 !important;
}

html.dark .e-grid .e-headercelldiv {
    color: #f8fafc !important;
    font-weight: 600 !important;
}

html.dark .e-grid .e-gridcontent,
html.dark .e-grid .e-content,
html.dark .e-grid .e-emptyrow,
html.dark .e-grid .e-table {
    background-color: #0f172a !important;
    color: #cbd5e1 !important;
}

html.dark .e-grid .e-row {
    background-color: #0f172a !important;
    color: #cbd5e1 !important;
}

html.dark .e-grid .e-altrow {
    background-color: #0b1324 !important;
    color: #cbd5e1 !important;
}

html.dark .e-grid .e-rowcell {
    border-color: #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark .e-grid .e-rowcell a,
html.dark .e-grid .e-rowcell .grid-cell-link {
    color: #60a5fa !important;
}

html.dark .e-grid .e-row:hover .e-rowcell,
html.dark .e-grid .e-row.e-hover .e-rowcell {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark .e-grid .e-row.e-selectionbackground,
html.dark .e-grid .e-rowcell.e-selectionbackground,
html.dark .e-grid .e-active {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
}

html.dark .e-grid .e-toolbar,
html.dark .e-grid .e-toolbar .e-toolbar-items {
    background-color: #0f172a !important;
    border-bottom: 1px solid #1e293b !important;
}

html.dark .e-grid .e-toolbar .e-toolbar-item .e-tbar-btn,
html.dark .e-grid .e-toolbar .e-toolbar-item button.e-tbar-btn {
    background-color: transparent !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark .e-grid .e-toolbar .e-toolbar-item .e-tbar-btn:hover,
html.dark .e-grid .e-toolbar .e-toolbar-item button.e-tbar-btn:hover {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark .e-grid .e-gridpager,
html.dark .e-pager {
    background-color: #0f172a !important;
    border-top: 1px solid #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark .e-pager .e-numericitem {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark .e-pager .e-numericitem.e-active,
html.dark .e-pager .e-currentitem {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

html.dark .e-pager .e-pagercontainer {
    background-color: transparent !important;
}

html.dark .e-pager .e-prevpagedropdown,
html.dark .e-pager .e-pagesizes {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark .e-dropdownbase,
html.dark .e-popup,
html.dark .e-dialog,
html.dark .e-excel-filter,
html.dark .e-filter-popup {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark .e-dialog .e-dlg-header-content,
html.dark .e-dialog .e-footer-content {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark .e-dialog .e-dlg-content {
    background-color: #0f172a !important;
    color: #cbd5e1 !important;
}

html.dark .e-dropdownbase .e-list-item,
html.dark .e-popup .e-list-item {
    color: #cbd5e1 !important;
    background-color: #0f172a !important;
}

html.dark .e-dropdownbase .e-list-item:hover,
html.dark .e-dropdownbase .e-list-item.e-hover,
html.dark .e-popup .e-list-item:hover {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

/* Syncfusion Dialog Overlay Styling (Light & Dark) */
.e-dlg-overlay {
    background-color: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

html.dark .e-dlg-overlay {
    background-color: rgba(2, 6, 23, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

/* Theme Toggle 3-Mode Icon & Active State */
[data-theme-icon],
[data-theme-check] {
    display: none;
}

html[data-theme-mode="system"] [data-theme-icon="system"],
html[data-theme-mode="light"] [data-theme-icon="light"],
html[data-theme-mode="dark"] [data-theme-icon="dark"] {
    display: inline-block;
}

html[data-theme-mode="system"] [data-theme-option="system"] [data-theme-check],
html[data-theme-mode="light"] [data-theme-option="light"] [data-theme-check],
html[data-theme-mode="dark"] [data-theme-option="dark"] [data-theme-check] {
    display: inline-block;
}

html[data-theme-mode="system"] [data-theme-option="system"],
html[data-theme-mode="light"] [data-theme-option="light"],
html[data-theme-mode="dark"] [data-theme-option="dark"] {
    background-color: rgba(113, 113, 122, 0.12);
    font-weight: 600;
}
