/* =============================================================================
   کنتراست متن و آیکون — تم روشن و تاریک
   ============================================================================= */

/* هدرهای گرادیانی: همیشه سفید */
.page-header-card,
.reg-page-header,
.report-header-card,
.ps-page-header,
.theme-card-header,
.home-summary-header,
.ps-app .mud-appbar {
    --ps-on-primary: #ffffff;
}

.page-header-card .mud-typography,
.page-header-card .mud-icon,
.page-header-card .mud-icon-root,
.reg-page-header .mud-typography,
.reg-page-header .mud-icon,
.reg-page-header .mud-icon-root,
.report-header-card .mud-typography,
.report-header-card .mud-icon,
.theme-card-header .mud-typography,
.theme-card-header .mud-icon,
.theme-card-header .mud-icon-root,
.home-card-header-stack .mud-typography,
.home-card-header-stack .mud-icon,
.home-summary-header .mud-typography,
.home-summary-header .mud-icon,
.home-summary-header .mud-icon-root {
    color: var(--ps-on-primary, #fff) !important;
    -webkit-text-fill-color: var(--ps-on-primary, #fff) !important;
}

/* جدول: آیکون و متن هدر */
.mud-table-head .mud-table-cell,
.mud-table thead .mud-th {
    color: var(--theme-appbar-text, #fff) !important;
}

.mud-table-head .mud-icon,
.mud-table-head .mud-icon-root,
.mud-table-head .mud-typography {
    color: var(--theme-appbar-text, #fff) !important;
}

/* بدنه جدول — متن خوانا */
.ps-app .mud-table .mud-table-body .mud-table-cell,
.ps-app .mud-table tbody .mud-td {
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .ps-app .mud-table .mud-table-body .mud-table-cell {
    color: var(--theme-text-primary, #f1f5f9) !important;
}

/* آیکون تیره روی پس‌زمینه روشن — در تم تاریک اصلاح */
[data-theme="dark"] .home-card-content .mud-icon-color-dark,
[data-theme="dark"] .home-card-content .mud-icon-root.mud-icon-color-dark,
[data-theme="dark"] .theme-surface .mud-icon-color-dark,
[data-theme="dark"] .mud-paper .mud-icon-color-dark:not(.page-header-card *) {
    color: var(--theme-primary-light, #93c5fd) !important;
}

[data-theme="light"] .home-card-content .mud-icon-color-dark {
    color: #334155 !important;
}

/* برچسب‌ها روی کارت سفید */
.home-card-content .theme-text-primary,
.home-card-content .mud-typography.theme-text-primary {
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .home-card-content .theme-text-primary {
    color: var(--theme-text-primary, #e2e8f0) !important;
}

/* منوی کشو — آیکون و متن */
.ps-app .mud-drawer .mud-nav-link,
.ps-app .mud-drawer .mud-nav-link .mud-icon-root,
.ps-app .mud-drawer .mud-nav-group .mud-nav-link {
    color: rgba(255, 255, 255, 0.92) !important;
}

.ps-app .mud-drawer .mud-nav-group .mud-nav-group-title {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* فیلتر — آیکون adornment */
.ps-app .filter-paper .mud-input-adornment .mud-icon-root,
.ps-app .ps-form-section .mud-input-adornment .mud-icon-root {
    color: var(--theme-primary) !important;
}

[data-theme="dark"] .ps-app .filter-paper .mud-input-adornment .mud-icon-root {
    color: var(--theme-primary-light, #93c5fd) !important;
}

/* دکمه آیکون روی AppBar */
.ps-app .mud-appbar .mud-icon-button {
    color: #fff !important;
}

/* جلوگیری از متن Secondary نامرئی */
.ps-app .mud-typography-color-secondary,
.ps-app .mud-typography.mud-typography-body2.mud-typography-color-secondary {
    color: var(--theme-text-secondary) !important;
    opacity: 1 !important;
}

[data-theme="dark"] .ps-app .mud-typography-color-secondary {
    color: rgba(241, 245, 249, 0.72) !important;
}

/* Alert — متن واضح */
.mud-alert .mud-typography,
.mud-alert .mud-icon-root {
    color: inherit !important;
}

/* دیالوگ */
.mud-dialog-title .mud-typography,
.mud-dialog-title .mud-icon-root {
    color: #fff !important;
}

.mud-dialog-content {
    color: var(--theme-text-primary) !important;
}

/* صفحه لاگین — بدون سفید روی سفید */
.login-page .login-form-section .mud-typography,
.login-page .login-form-section .mud-input-label {
    color: #1e293b !important;
}

.login-page .welcome-section .mud-typography,
.login-page .welcome-section .mud-icon-root {
    color: #fff !important;
}

/* منوی کاربر (سه‌نقطه) — اطلاعات خوانا روی پس‌زمینه روشن */
.app-user-menu-popover,
.app-user-menu-popover .mud-list {
    background: var(--theme-surface, #fff) !important;
    color: var(--theme-text-primary, #1e293b) !important;
    min-width: 260px;
}

.app-user-menu-info {
    cursor: default;
    background: var(--theme-surface, #fff);
    border-bottom: 1px solid var(--ps-border, rgba(0, 0, 0, 0.08));
}

.app-user-menu-popover .app-user-menu-name,
.app-user-menu-popover .app-user-menu-email,
.app-user-menu-popover .app-user-menu-roles,
.app-user-menu-popover .app-user-menu-info .mud-typography {
    color: var(--theme-text-primary, #1e293b) !important;
    opacity: 1 !important;
}

.app-user-menu-popover .app-user-menu-email {
    color: var(--theme-text-secondary, #64748b) !important;
}

.app-user-menu-popover .app-user-menu-roles {
    color: var(--theme-text-secondary, #64748b) !important;
    font-size: 0.75rem;
}

.app-user-menu-popover .app-user-menu-avatar {
    font-family: 'IRANSans', sans-serif !important;
    font-weight: 700;
}

.app-user-menu-popover .mud-menu-item .mud-typography,
.app-user-menu-popover .mud-menu-item .mud-icon-root {
    color: var(--theme-text-primary, #1e293b) !important;
}

[data-theme="dark"] .app-user-menu-popover,
[data-theme="dark"] .app-user-menu-popover .mud-list,
[data-theme="dark"] .app-user-menu-info {
    background: var(--theme-surface, #1a2332) !important;
}

[data-theme="dark"] .app-user-menu-popover .app-user-menu-name,
[data-theme="dark"] .app-user-menu-popover .app-user-menu-info .mud-typography,
[data-theme="dark"] .app-user-menu-popover .mud-menu-item .mud-typography,
[data-theme="dark"] .app-user-menu-popover .mud-menu-item .mud-icon-root {
    color: var(--theme-text-primary, #f1f5f9) !important;
}

/* دیالوگ — محتوا در تم تاریک */
[data-theme="dark"] .mud-dialog-content {
    background: var(--theme-surface, #1e293b) !important;
    color: var(--theme-text-primary, #f1f5f9) !important;
}

[data-theme="dark"] .mud-dialog-content .mud-input-label,
[data-theme="dark"] .mud-dialog-content .mud-input-root input,
[data-theme="dark"] .mud-dialog-content .mud-input-slot {
    color: var(--theme-text-primary, #f1f5f9) !important;
}

[data-theme="dark"] .mud-dialog-content .mud-input-outlined .mud-input-outlined-border {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Chip — خوانایی تم تاریک */
[data-theme="dark"] .ps-app .mud-chip.mud-chip-color-default {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--theme-text-primary, #f1f5f9) !important;
}

/* Progress — رنگ تم */
.ps-app .mud-progress-linear .mud-progress-linear-bar {
    background: var(--theme-gradient-primary) !important;
}
