/* =====================================================================
   Sohar Zakat — Dashboard Brand Theme (override layer)
   Loaded AFTER style.bundle.css + app.css so it wins the cascade.
   DO NOT edit style.bundle.css (generated Metronic). All brand
   customisation lives here.

   Palette:
     primary (green)      #509d37   rgb(80, 157, 55)
     primary active/hover #3E7D2A   rgb(62, 125, 42)
     primary light tint   #EEF6EC
     accent (orange)      #fd7335   rgb(254, 115, 54)
   Font: Cairo (Arabic)
   ===================================================================== */

/* ---------- 1) Brand colour variables (cascades to all var-based UI) ---------- */
:root,
:root[data-bs-theme="light"],
[data-theme="light"] {
  --bs-primary: #509d37;
  --bs-primary-rgb: 80, 156, 53;
  --bs-link-color: #509d37;
  --bs-link-color-rgb: 80, 156, 53;
  --bs-link-hover-color: #3E7D2A;

  --kt-primary: #509d37;
  --kt-primary-rgb: 80, 156, 53;
  --kt-primary-active: #3E7D2A;
  --kt-primary-light: #EEF6EC;
  --kt-primary-inverse: #ffffff;

  /* orange accent mapped onto Metronic "warning" so btn/badge-warning = brand orange */
  --bs-warning: #fd7335;
  --bs-warning-rgb: 254, 115, 54;
  --kt-warning: #fd7335;
  --kt-warning-active: #e25e22;
  --kt-warning-light: #FFF1EB;
  --kt-warning-inverse: #ffffff;
}

/* ---------- Logo Sizing ---------- */
.header-brand img {
  height: 48px !important;
  max-height: 52px !important;
  width: auto;
  object-fit: contain;
}
.auth-logo {
  height: 110px !important;
  max-height: 130px !important;
  width: auto;
  object-fit: contain;
}

[data-bs-theme="dark"],
[data-theme="dark"] {
  --bs-primary: #66b847;
  --bs-primary-rgb: 102, 184, 71;
  --bs-link-color: #7fc864;
  --bs-link-hover-color: #98d880;

  --kt-primary: #66b847;
  --kt-primary-active: #54a138;
  --kt-primary-light: #1E2A20;
  --kt-primary-inverse: #ffffff;

  --kt-warning: #fd7335;
  --kt-warning-active: #e25e22;
  --kt-warning-light: #2c2118;
}

/* ---------- 2) Direct overrides for the few hard-coded blue selectors ---------- */
/* Solid primary button */
.btn.btn-primary,
.btn-primary {
  background-color: #509d37;
  border-color: #509d37;
  color: #fff;
}
.btn.btn-primary:hover:not(.btn-active),
.btn.btn-primary:focus:not(.btn-active),
.btn.btn-primary:active:not(.btn-active),
.btn.btn-primary.active,
.btn.btn-primary.show,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: #3E7D2A !important;
  border-color: #3E7D2A !important;
  color: #fff !important;
}
.btn.btn-primary:disabled,
.btn.btn-primary.disabled {
  background-color: #509d37;
  border-color: #509d37;
  opacity: .65;
}

/* Outline primary */
.btn.btn-outline-primary,
.btn-outline-primary {
  color: #509d37;
  border-color: #509d37;
}
.btn.btn-outline-primary:hover,
.btn.btn-outline-primary:focus,
.btn.btn-outline-primary:active,
.btn-outline-primary:hover {
  background-color: #509d37 !important;
  border-color: #509d37 !important;
  color: #fff !important;
}

/* Links */
.btn.btn-link,
.btn-link,
.link-primary {
  color: #509d37;
}
.btn.btn-link:hover,
.link-primary:hover,
.link-primary:focus {
  color: #3E7D2A;
}

