/* Dark mode — override module shells/panels with hardcoded light backgrounds in .razor <style> blocks */

[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body,
[data-theme="dark"] .app-main,
[data-theme="dark"] .app-content,
[data-theme="dark"] .app-container {
    background-color: var(--kt-app-bg-color, #151521) !important;
    color: var(--kt-body-color, #ffffff);
}

[data-theme="dark"] [class*="-page-shell"] {
    background: linear-gradient(180deg, #1a1a27 0%, #151521 100%) !important;
    border-color: #2b2b40 !important;
}

[data-theme="dark"] [class*="-page-hero"],
[data-theme="dark"] [class*="-module-panel"],
[data-theme="dark"] .iso-module-panel,
[data-theme="dark"] .iso-linked-standard-badge,
[data-theme="dark"] .pc-filter-panel,
[data-theme="dark"] .ef-card:not(.active) {
    background: #1e1e2d !important;
    border-color: #323248 !important;
}

[data-theme="dark"] [class*="-action-card"]:not(.active),
[data-theme="dark"] .iso-standard-card:not(.active):not(.completed),
[data-theme="dark"] .iso-subcard:not(.active):not(.completed) {
    background: #1e1e2d !important;
    border-color: #323248 !important;
}

[data-theme="dark"] [class*="-action-card"].completed:not(.active),
[data-theme="dark"] .iso-standard-card.completed:not(.active) {
    background: linear-gradient(135deg, #1a3328 0%, #152820 100%) !important;
    border-color: #2d6b4a !important;
}

[data-theme="dark"] [class*="-page-title"],
[data-theme="dark"] [class*="-module-title"],
[data-theme="dark"] [class*="-action-title"],
[data-theme="dark"] .page-heading,
[data-theme="dark"] .text-dark {
    color: #ffffff !important;
}

[data-theme="dark"] [class*="-page-subtitle"],
[data-theme="dark"] [class*="-action-desc"],
[data-theme="dark"] [class*="-action-state"],
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-muted {
    color: #92929f !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .card .card-header,
[data-theme="dark"] .card .card-body,
[data-theme="dark"] .card .card-footer {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
    border-color: #323248 !important;
}

[data-theme="dark"] .card-title {
    color: #ffffff !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-control-solid,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text {
    background-color: #151521 !important;
    border-color: #323248 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #6d6d80 !important;
}

[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-light-primary {
    background-color: #2b2b40 !important;
    border-color: #323248 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .menu-sub-dropdown .card,
[data-theme="dark"] .menu-sub-dropdown .card-body,
[data-theme="dark"] .menu-sub-dropdown .card-header {
    background-color: #1e1e2d !important;
}

[data-theme="dark"] .bg-hover-light:hover {
    background-color: #2b2b40 !important;
}

[data-theme="dark"] .module-cartable-btn.active {
    background: linear-gradient(135deg, #1a4030 0%, #0f2a20 100%) !important;
    border-color: #1fa866 !important;
}

[data-theme="dark"] [class*="-action-card"].active,
[data-theme="dark"] .ef-card.active,
[data-theme="dark"] .iso-standard-card.active,
[data-theme="dark"] .iso-subcard.active,
[data-theme="dark"] .iso-subcard.active.completed {
    background: linear-gradient(135deg, #1a4030 0%, #0f2a20 100%) !important;
    border-color: #1fa866 !important;
}

[data-theme="dark"] [class*="-action-card"].active [class*="-action-title"],
[data-theme="dark"] .ef-card.active .ef-card-title,
[data-theme="dark"] .iso-standard-card.active .iso-card-code,
[data-theme="dark"] .iso-subcard.active .iso-subcard-title {
    color: #9fe3bf !important;
}

[data-theme="dark"] [class*="-action-card"].active [class*="-action-desc"],
[data-theme="dark"] [class*="-action-card"].active [class*="-action-state"],
[data-theme="dark"] .ef-card.active .ef-card-meta {
    color: #7fd4a8 !important;
}

/* Syncfusion grids & dropdowns */
[data-theme="dark"] .e-grid,
[data-theme="dark"] .e-gridcontent,
[data-theme="dark"] .e-gridheader,
[data-theme="dark"] .e-headercell,
[data-theme="dark"] .e-rowcell,
[data-theme="dark"] .e-grid .e-table {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .e-grid .e-altrow {
    background-color: #151521 !important;
}

[data-theme="dark"] .e-grid .e-row:hover .e-rowcell,
[data-theme="dark"] .e-grid .e-row.e-active .e-rowcell {
    background-color: #2b2b40 !important;
}

[data-theme="dark"] .e-input-group,
[data-theme="dark"] .e-input-group input,
[data-theme="dark"] .e-ddl,
[data-theme="dark"] .e-multi-select-wrapper,
[data-theme="dark"] .e-control-wrapper {
    background-color: #151521 !important;
    color: #ffffff !important;
    border-color: #323248 !important;
}

[data-theme="dark"] .e-popup,
[data-theme="dark"] .e-dropdownbase,
[data-theme="dark"] .e-list-item,
[data-theme="dark"] .e-ddl.e-popup {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .e-list-item:hover,
[data-theme="dark"] .e-list-item.e-active {
    background-color: #2b2b40 !important;
}

[data-theme="dark"] .e-dialog,
[data-theme="dark"] .e-dlg-content,
[data-theme="dark"] .e-dlg-header-content {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
}

[data-theme="dark"] .e-tab .e-tab-header,
[data-theme="dark"] .e-toolbar,
[data-theme="dark"] .e-pager {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
}

[data-theme="dark"] #gridRisk.e-grid .capa-mgmt-dd.e-dropdown-btn,
[data-theme="dark"] #gridRisk.e-grid .capa-mgmt-dd .e-btn {
    background-color: #2b2b40 !important;
    border-color: #323248 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .report-builder-history-panel,
[data-theme="dark"] .risk-module-grid-host,
[data-theme="dark"] .org-grids-host,
[data-theme="dark"] .asset-grids-host {
    background-color: transparent !important;
}

[data-theme="dark"] .separator,
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom {
    border-color: #323248 !important;
}

[data-theme="dark"] [class*="-module-header"] {
    background: linear-gradient(90deg, #1a1a27 0%, #151521 100%) !important;
    border-color: #323248 !important;
}

[data-theme="dark"] [class*="-module-body"] {
    background-color: transparent !important;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-body,
[data-theme="dark"] .bg-light {
    background-color: #1e1e2d !important;
}

[data-theme="dark"] table,
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
    border-color: #323248 !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #151521 !important;
}

/* Dashboard — stat cards use negative margin; keep toolbar/title row above them */
[data-theme="dark"] #kt_app_toolbar.app-toolbar {
    position: relative;
    z-index: 20;
    background-color: #1a1a27 !important;
    border-bottom: 1px solid #323248 !important;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] #kt_app_toolbar .page-heading,
[data-theme="dark"] #kt_app_toolbar .btn-primary {
    position: relative;
    z-index: 1;
}

[data-theme="dark"] #kt_app_content .card-body.mt-n20 > .mt-n20 {
    margin-top: -3rem !important;
}

/* Syncfusion — Persian font in dark theme (bootstrap-dark resets font-family) */
[data-theme="dark"] .e-grid,
[data-theme="dark"] .e-grid .e-headercell,
[data-theme="dark"] .e-grid .e-rowcell,
[data-theme="dark"] .e-grid .e-toolbar-item .e-tbar-btn-text,
[data-theme="dark"] .e-dropdown-btn,
[data-theme="dark"] .e-ddl,
[data-theme="dark"] .e-input-group input {
    font-family: IRANSans, 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}
