:root {
    --ziper-bg: #f8fafc;
    --ziper-surface: #ffffff;
    --ziper-surface-soft: #f8fafc;
    --ziper-surface-muted: #f3f4f6;
    --ziper-text: #111827;
    --ziper-text-muted: #6b7280;
    --ziper-border: #e5e7eb;
    --ziper-border-strong: #d1d5db;
    --ziper-primary: #584DFD;
    --ziper-primary-soft: #f1f4ff;
    --ziper-shadow: 0 18px 45px rgba(15, 23, 42, .12);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --ziper-bg: #0f172a;
    --ziper-surface: #111827;
    --ziper-surface-soft: #172033;
    --ziper-surface-muted: #1f2937;
    --ziper-text: #e5e7eb;
    --ziper-text-muted: #9ca3af;
    --ziper-border: #263244;
    --ziper-border-strong: #334155;
    --ziper-primary: #8b83ff;
    --ziper-primary-soft: rgba(139, 131, 255, .14);
    --ziper-shadow: 0 22px 60px rgba(0, 0, 0, .36);
    color-scheme: dark;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: var(--ziper-bg);
    color: var(--ziper-text);
}

html[data-theme="dark"] .dock-target,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .main-layout,
html[data-theme="dark"] #main-content,
html[data-theme="dark"] #main-layout {
    background: var(--ziper-bg);
    color: var(--ziper-text);
}

.ziper-theme-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 1.02rem;
    transition: background-color .15s ease, transform .15s ease, border-color .15s ease;
}

.ziper-theme-toggle:hover {
    background: rgba(255, 255, 255, .18);
    transform: translateY(-1px);
}

.ziper-theme-toggle .theme-icon-light {
    display: none;
}

html[data-theme="dark"] .ziper-theme-toggle .theme-icon-dark {
    display: none;
}