/* Form controls (checkbox / radio / switch / range) */
.form-check-input:checked {
  background-color: #509d37;
  border-color: #509d37;
}
.form-check-input[type="checkbox"]:indeterminate {
  background-color: #509d37;
  border-color: #509d37;
}
.form-range::-webkit-slider-thumb { background-color: #509d37; }
.form-range::-moz-range-thumb { background-color: #509d37; }
.form-control:focus,
.form-select:focus {
  border-color: #8bc676;
  box-shadow: 0 0 0 .25rem rgba(80, 157, 55, .15);
}

/* Pagination / breadcrumb active */
.pagination .page-item.active .page-link,
.page-link.active {
  background-color: #509d37;
  border-color: #509d37;
  color: #fff;
}
.page-link { color: #509d37; }

/* Select2 (used across all forms) */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--selected {
  background-color: #509d37 !important;
  color: #fff !important;
}
.select2-container--default.select2-container--focus .select2-selection,
.select2-container--default .select2-selection--single:focus {
  border-color: #8bc676 !important;
}

/* ---------- 3) Typography — Cairo (Arabic) ---------- */
:root {
  --bs-font-sans-serif: "Cairo", "Segoe UI", Tahoma, sans-serif;
}
body,
button,
input,
select,
textarea,
.btn,
.menu,
.menu-link,
.form-control,
.form-select,
table,
.table,
h1, h2, h3, h4, h5, h6,
.fw-bold, .fw-bolder, .fw-semibold {
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif !important;
}
body { letter-spacing: 0; }

/* =====================================================================
   PHASE 3 — Shell polish (aside / header / cards)
   ===================================================================== */

/* ---------- Sidebar (aside): deep-green branded panel ---------- */
.aside {
  background-color: #316420 !important;
  background-image: linear-gradient(180deg, #3B7527 0%, #2A561C 100%) !important;
  box-shadow: 0 0 24px rgba(0, 0, 0, .18);
}

/* --- default state: link + title + icon (target .menu-title explicitly) --- */
.aside .menu .menu-item .menu-link {
  color: #DCE5DD !important;
  border-radius: 9px;
}
.aside .menu .menu-item .menu-link .menu-title {
  color: #DCE5DD !important;
}
.aside .menu .menu-item .menu-link .menu-icon .svg-icon,
.aside .menu .menu-item .menu-link .menu-icon i,
.aside .menu .menu-item .menu-link .menu-bullet .bullet {
  color: rgba(255, 255, 255, .62) !important;
}
.aside .menu .menu-item .menu-link .menu-arrow:after {
  opacity: .5;
}

/* --- hover --- */
.aside .menu .menu-item .menu-link:hover {
  background-color: rgba(255, 255, 255, .08) !important;
}
.aside .menu .menu-item .menu-link:hover,
.aside .menu .menu-item .menu-link:hover .menu-title {
  color: #ffffff !important;
}
.aside .menu .menu-item .menu-link:hover .menu-icon .svg-icon,
.aside .menu .menu-item .menu-link:hover .menu-icon i {
  color: #ffffff !important;
}

/* --- active / expanded (harmonious translucent orange accent) --- */
.aside .menu .menu-item .menu-link.active,
.aside .menu .menu-item.here > .menu-link,
.aside .menu .menu-item.show > .menu-link {
  background-color: rgba(253, 115, 53, .14) !important;
  box-shadow: inset 3px 0 0 #fd7335;
}
.aside .menu .menu-item .menu-link.active .menu-title,
.aside .menu .menu-item.here > .menu-link .menu-title,
.aside .menu .menu-item.show > .menu-link .menu-title {
  color: #ffffff !important;
  font-weight: 700 !important;
}
.aside .menu .menu-item .menu-link.active .menu-icon .svg-icon,
.aside .menu .menu-item .menu-link.active .menu-icon i,
.aside .menu .menu-item.here > .menu-link .menu-icon .svg-icon {
  color: #fd7335 !important; /* orange icon on active */
}

/* --- section captions (e.g. "الوصول") --- */
.aside .menu .menu-heading {
  color: rgba(255, 255, 255, .48) !important;
  letter-spacing: .04em;
}

/* --- sub-menu (accordion) links --- */
.aside .menu .menu-sub .menu-item .menu-link .menu-title {
  color: #C6D2C7 !important;
}

/* --- aside footer (user card + logout) --- */
.aside .aside-footer .text-gray-800 {
  color: #ffffff !important;
}
.aside .aside-footer .text-muted {
  color: rgba(255, 255, 255, .60) !important;
}
.aside .aside-footer .symbol img {
  border: 2px solid rgba(255, 255, 255, .22);
  object-fit: cover;
}
.aside .aside-footer .btn.btn-icon {
  color: rgba(255, 255, 255, .7);
}
.aside .aside-footer .btn.btn-icon:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, .08);
}

/* --- aside scrollbar --- */
.aside .hover-scroll-overlay-y {
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.aside .hover-scroll-overlay-y::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, .2);
}

/* ---------- Header ---------- */
.header.header-bg,
.header {
  background-color: #ffffff;
  border-bottom: 1px solid #eef0ee;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .04);
}

/* ---------- Cards: softer, rounder, borderless ---------- */
.card {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .05);
}
.card .card-header {
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

/* ---------- Misc polish ---------- */
.btn { border-radius: 9px; }
.badge { border-radius: 7px; }
.modal-content { border: 0; border-radius: 16px; }
.form-control, .form-select { border-radius: 9px; }
/* DataTables search/length inputs + pagination tidy */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #509d37 !important;
  border-color: #509d37 !important;
  color: #fff !important;
  border-radius: 7px;
}

