/**
 * Admin light / dark theme — shell tokens + light-mode fixes.
 * Load after gm-brand-overrides.css. Requires data-bs-theme on <html> (Metronic KTThemeMode).
 */

:root,
[data-bs-theme="dark"] {
  --kp-shell-bg: #14140f;
  --kp-shell-text: #f2f2f7;
  --kp-shell-card: #1c1c17;
  --kp-shell-border: rgba(242, 242, 247, 0.12);
  --kp-shell-muted: rgba(242, 242, 247, 0.72);
  --kp-shell-input-bg: #1c1c17;
  --kp-shell-table-head: rgba(28, 28, 23, 0.92);
  --kp-gold-tint: rgba(255, 90, 54, 0.12);
  --kp-btn-ghost-bg: rgba(28, 28, 23, 0.85);

  --kp-foreground: #f2f2f7;
  --kp-muted-foreground: rgba(242, 242, 247, 0.72);
  --kp-label-foreground: rgba(242, 242, 247, 0.62);
  --kp-pill-foreground: rgba(242, 242, 247, 0.92);
}

[data-bs-theme="light"] {
  --kp-shell-bg: #f2f2f7;
  --kp-shell-text: #14140f;
  --kp-shell-card: #ffffff;
  --kp-shell-border: rgba(20, 20, 15, 0.12);
  --kp-shell-muted: rgba(20, 20, 15, 0.62);
  --kp-shell-input-bg: #ffffff;
  --kp-shell-table-head: #eaeaef;
  --kp-gold-tint: rgba(255, 90, 54, 0.14);
  --kp-btn-ghost-bg: #ffffff;

  /* Map legacy --kp-* tokens used by merchant portal components */
  --kp-card: var(--kp-shell-card);
  --kp-border: var(--kp-shell-border);
  --kp-foreground: var(--kp-shell-text);
  --kp-muted-foreground: var(--kp-shell-muted);
  --kp-label-foreground: rgba(20, 20, 15, 0.55);
  --kp-pill-foreground: rgba(20, 20, 15, 0.88);

  --bs-body-bg: var(--kp-shell-bg);
  --bs-body-color: var(--kp-shell-text);
  --bs-body-bg-rgb: 242, 242, 247;
  --bs-body-color-rgb: 20, 20, 15;
  --bs-secondary-bg: var(--kp-shell-card);
  --bs-tertiary-bg: #eaeaef;
  --bs-heading-color: #14140f;
  --bs-border-color: var(--kp-shell-border);
  --bs-emphasis-color: #14140f;
}

/* Map legacy brand vars to shell (both themes) */
[data-bs-theme="light"] body#kt_app_body.app-default,
[data-bs-theme="light"] body.app-default,
[data-bs-theme="light"] .app-root,
[data-bs-theme="light"] #kt_app_root,
[data-bs-theme="light"] #kt_app_wrapper,
[data-bs-theme="light"] #kt_app_main,
[data-bs-theme="light"] #kt_app_content,
[data-bs-theme="light"] #kt_app_content_container,
[data-bs-theme="light"] .app-content.flex-column-fluid {
  background-color: var(--kp-shell-bg) !important;
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .app-header,
[data-bs-theme="light"] #kt_app_header,
[data-bs-theme="light"] .app-sidebar,
[data-bs-theme="light"] #kt_app_sidebar,
[data-bs-theme="light"] .app-footer,
[data-bs-theme="light"] #kt_app_footer {
  background-color: var(--kp-shell-bg) !important;
  border-color: var(--kp-shell-border) !important;
}

[data-bs-theme="light"] .app-sidebar .menu .menu-item .menu-link {
  color: rgba(26, 26, 23, 0.88);
}

[data-bs-theme="light"] .app-sidebar .menu .menu-item .menu-link:hover,
[data-bs-theme="light"] .app-sidebar .menu .menu-item .menu-link.active {
  color: var(--kp-gold) !important;
}