html[data-theme="dark"] .ziper-theme-toggle .theme-icon-light {
    display: inline-block;
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .pageTitle,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small,
html[data-theme="dark"] .form-text {
    color: var(--ziper-text-muted) !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .toast {
    background-color: var(--ziper-surface) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .dropdown-divider {
    background-color: var(--ziper-surface-soft) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .table,
html[data-theme="dark"] table {
    color: var(--ziper-text);
    --bs-table-color: var(--ziper-text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--ziper-border);
    --bs-table-striped-bg: rgba(255, 255, 255, .035);
    --bs-table-hover-bg: rgba(139, 131, 255, .11);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select {
    background-color: var(--ziper-surface-soft);
    color: var(--ziper-text);
    border-color: var(--ziper-border-strong);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] select:focus {
    background-color: #141f33;
    color: var(--ziper-text);
    border-color: var(--ziper-primary);
    box-shadow: 0 0 0 .2rem rgba(139, 131, 255, .18);
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #7c8798;
}

html[data-theme="dark"] .btn-outline-secondary {
    color: var(--ziper-text);
    border-color: var(--ziper-border-strong);
}

html[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--ziper-surface-muted);
    color: var(--ziper-text);
}

html[data-theme="dark"] .bg-light {
    background-color: var(--ziper-surface-soft) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] .border-end {
    border-color: var(--ziper-border) !important;
}

/* Sidebar */
html[data-theme="dark"] #sidebar,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar-container,
html[data-theme="dark"] #menu,
html[data-theme="dark"] #sidebar.e-close {
    background: var(--ziper-surface) !important;
    color: var(--ziper-text);
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] #menu .e-menu-item a,
html[data-theme="dark"] .sidebar-dock-link,
html[data-theme="dark"] .sidebar-dock-icon {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .sidebar-dock-link:hover,
html[data-theme="dark"] #menu .e-menu-item:hover {
    background: var(--ziper-primary-soft) !important;
    color: var(--ziper-primary) !important;
}

html[data-theme="dark"] #sidebar.e-close .profile-wrapper,
html[data-theme="dark"] .profile-wrapper {
    background: var(--ziper-surface-soft);
    border-color: var(--ziper-border);
}

/* Syncfusion Tailwind overrides */
html[data-theme="dark"] .e-control,
html[data-theme="dark"] .e-css,
html[data-theme="dark"] .e-input-group,
html[data-theme="dark"] .e-control-wrapper,
html[data-theme="dark"] .e-float-input,
html[data-theme="dark"] .e-float-input.e-control-wrapper {
    color: var(--ziper-text);
}

html[data-theme="dark"] .e-grid,
html[data-theme="dark"] .e-grid .e-gridheader,
html[data-theme="dark"] .e-grid .e-headercontent,
html[data-theme="dark"] .e-grid .e-content,
html[data-theme="dark"] .e-grid .e-table,
html[data-theme="dark"] .e-grid .e-toolbar,
html[data-theme="dark"] .e-pager,
html[data-theme="dark"] .e-tab,
html[data-theme="dark"] .e-tab .e-content,
html[data-theme="dark"] .e-dialog,
html[data-theme="dark"] .e-dialog .e-dlg-header-content,
html[data-theme="dark"] .e-dropdown-popup,
html[data-theme="dark"] .e-popup,
html[data-theme="dark"] .e-list-parent,
html[data-theme="dark"] .e-menu-wrapper,
html[data-theme="dark"] .e-menu-container {
    background: var(--ziper-surface) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .e-grid .e-headercell,
html[data-theme="dark"] .e-grid .e-rowcell,
html[data-theme="dark"] .e-grid .e-summarycell,
html[data-theme="dark"] .e-grid .e-groupcaption,
html[data-theme="dark"] .e-pager .e-numericitem,
html[data-theme="dark"] .e-pager .e-prevpagedisabled,
html[data-theme="dark"] .e-pager .e-nextpagedisabled,
html[data-theme="dark"] .e-pager .e-prevpage,
html[data-theme="dark"] .e-pager .e-nextpage {
    background: transparent !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .e-grid .e-altrow,
html[data-theme="dark"] .e-grid .e-altrow .e-rowcell {
    background: rgba(255, 255, 255, .025) !important;
}

html[data-theme="dark"] .e-grid .e-row:hover .e-rowcell,
html[data-theme="dark"] .e-list-item.e-hover,
html[data-theme="dark"] .e-list-item:hover,
html[data-theme="dark"] .e-menu-item:hover {
    background: var(--ziper-primary-soft) !important;
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .e-input-group,
html[data-theme="dark"] .e-control-wrapper,
html[data-theme="dark"] .e-float-input,
html[data-theme="dark"] .e-float-input.e-control-wrapper,
html[data-theme="dark"] .e-date-wrapper,
html[data-theme="dark"] .e-ddl,
html[data-theme="dark"] .e-multiselect,
html[data-theme="dark"] .e-combobox {
    background: var(--ziper-surface-soft) !important;
    border-color: var(--ziper-border-strong) !important;
}

html[data-theme="dark"] .e-input-group input.e-input,
html[data-theme="dark"] .e-control-wrapper input.e-input,
html[data-theme="dark"] .e-input,
html[data-theme="dark"] .e-float-text,
html[data-theme="dark"] .e-placeholder,
html[data-theme="dark"] .e-list-item {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .e-input-group .e-input-group-icon,
html[data-theme="dark"] .e-icons,
html[data-theme="dark"] .e-btn.e-flat {
    color: var(--ziper-text-muted) !important;
}

html[data-theme="dark"] .e-btn,
html[data-theme="dark"] .e-css.e-btn {
    background: var(--ziper-surface-soft);
    color: var(--ziper-text);
    border-color: var(--ziper-border-strong);
}

html[data-theme="dark"] .e-btn.e-primary,
html[data-theme="dark"] .e-css.e-btn.e-primary {
    background: var(--ziper-primary);
    color: #fff;
    border-color: var(--ziper-primary);
}

/* Chat, notifications and search */
html[data-theme="dark"] .ziper-chat-panel,
html[data-theme="dark"] .ziper-notifications-panel,
html[data-theme="dark"] .menu-search-container {
    background: var(--ziper-surface);
    color: var(--ziper-text);
    border-color: var(--ziper-border);
    box-shadow: var(--ziper-shadow);
}

html[data-theme="dark"] .ziper-chat-header,
html[data-theme="dark"] .ziper-chat-users,
html[data-theme="dark"] .ziper-chat-room-title,
html[data-theme="dark"] .ziper-notifications-header,
html[data-theme="dark"] .ziper-notifications-actions,
html[data-theme="dark"] .menu-search-header,
html[data-theme="dark"] .menu-search-footer {
    background: var(--ziper-surface-soft);
    border-color: var(--ziper-border);
    color: var(--ziper-text);
}

html[data-theme="dark"] .ziper-chat-user,
html[data-theme="dark"] .ziper-notification-item,
html[data-theme="dark"] .menu-search-item {
    background: var(--ziper-surface);
    color: var(--ziper-text);
    border-color: var(--ziper-border);
}

html[data-theme="dark"] .ziper-chat-user:hover,
html[data-theme="dark"] .ziper-chat-user.active,
html[data-theme="dark"] .ziper-notification-item:hover,
html[data-theme="dark"] .ziper-notification-item.unread,
html[data-theme="dark"] .menu-search-item:hover,
html[data-theme="dark"] .menu-search-item.highlighted {
    background: var(--ziper-primary-soft);
}

html[data-theme="dark"] .ziper-chat-input,
html[data-theme="dark"] .ziper-chat-search input,
html[data-theme="dark"] .menu-search-input {
    background: var(--ziper-surface-soft);
    color: var(--ziper-text);
    border-color: var(--ziper-border-strong);
}

html[data-theme="dark"] .ziper-notifications-header strong,
html[data-theme="dark"] .ziper-notification-content strong,
html[data-theme="dark"] .ziper-chat-header strong,
html[data-theme="dark"] .ziper-chat-room-title,
html[data-theme="dark"] .menu-search-item-title {
    color: var(--ziper-text);
}

html[data-theme="dark"] .ziper-notifications-header span,
html[data-theme="dark"] .ziper-notification-content span,
html[data-theme="dark"] .ziper-notification-content small,
html[data-theme="dark"] .ziper-chat-header span,
html[data-theme="dark"] .ziper-chat-empty,
html[data-theme="dark"] .ziper-chat-room-empty,
html[data-theme="dark"] .menu-search-empty,
html[data-theme="dark"] .menu-search-item-path,
html[data-theme="dark"] .menu-search-shortcut {
    color: var(--ziper-text-muted);
}

html[data-theme="dark"] .swal2-popup {
    background: var(--ziper-surface);
    color: var(--ziper-text);
}

html[data-theme="dark"] .swal2-title {
    color: var(--ziper-text);
}

html[data-theme="dark"] .swal2-html-container {
    color: var(--ziper-text-muted);
}

/* Dashboard */
html[data-theme="dark"] .dashboard-tab-content,
html[data-theme="dark"] .Dashboard-card,
html[data-theme="dark"] .filter-section,
html[data-theme="dark"] .sub-limit-card,
html[data-theme="dark"] .sub-cost-badge,
html[data-theme="dark"] .activity-item {
    background: var(--ziper-surface) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .22) !important;
}

html[data-theme="dark"] .filter-section,
html[data-theme="dark"] .sub-limit-card,
html[data-theme="dark"] .activity-item.bg-light {
    background: var(--ziper-surface-soft) !important;
}

html[data-theme="dark"] .dashboard-tabs {
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .dashboard-tabs .nav-link {
    color: var(--ziper-text-muted) !important;
    border-color: transparent !important;
}

html[data-theme="dark"] .dashboard-tabs .nav-link:hover {
    background: var(--ziper-primary-soft) !important;
    color: var(--ziper-primary) !important;
}

html[data-theme="dark"] .dashboard-tabs .nav-link.active {
    background: var(--ziper-surface) !important;
    color: var(--ziper-primary) !important;
    border-color: var(--ziper-border) var(--ziper-border) var(--ziper-surface) !important;
}

html[data-theme="dark"] .Dashboard-title,
html[data-theme="dark"] .Dashboard-card h5,
html[data-theme="dark"] .metric-card h5,
html[data-theme="dark"] .sub-limit-card .limit-value {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .quick-actions-label,
html[data-theme="dark"] .Dashboard-card .text-muted,
html[data-theme="dark"] .metric-card small,
html[data-theme="dark"] .sub-limit-card .limit-title,
html[data-theme="dark"] .sub-cost-badge .cost-label {
    color: var(--ziper-text-muted) !important;
}

html[data-theme="dark"] .shimmer {
    background: linear-gradient(90deg, #1f2937 25%, #273449 50%, #1f2937 75%) !important;
    background-size: 200% 100% !important;
}

html[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, .16) !important;
    border-color: rgba(245, 158, 11, .42) !important;
    color: #fbbf24 !important;
}

html[data-theme="dark"] .alert-info {
    background: rgba(14, 165, 233, .16) !important;
    border-color: rgba(14, 165, 233, .42) !important;
    color: #67e8f9 !important;
}

/* Products */
html[data-theme="dark"] .Product-page,
html[data-theme="dark"] .Product-main,
html[data-theme="dark"] .Product-grid-scroll {
    background: var(--ziper-bg) !important;
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .Product-sidebar,
html[data-theme="dark"] .Product-sticky-header,
html[data-theme="dark"] .Product-card {
    background: var(--ziper-surface) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .Product-card {
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
}

html[data-theme="dark"] .Product-card:hover {
    box-shadow: 0 18px 42px rgba(0, 0, 0, .32) !important;
}

html[data-theme="dark"] .Product-active-filter,
html[data-theme="dark"] .Product-sticky-header {
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .Product-page-label,
html[data-theme="dark"] .Product-title,
html[data-theme="dark"] .Product-category,
html[data-theme="dark"] .Product-card strong {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .Product-count,
html[data-theme="dark"] .Product-load-more,
html[data-theme="dark"] .Product-end-message,
html[data-theme="dark"] .Product-card .text-muted {
    color: var(--ziper-text-muted) !important;
}

html[data-theme="dark"] .Product-chip {
    background: var(--ziper-surface-muted) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border-strong) !important;
}

html[data-theme="dark"] .Product-chip.active-products {
    background: #0d6efd !important;
    color: #fff !important;
    border-color: #0d6efd !important;
}

html[data-theme="dark"] .Product-chip.active-advertising {
    background: #fd7e14 !important;
    color: #fff !important;
    border-color: #fd7e14 !important;
}

html[data-theme="dark"] .Product-image-wrapper {
    background: #fff !important;
}

html[data-theme="dark"] .Product-image-loader {
    background: linear-gradient(90deg, #e5e7eb 0%, #f8fafc 50%, #e5e7eb 100%) !important;
}

html[data-theme="dark"] .Product-category.active,
html[data-theme="dark"] .Product-category:hover {
    color: var(--ziper-primary) !important;
}

/* Consumers */
html[data-theme="dark"] .consumers-management-container,
html[data-theme="dark"] .consumers-grid-container,
html[data-theme="dark"] .consumer-main-modal,
html[data-theme="dark"] .consumer-sidebar-modal,
html[data-theme="dark"] .consumer-wrapper-modal,
html[data-theme="dark"] .history-grid-card {
    background: var(--ziper-surface) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .consumer-stat-item,
html[data-theme="dark"] .consumer-info-card,
html[data-theme="dark"] .consumer-info-section,
html[data-theme="dark"] .consumer-redeem-section,
html[data-theme="dark"] .consumer-points-section {
    background: var(--ziper-surface-soft) !important;
    color: var(--ziper-text) !important;
    border-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .consumer-name,
html[data-theme="dark"] .consumer-document,
html[data-theme="dark"] .consumer-email,
html[data-theme="dark"] .consumer-phone,
html[data-theme="dark"] .consumer-address,
html[data-theme="dark"] .consumer-date-cell,
html[data-theme="dark"] .consumer-stat-value {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .consumer-stat-label,
html[data-theme="dark"] .consumers-management-container .text-muted {
    color: var(--ziper-text-muted) !important;
}

/* Login and account pages */
html[data-theme="dark"] .ziper-login-container,
html[data-theme="dark"] .ziper-form-section {
    background: var(--ziper-bg) !important;
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .ziper-image-section {
    background: var(--ziper-surface) !important;
    border-right-color: var(--ziper-border) !important;
}

html[data-theme="dark"] .form-container,
html[data-theme="dark"] .UserLogin-card,
html[data-theme="dark"] .password-requirements {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .login-title,
html[data-theme="dark"] .UserLogin-title,
html[data-theme="dark"] .UserLogin-label,
html[data-theme="dark"] .ziper-login-container .form-label,
html[data-theme="dark"] .ziper-login-container .form-check-label {
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .login-subtitle,
html[data-theme="dark"] .input-icon,
html[data-theme="dark"] .UserLogin-input-icon {
    color: var(--ziper-text-muted) !important;
}

html[data-theme="dark"] .ziper-login-container .form-control,
html[data-theme="dark"] .UserLogin-input-group .form-control {
    background: var(--ziper-surface-soft) !important;
    border-color: var(--ziper-border-strong) !important;
    color: var(--ziper-text) !important;
}

html[data-theme="dark"] .ziper-login-container .form-control::placeholder,
html[data-theme="dark"] .UserLogin-input-group .form-control::placeholder {
    color: var(--ziper-text-muted) !important;
}

html[data-theme="dark"] .UserLogin-card,
html[data-theme="dark"] .password-requirements {
    background: var(--ziper-surface) !important;
    border-color: var(--ziper-border) !important;
    box-shadow: var(--ziper-shadow) !important;
}

html[data-theme="dark"] .UserLogin-divider::before {
    background: var(--ziper-border) !important;
}

html[data-theme="dark"] .UserLogin-divider span {
    background: var(--ziper-surface) !important;
    color: var(--ziper-text-muted) !important;
}