/* =====================================================================
   PHASE 4 — Component consistency
   ===================================================================== */

/* Breadcrumb — active link in brand green */
.breadcrumb .breadcrumb-item a:hover {
  color: #509d37;
}
.breadcrumb .breadcrumb-item.active {
  color: #509d37;
}

/* Tables — calmer header, hover rows */
.table thead th,
.table.table-row-dashed thead th {
  color: #6b7d6e;
  font-weight: 700;
}
.table > tbody > tr:hover > * {
  background-color: #f6f9f6;
}

/* Alerts (brand tints) */
.alert-primary {
  background-color: #EEF6EC;
  border-color: #cfe0d2;
  color: #3E7D2A;
}

/* SweetAlert popup */
.swal2-popup {
  border-radius: 16px;
  font-family: "Cairo", sans-serif;
}
.swal2-styled.swal2-confirm {
  background-color: #509d37 !important;
}
.swal2-styled.swal2-confirm:focus {
  box-shadow: 0 0 0 3px rgba(80, 157, 55, .35) !important;
}

/* Symbol / avatar tints that use light-primary */
.symbol.symbol-light-primary .symbol-label {
  background-color: #EEF6EC;
  color: #509d37;
}

/* Progress bars */
.progress-bar { background-color: #509d37; }

/* Tabs / nav-line-tabs active */
.nav-line-tabs .nav-item .nav-link.active,
.nav-line-tabs .nav-item .nav-link:hover:not(.disabled) {
  border-bottom-color: #509d37;
  color: #509d37;
}

/* =====================================================================
   PHASE 5 — Dashboard home (stat cards + report table)
   ===================================================================== */
.home-dashboard-card-container {
  background-color: #ffffff !important;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .05);
  padding: 22px !important;
  justify-content: space-between !important;
  border-inline-end: 4px solid #509d37;
  min-height: 120px;
}
.home-dashboard-card-container .card-title {
  color: #6b7d6e !important;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.home-dashboard-card-container .card-text {
  color: #1f2a21 !important;
  font-size: 26px;
  font-weight: 800;
  margin: 0;
}
.home-dashboard-card-container i {
  color: #509d37 !important;
  background: #EEF6EC;
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem !important;
}
/* report table wrapper as a clean white card */
.table-container-home,
.home-table-dashboard {
  background-color: #ffffff !important;
}
.table-container-home {
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .05);
  padding: 8px;
}
.home-table-dashboard thead th {
  background-color: #3E7D2A !important;
  color: #fff !important;
  border-color: #3E7D2A !important;
}

/* =====================================================================
   RTL / LTR LAYOUT & DIRECTION FIX
   Scope side navigation and layout shell based on [dir="rtl"] / [dir="ltr"]
   ===================================================================== */

/* --- RTL (Arabic) --- */
@media (min-width: 992px) {
  html[dir="rtl"] .aside {
    left: auto !important;
    right: 30px !important;
  }
  html[dir="rtl"] .wrapper {
    padding-left: 0 !important;
    padding-right: 330px !important;
    transition: padding-right .3s ease;
  }
  html[dir="rtl"] .header-fixed .header {
    right: 0;
    left: 0;
  }
}

@media (max-width: 991.98px) {
  html[dir="rtl"] .aside {
    left: auto !important;
    right: 0 !important;
    transform: translateX(100%) !important;
  }
  html[dir="rtl"] .aside.drawer-on {
    transform: translateX(0) !important;
  }
}