[data-bs-theme="light"] .card {
  background-color: var(--kp-shell-card);
  border-color: var(--kp-shell-border);
  color: var(--kp-shell-text);
  box-shadow: 0 1px 3px rgba(20, 20, 15, 0.06) !important;
}

[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-control.form-control-solid,
[data-bs-theme="light"] .form-select,
[data-bs-theme="light"] .form-select.form-select-solid,
[data-bs-theme="light"] textarea.form-control {
  background-color: var(--kp-shell-input-bg) !important;
  border-color: var(--kp-shell-border) !important;
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .form-control::placeholder,
[data-bs-theme="light"] .form-control.form-control-solid::placeholder {
  color: var(--kp-shell-muted) !important;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-control.form-control-solid:focus,
[data-bs-theme="light"] .form-control.form-control-solid:active,
[data-bs-theme="light"] .form-select:focus,
[data-bs-theme="light"] .form-select.form-select-solid:focus {
  background-color: var(--kp-shell-input-bg) !important;
  border-color: var(--kp-gold) !important;
  color: var(--kp-shell-text) !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 90, 54, 0.15) !important;
}

[data-bs-theme="light"] .input-group-text {
  background-color: #eaeaef !important;
  border-color: var(--kp-shell-border) !important;
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] label.form-label,
[data-bs-theme="light"] .form-label {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .table {
  --bs-table-color: var(--kp-shell-text);
  --bs-table-border-color: var(--kp-shell-border);
}

[data-bs-theme="light"] .modal-content,
[data-bs-theme="light"] .dropdown-menu {
  background-color: var(--kp-shell-card);
  border-color: var(--kp-shell-border);
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .dropdown-item {
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .app-toolbar .text-gray-700,
[data-bs-theme="light"] .app-toolbar .text-gray-800,
[data-bs-theme="light"] .app-toolbar .text-gray-900,
[data-bs-theme="light"] .app-toolbar .text-dark,
[data-bs-theme="light"] .page-heading.text-dark {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .app-toolbar .text-gray-500,
[data-bs-theme="light"] .app-toolbar .text-gray-600,
[data-bs-theme="light"] .app-toolbar .text-muted,
[data-bs-theme="light"] .breadcrumb .text-gray-400,
[data-bs-theme="light"] .breadcrumb .text-gray-500,
[data-bs-theme="light"] .breadcrumb .text-gray-700 {
  color: var(--kp-shell-muted) !important;
}

[data-bs-theme="light"] #kt_app_content_container .table tbody.text-gray-600,
[data-bs-theme="light"] #kt_app_content_container .table .text-gray-600 {
  color: var(--kp-shell-muted) !important;
}

[data-bs-theme="light"] #kt_app_content_container .table .text-gray-800,
[data-bs-theme="light"] #kt_app_content_container .table .fw-bolder.text-gray-800 {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .btn.btn-light {
  --bs-btn-color: var(--kp-shell-text);
  --bs-btn-bg: var(--kp-btn-ghost-bg);
  --bs-btn-border-color: var(--kp-shell-border);
}

[data-bs-theme="light"] .table thead.bg-light,
[data-bs-theme="light"] .table thead.table-light {
  --bs-table-bg: var(--kp-shell-table-head);
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .bg-gray-100.bg-opacity-70 {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border: 1px solid var(--kp-shell-border) !important;
}

[data-bs-theme="light"] #kt_app_content .bg-gray-100 .text-gray-500,
[data-bs-theme="light"] #kt_app_content .bg-gray-100 .text-gray-600,
[data-bs-theme="light"] #kt_app_content .bg-gray-100 .text-gray-700 {
  color: var(--kp-shell-muted) !important;
}

[data-bs-theme="light"] #kt_app_content .bg-gray-100 .fw-bolder.fs-2qx,
[data-bs-theme="light"] #kt_app_content .bg-gray-100 .fw-bolder.fs-2,
[data-bs-theme="light"] #kt_app_content .bg-gray-100 .text-gray-800 {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] #kt_app_content .bg-gray-100 .fw-bolder.fs-2qx.text-primary,
[data-bs-theme="light"] #kt_app_content .bg-gray-100 .fw-bolder.fs-2.text-primary {
  color: var(--kp-gold) !important;
}

[data-bs-theme="light"] #kt_customers_table .badge.badge-light,
[data-bs-theme="light"] #kt_customers_table .badge.badge-light.text-gray-800 {
  background-color: #fff !important;
  border: 1px solid var(--kp-shell-border) !important;
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] #kt_customers_table .badge-light-success,
[data-bs-theme="light"] #kt_customers_table .badge-light-warning,
[data-bs-theme="light"] #kt_customers_table .badge-light-primary,
[data-bs-theme="light"] #kt_customers_table .badge-light-info {
  background-color: var(--kp-gold-tint) !important;
  color: #7a5a18 !important;
}

[data-bs-theme="light"] .kp-mono-status {
  color: #5c4a1e !important;
  background: var(--kp-gold-tint) !important;
}

[data-bs-theme="light"] .text-success {
  color: var(--kp-forest, #1f6d5a) !important;
}

[data-bs-theme="light"] .text-danger,
[data-bs-theme="light"] .text-warning,
[data-bs-theme="light"] .text-info {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] #kt_app_header .btn-icon:not(.btn-primary) i,
[data-bs-theme="light"] #kt_app_header .btn-icon:not(.btn-primary) .ki-duotone {
  color: rgba(26, 26, 23, 0.75) !important;
}

[data-bs-theme="light"] .gm-brand-gradient-bg {
  color: var(--kp-btn-text) !important;
}

[data-bs-theme="light"] .app-header-separator {
  border-color: var(--kp-shell-border) !important;
}

/* Theme switcher menu */
[data-kt-element="theme-mode-menu"] .menu-link.active {
  background-color: var(--kp-gold-tint) !important;
  color: var(--kp-gold) !important;
}

/* Merchant portal + organizer dashboard (light) */
[data-bs-theme="light"] .org-dash-kore,
[data-bs-theme="light"] .merchant-portal {
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .org-dash-kore .app-content,
[data-bs-theme="light"] .merchant-portal .app-content,
[data-bs-theme="light"] .org-dash-kore .app-container,
[data-bs-theme="light"] .merchant-portal .app-container {
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .org-dash-kore .text-gray-900,
[data-bs-theme="light"] .org-dash-kore .text-gray-800,
[data-bs-theme="light"] .org-dash-kore .text-dark,
[data-bs-theme="light"] .merchant-portal .text-gray-900,
[data-bs-theme="light"] .merchant-portal .text-gray-800,
[data-bs-theme="light"] .merchant-portal .text-dark,
[data-bs-theme="light"] .org-dash-kore .card-title,
[data-bs-theme="light"] .merchant-portal .card-title {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .org-dash-kore .text-gray-700,
[data-bs-theme="light"] .org-dash-kore .text-gray-600,
[data-bs-theme="light"] .org-dash-kore .text-gray-500,
[data-bs-theme="light"] .org-dash-kore .text-muted,
[data-bs-theme="light"] .merchant-portal .text-gray-700,
[data-bs-theme="light"] .merchant-portal .text-gray-600,
[data-bs-theme="light"] .merchant-portal .text-gray-500,
[data-bs-theme="light"] .merchant-portal .text-muted {
  color: var(--kp-shell-muted) !important;
}

[data-bs-theme="light"] .org-dash-kore .summary-card,
[data-bs-theme="light"] .merchant-portal .summary-card,
[data-bs-theme="light"] .org-dash-kore .card.summary-card,
[data-bs-theme="light"] .merchant-portal .card.summary-card {
  background: var(--kp-shell-card) !important;
  border-color: var(--kp-shell-border) !important;
  color: var(--kp-shell-text);
  box-shadow: 0 1px 3px rgba(20, 20, 15, 0.06);
}

[data-bs-theme="light"] .org-dash-kore .summary-card .metric-label,
[data-bs-theme="light"] .merchant-portal .summary-card .metric-label {
  color: var(--kp-label-foreground) !important;
}

[data-bs-theme="light"] .org-dash-kore .summary-card .metric-subtle,
[data-bs-theme="light"] .merchant-portal .summary-card .metric-subtle {
  color: var(--kp-muted-foreground) !important;
}

[data-bs-theme="light"] .org-dash-kore .metric-pill,
[data-bs-theme="light"] .merchant-portal .metric-pill {
  color: var(--kp-pill-foreground);
  background: var(--kp-gold-tint);
  border-color: var(--kp-shell-border);
}

[data-bs-theme="light"] .org-dash-kore .metric-pill .fw-bold,
[data-bs-theme="light"] .merchant-portal .metric-pill .fw-bold {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .org-dash-kore .kp-pill-tag,
[data-bs-theme="light"] .merchant-portal .kp-pill-tag {
  color: var(--kp-pill-foreground);
  background: var(--kp-gold-tint);
  border-color: var(--kp-shell-border);
}

[data-bs-theme="light"] .merchant-action-tile {
  background: var(--kp-shell-card);
  border-color: var(--kp-shell-border);
  color: var(--kp-shell-text);
  box-shadow: 0 1px 3px rgba(20, 20, 15, 0.05);
}

[data-bs-theme="light"] .merchant-action-tile__label {
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .merchant-action-tile__desc {
  color: var(--kp-shell-muted);
}

[data-bs-theme="light"] .merchant-badge-category {
  color: var(--kp-pill-foreground);
  background: var(--kp-gold-tint);
  border-color: var(--kp-shell-border);
}

[data-bs-theme="light"] .org-dash-kore .card:not(.summary-card),
[data-bs-theme="light"] .merchant-portal .card:not(.summary-card) {
  background-color: var(--kp-shell-card) !important;
  border-color: var(--kp-shell-border) !important;
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .org-dash-kore .form-control,
[data-bs-theme="light"] .org-dash-kore .form-select,
[data-bs-theme="light"] .merchant-portal .form-control,
[data-bs-theme="light"] .merchant-portal .form-select {
  background-color: var(--kp-shell-input-bg) !important;
  border-color: var(--kp-shell-border) !important;
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .org-dash-kore .form-label,
[data-bs-theme="light"] .merchant-portal .form-label {
  color: var(--kp-shell-text) !important;
}

[data-bs-theme="light"] .merchant-upgrade-banner {
  background: var(--kp-gold-tint);
}

[data-bs-theme="light"] .merchant-upgrade-banner__title {
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .merchant-upgrade-banner__text {
  color: var(--kp-shell-muted);
}

[data-bs-theme="light"] .org-dash-kore .slot-card-option,
[data-bs-theme="light"] .merchant-portal .slot-card-option {
  background: var(--kp-shell-card);
  border-color: var(--kp-shell-border);
}

[data-bs-theme="light"] .org-dash-kore .slot-card-option.active,
[data-bs-theme="light"] .merchant-portal .slot-card-option.active {
  background: var(--kp-gold-tint);
  border-color: var(--kp-gold);
}

[data-bs-theme="light"] .org-dash-kore .slot-summary-card,
[data-bs-theme="light"] .merchant-portal .slot-summary-card {
  background: var(--kp-shell-card);
  color: var(--kp-shell-text);
}

[data-bs-theme="light"] .org-dash-kore .order-card,
[data-bs-theme="light"] .merchant-portal .order-card {
  background: var(--kp-shell-card);
  border-color: var(--kp-shell-border);
}

/* Sign-in pages: see gm-auth-signin.css */