/* --- LTR (English) --- */
@media (min-width: 992px) {
  html[dir="ltr"] .aside {
    left: 30px !important;
    right: auto !important;
  }
  html[dir="ltr"] .wrapper {
    padding-left: 330px !important;
    padding-right: 0 !important;
    transition: padding-left .3s ease;
  }
  html[dir="ltr"] .header-fixed .header {
    left: 0;
    right: 0;
  }
}

@media (max-width: 991.98px) {
  html[dir="ltr"] .aside {
    right: auto !important;
    left: 0 !important;
    transform: translateX(-100%) !important;
  }
  html[dir="ltr"] .aside.drawer-on {
    transform: translateX(0) !important;
  }
}

/* LTR component alignment adjustments */
html[dir="ltr"] .home-dashboard-card-container {
  border-inline-end: none;
  border-inline-start: 4px solid #509d37;
}
html[dir="ltr"] .text-start {
  text-align: left !important;
}
html[dir="ltr"] .text-end {
  text-align: right !important;
}
html[dir="ltr"] [data-kt-docs-table-filter="search"] {
  padding-left: 3.5rem !important;
  padding-right: 1rem !important;
}
html[dir="rtl"] [data-kt-docs-table-filter="search"] {
  padding-right: 3.5rem !important;
  padding-left: 1rem !important;
}
html[dir="ltr"] .ps-14 {
  padding-left: 3.5rem !important;
}
html[dir="rtl"] .ps-14 {
  padding-right: 3.5rem !important;
}

/* =====================================================================
   DARK MODE FIXES
   The brand overrides above hard-code a few LIGHT surfaces (white cards,
   white table wrappers, light hovers/alerts). Those light rules are left
   UNTOUCHED so light mode is unaffected; here we add matching dark-mode
   surfaces. Scoped to BOTH attributes Metronic may use ([data-theme] is
   what the CSS bundle keys on; [data-bs-theme] is what the toggle sets).
   ===================================================================== */

/* Header (defensive — also keeps a subtle brand border in dark) */
[data-theme="dark"] .header,
[data-bs-theme="dark"] .header {
  background-color: #1e1e2d !important;
  border-bottom: 1px solid rgba(255, 255, 255, .06) !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .35) !important;
}

/* Home dashboard stat cards */
[data-theme="dark"] .home-dashboard-card-container,
[data-bs-theme="dark"] .home-dashboard-card-container {
  background-color: #1e1e2d !important;
  border-inline-end-color: #66b847;
}
[data-theme="dark"] .home-dashboard-card-container .card-title,
[data-bs-theme="dark"] .home-dashboard-card-container .card-title {
  color: rgba(255, 255, 255, .60) !important;
}
[data-theme="dark"] .home-dashboard-card-container .card-text,
[data-bs-theme="dark"] .home-dashboard-card-container .card-text {
  color: #ffffff !important;
}
[data-theme="dark"] .home-dashboard-card-container i,
[data-bs-theme="dark"] .home-dashboard-card-container i {
  background: rgba(102, 184, 71, .16) !important;
  color: #98d880 !important;
}

/* Report table wrappers */
[data-theme="dark"] .table-container-home,
[data-bs-theme="dark"] .table-container-home,
[data-theme="dark"] .home-table-dashboard,
[data-bs-theme="dark"] .home-table-dashboard {
  background-color: #1e1e2d !important;
}

/* Table row hover */
[data-theme="dark"] .table > tbody > tr:hover > *,
[data-bs-theme="dark"] .table > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, .04);
}
[data-theme="dark"] .table thead th,
[data-bs-theme="dark"] .table thead th {
  color: rgba(255, 255, 255, .55);
}

/* Brand alert tint */
[data-theme="dark"] .alert-primary,
[data-bs-theme="dark"] .alert-primary {
  background-color: rgba(102, 184, 71, .18);
  border-color: rgba(102, 184, 71, .40);
  color: #bfe0c4;
}

/* Light-primary symbol chip */
[data-theme="dark"] .symbol.symbol-light-primary .symbol-label,
[data-bs-theme="dark"] .symbol.symbol-light-primary .symbol-label {
  background-color: rgba(102, 184, 71, .18);
  color: #98d880;
}

/* Cards: deeper shadow in dark */
[data-theme="dark"] .card,
[data-bs-theme="dark"] .card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
}
