/*
  Kamran Oil Traders - shared design layer.
  Loaded on every page AFTER core.css/icon-font.min.css/style.css and
  BEFORE each page's own inline <style> block, so a page's own overrides
  still win where they exist, and everything else gets this look for free.

  Palette sampled directly from the real logo (the droplet mark): the
  vivid blue of the inner drop is --kt-primary, the near-black navy of
  the outer drop/wordmark is --kt-navy - so the UI's two accent colors
  are the same two colors as the brand mark, not a generic blue pick.
*/

:root {
  --kt-primary: #0045c6;
  --kt-primary-dark: #00369a;
  --kt-primary-light: #f0f4fc;
  --kt-navy: #00132e;
  --kt-surface: #ffffff;
  --kt-surface-alt: #f8fafc;
  --kt-border: #e2e8f0;
  --kt-text: #0f1c30;
  --kt-text-muted: #64748b;
  --kt-success: #16a34a;
  --kt-danger: #dc2626;
  --kt-warning: #d97706;
  --kt-radius: 10px;
  --kt-radius-sm: 6px;
  --kt-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --kt-shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
}

body {
  color: var(--kt-text);
  background: var(--kt-surface-alt);
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: .2px;
  padding: 8px 18px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.btn:active { transform: translateY(0) scale(.98); }
.btn-sm { border-radius: 7px; padding: 5px 12px; }
.btn-primary {
  background: var(--kt-primary);
  border-color: var(--kt-primary);
  box-shadow: var(--kt-shadow-sm);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--kt-primary-dark);
  border-color: var(--kt-primary-dark);
  box-shadow: 0 6px 16px rgba(0,69,198,.25);
  transform: translateY(-1px);
}
.btn-outline-secondary {
  color: var(--kt-text-muted);
  border-color: var(--kt-border);
  background: var(--kt-surface);
}
.btn-outline-secondary:hover {
  background: var(--kt-surface-alt);
  color: var(--kt-text);
  border-color: var(--kt-border);
  transform: translateY(-1px);
}
.btn-success { background: var(--kt-success); border-color: var(--kt-success); }
.btn-success:hover { box-shadow: 0 6px 16px rgba(22,163,74,.25); transform: translateY(-1px); }
.btn-danger  { background: var(--kt-danger);  border-color: var(--kt-danger); }
.btn-danger:hover { box-shadow: 0 6px 16px rgba(220,38,38,.25); transform: translateY(-1px); }

/* ---------- Cards / panels ---------- */
.card-box, .card {
  background: var(--kt-surface);
  border: 1px solid var(--kt-border);
  border-radius: var(--kt-radius);
  box-shadow: var(--kt-shadow-sm);
}
.stat-card {
  border-radius: var(--kt-radius);
  box-shadow: var(--kt-shadow-sm);
  border: 1px solid var(--kt-border);
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card:hover {
  box-shadow: var(--kt-shadow-md);
  transform: translateY(-2px);
}

/* ---------- Page header / breadcrumb ---------- */
.page-header .title,
.page-header h4 {
  font-weight: 700;
  color: var(--kt-text);
}
.breadcrumb {
  background: transparent;
  padding-left: 0;
}
.breadcrumb-item a { color: var(--kt-primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--kt-text-muted); }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: var(--kt-radius-sm);
  border-color: var(--kt-border);
}
.form-control:focus, .form-select:focus {
  border-color: var(--kt-primary);
  box-shadow: 0 0 0 3px var(--kt-primary-light);
}
.form-label { font-weight: 600; color: var(--kt-text); font-size: .875rem; }

/* ---------- Modals ---------- */
.modal-content {
  border: none;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15,23,42,.18);
  overflow: hidden;
}
.modal-header {
  border-bottom: 1px solid var(--kt-border);
  background: var(--kt-surface-alt);
  padding: 18px 24px;
}
.modal-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--kt-text);
}
.modal-body { padding: 24px; }
.modal-footer {
  border-top: 1px solid var(--kt-border);
  padding: 16px 24px;
}
.modal-backdrop.show { opacity: .55; }
.modal.fade .modal-dialog {
  transform: translateY(16px) scale(.98);
  transition: transform .2s ease-out, opacity .2s ease-out;
}
.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

/* ---------- Tables / DataTables ---------- */
table.dataTable thead th {
  background: var(--kt-surface-alt) !important;
  color: var(--kt-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--kt-border) !important;
}
table.dataTable, table.dataTable th, table.dataTable td {
  border-color: var(--kt-border) !important;
}
table.dataTable tbody tr:hover {
  background: var(--kt-primary-light) !important;
}
.dt-buttons .btn, .dt-button {
  border-radius: var(--kt-radius-sm) !important;
}

/* ---------- Dropdowns ---------- */
.dropdown-menu {
  border: 1px solid var(--kt-border);
  border-radius: var(--kt-radius);
  box-shadow: var(--kt-shadow-md);
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--kt-primary-light);
  color: var(--kt-primary-dark);
}

/* ---------- Top header / sidebar ---------- */
.header {
  background: var(--kt-surface);
  border-bottom: 1px solid var(--kt-border);
  box-shadow: none;
}
.left-side-bar {
  background: var(--kt-surface);
  border-right: 1px solid var(--kt-border);
}
.menu-block .dropdown-toggle {
  border-radius: var(--kt-radius-sm);
  margin: 2px 10px;
  color: var(--kt-text-muted);
}
.menu-block .dropdown-toggle:hover,
.menu-block li.dropdown.active > .dropdown-toggle,
.menu-block li.mm-active > .dropdown-toggle {
  background: var(--kt-primary-light);
  color: var(--kt-primary-dark);
}
.menu-block .micon { color: inherit; }

/* ---------- Loader ---------- */
.loader-spinner { border-top-color: var(--kt-primary) !important; }
.loader-text { color: var(--kt-primary) !important; }

/* Full-page preloader (_topheader.php, shown briefly on every page load) -
   the logo image has no size limit in the template's own CSS, so at the
   real logo's native resolution it fills the whole screen. Cap it here. */
.pre-loader .loader-logo img {
  width: 160px;
  height: auto;
}

/* ==========================================================================
   Modern UI pass — sidebar, header, typography, charts, badges.
   Pure CSS cascade: every page already loads this file, so these rules
   reskin the whole portal without touching any page's markup or JS.
   ========================================================================== */

/* ---------- Typography ---------- */
body {
  font-feature-settings: "cv02","cv03","cv04","cv11";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }

/* ---------- Sidebar (brand navy, modern active state) ---------- */
.left-side-bar {
  background: var(--kt-navy) !important;
  border-right: none;
  box-shadow: 2px 0 12px rgba(0,0,0,.08);
}
.left-side-bar .brand-logo {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 10px;
}
/* Base template's .dark-logo/.light-logo rules use invalid CSS syntax
   ("display:block , max-height:100%") which the browser drops, leaving
   both logo variants permanently display:none. Force both visible here
   since both classes point at the same logo file anyway. */
.left-side-bar .brand-logo img {
  display: block !important;
  max-height: 34px;
  width: auto;
}
.left-side-bar .brand-logo a { display: block; }
.left-side-bar .brand-logo .light-logo { display: none !important; }
.menu-block { background: transparent !important; }

/* The template pads each link 67px on the left and absolutely positions the icon in that
   gap, and its "sidebar-light" rules paint icons/labels dark navy (invisible on our navy
   sidebar). Lay the link out as icon + label in a flex row and set the colours explicitly.
   Selectors are long on purpose so they beat the template without !important wars. */
.left-side-bar .menu-block .sidebar-menu .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.74);
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.left-side-bar .menu-block .sidebar-menu .dropdown-toggle .micon {
  position: static;
  transform: none;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  font-size: 1.15rem;
  color: rgba(255,255,255,.55);
  background: transparent;
  transition: color .15s ease;
}
.left-side-bar .menu-block .sidebar-menu .dropdown-toggle .mtext { color: inherit; line-height: 1.25; }
.left-side-bar .menu-block .sidebar-menu .dropdown-toggle:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.left-side-bar .menu-block .sidebar-menu .dropdown-toggle:hover .micon { color: #fff; }
.left-side-bar .menu-block .sidebar-menu li.dropdown-nav-active > .dropdown-toggle,
.left-side-bar .menu-block .sidebar-menu li.dropdown.active > .dropdown-toggle {
  background: linear-gradient(135deg, #0045c6 0%, #2b6be8 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0,69,198,.35);
}
.left-side-bar .menu-block .sidebar-menu li.dropdown-nav-active > .dropdown-toggle .micon,
.left-side-bar .menu-block .sidebar-menu li.dropdown.active > .dropdown-toggle .micon { color: #fff; }
.menu-block.customscroll::-webkit-scrollbar { width: 5px; }
.menu-block.customscroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 10px;
}

/* ---------- Header ---------- */
.header {
  /* keep the template's own fixed positioning (left:280px; width:calc(100% - 280px)) */
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.user-info-dropdown .user-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--kt-primary-light);
}
.user-info-dropdown .user-name { font-weight: 600; color: var(--kt-text); }

/* ---------- Page shell spacing ---------- */
.main-container .xs-pd-20-10.pd-ltr-20 { padding-top: 24px; }

/* ---------- Stat cards (dashboard) ---------- */
.stat-card { border: none; box-shadow: var(--kt-shadow-sm); }
.stat-card .card-body { padding: 22px 20px; }
.stat-icon-badge {
  width: 48px; height: 48px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
}
.stat-card h3 { font-size: 1.5rem; font-weight: 800; margin-bottom: 2px; }
.stat-card h6 { font-size: .7rem; font-weight: 700; margin-bottom: 0; }

/* ---------- Chart cards ---------- */
.chart-card {
  background: var(--kt-surface);
  border: 1px solid var(--kt-border);
  border-radius: var(--kt-radius);
  box-shadow: var(--kt-shadow-sm);
  padding: 22px;
}
.chart-card .chart-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--kt-text);
  margin-bottom: 2px;
}
.chart-card .chart-card-sub {
  font-size: .8rem;
  color: var(--kt-text-muted);
  margin-bottom: 18px;
}

/* ---------- Soft status badges (opt-in utility, safe to reuse anywhere) ---------- */
.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-soft-success { background: #dcfce7; color: var(--kt-success); }
.badge-soft-danger  { background: #fee2e2; color: var(--kt-danger); }
.badge-soft-warning { background: #fef3c7; color: var(--kt-warning); }
.badge-soft-info    { background: var(--kt-primary-light); color: var(--kt-primary); }
.badge-soft-muted   { background: var(--kt-surface-alt); color: var(--kt-text-muted); }

/* ---------- Responsive polish ---------- */
@media (max-width: 767px) {
  .main-container .xs-pd-20-10.pd-ltr-20 { padding-top: 14px; }
  .stat-card .card-body { padding: 18px 16px; }
  .chart-card { padding: 16px; }
}

/* ==========================================================================
   Polish pass 2: dialogs, form fields, table controls.
   ========================================================================== */

/* ---------- Dialogs (SweetAlert2) ---------- */
body .swal2-popup {
  border-radius: 18px;
  padding: 1.8rem 1.5rem 1.5rem;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
body .swal2-popup .swal2-title { font-size: 1.3rem; font-weight: 700; color: var(--kt-text); }
body .swal2-popup .swal2-html-container { color: var(--kt-text-muted); font-size: .95rem; }
body .swal2-popup .swal2-input,
body .swal2-popup .swal2-select,
body .swal2-popup .swal2-textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: 46px;
  margin: .45rem 0;
  border: 1px solid var(--kt-border);
  border-radius: 10px;
  box-shadow: none;
  font-size: .95rem;
  color: var(--kt-text);
}
body .swal2-popup .swal2-input:focus,
body .swal2-popup .swal2-select:focus,
body .swal2-popup .swal2-textarea:focus {
  border-color: var(--kt-primary);
  box-shadow: 0 0 0 3px var(--kt-primary-light);
}
body .swal2-popup .swal2-styled { border-radius: 10px; font-weight: 600; padding: .65em 1.5em; }
body .swal2-popup .swal2-styled.swal2-confirm { background-color: var(--kt-primary); box-shadow: 0 6px 16px rgba(0, 69, 198, .25); }
body .swal2-popup .swal2-styled.swal2-cancel { background-color: #eef2f7; color: var(--kt-text); }
body .swal2-popup .swal2-validation-message { background: #fef2f2; color: var(--kt-danger); border-radius: 8px; }

/* ---------- Form fields ---------- */
.form-control, select.form-control, .custom-select {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--kt-border);
  color: var(--kt-text);
  font-size: .92rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control-sm, select.form-control-sm { min-height: 34px; border-radius: 8px; }
.form-control:focus, .custom-select:focus {
  border-color: var(--kt-primary);
  box-shadow: 0 0 0 3px var(--kt-primary-light);
}
.input-group-text { background: var(--kt-surface-alt); border-color: var(--kt-border); color: var(--kt-text-muted); }
label { font-weight: 600; font-size: .85rem; color: var(--kt-text); }

/* ---------- DataTables controls ---------- */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--kt-border);
  border-radius: 10px;
  padding: 6px 12px;
  background: var(--kt-surface);
  outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--kt-primary); box-shadow: 0 0 0 3px var(--kt-primary-light); }
.dataTables_wrapper .dt-buttons .dt-button,
.dataTables_wrapper .dt-buttons .btn {
  background: var(--kt-surface);
  border: 1px solid var(--kt-border);
  color: var(--kt-text);
  font-weight: 600;
  font-size: .8rem;
  padding: 6px 14px;
  margin-right: 6px;
  box-shadow: none;
}
.dataTables_wrapper .dt-buttons .dt-button:hover { background: var(--kt-primary-light); border-color: var(--kt-primary); color: var(--kt-primary); }
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: 8px; border: 1px solid transparent; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--kt-primary) !important;
  border-color: var(--kt-primary) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_info { color: var(--kt-text-muted); font-size: .82rem; }

/* ==========================================================================
   Top bar + footer
   (The template pins .header to the right edge with width calc(100% - 280px),
   switching to 250px at 1301-1400px and 100% at <=1300px - we only restyle inside it.)
   ========================================================================== */

/* ---------- Top bar ---------- */
.header {
  flex-wrap: nowrap;
  align-items: center;
  padding: 0 24px 0 16px;
  background: var(--kt-surface);
  border-bottom: 1px solid var(--kt-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.header .header-left {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  gap: 14px;
}
.header .header-right {
  flex: 0 0 auto;
  width: auto;
  align-items: center;
}
.header .search-toggle-icon { display: none !important; }

/* menu button */
.header .menu-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  color: var(--kt-text);
  background: var(--kt-surface-alt);
  border: 1px solid var(--kt-border);
  border-radius: 10px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.header .menu-icon:hover { background: var(--kt-primary-light); border-color: transparent; color: var(--kt-primary); }

/* page title + date */
.header .header-title { min-width: 0; line-height: 1.2; }
.header .header-title h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--kt-text);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header .header-title span { display: block; font-size: .76rem; color: var(--kt-text-muted); }

/* account button */
.header .user-info-dropdown { padding: 0; }
.header .user-info-dropdown .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  background: var(--kt-surface);
  border: 1px solid var(--kt-border);
  border-radius: 999px;
  transition: background .15s ease, box-shadow .15s ease;
}
.header .user-info-dropdown .dropdown-toggle:hover { background: var(--kt-surface-alt); box-shadow: var(--kt-shadow-sm); }
.header .user-info-dropdown .dropdown-toggle .user-icon {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  line-height: 38px;
  font-size: 1rem;
  box-shadow: none;
  border: 2px solid var(--kt-primary-light);
  background: var(--kt-primary-light);
}
.header .user-info-dropdown .dropdown-toggle .user-icon img { width: 100%; height: 100%; object-fit: cover; }
.header .user-info-dropdown .dropdown-toggle .user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.header .user-info-dropdown .dropdown-toggle .user-name {
  margin: 0;
  font-size: .88rem;
  font-weight: 600;
  color: var(--kt-text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header .user-info-dropdown .dropdown-toggle .user-role {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--kt-primary);
}
.header .user-info-dropdown .dropdown-toggle::after { margin-left: 2px; color: var(--kt-text-muted); }

/* account menu */
.header .user-info-dropdown .dropdown-menu {
  min-width: 210px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--kt-border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
}
.header .user-info-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--kt-text);
}
.header .user-info-dropdown .dropdown-item i { font-size: 1.05rem; color: var(--kt-text-muted); }
.header .user-info-dropdown .dropdown-item:hover { background: var(--kt-primary-light); color: var(--kt-primary-dark); }
.header .user-info-dropdown .dropdown-item:hover i { color: var(--kt-primary); }
.header .user-info-dropdown .dropdown-item.item-danger:hover { background: #fef2f2; color: var(--kt-danger); }
.header .user-info-dropdown .dropdown-item.item-danger:hover i { color: var(--kt-danger); }
.header .user-info-dropdown .dropdown-divider { margin: 6px 0; border-color: var(--kt-border); }

@media (max-width: 767px) {
  .header .header-title span { display: none; }
}
@media (max-width: 575px) {
  .header { padding: 0 12px 0 10px; }
  .header .header-left { gap: 10px; }
  .header .header-title h1 { font-size: 1rem; }
  .header .user-info-dropdown .dropdown-toggle { padding: 4px; gap: 0; border-radius: 50%; }
  .header .user-info-dropdown .dropdown-toggle .user-meta,
  .header .user-info-dropdown .dropdown-toggle::after { display: none; }
}

/* ---------- Footer ---------- */
/* Same horizontal offset as page content: main-container padding-left (300 / 270 / 5) + the
   page's own 20px gutter. */
.kt-footer { padding: 4px 40px 24px 320px; transition: padding .3s ease-in-out; }
@media (min-width: 1301px) and (max-width: 1400px) { .kt-footer { padding-left: 290px; } }
@media (max-width: 1300px) { .kt-footer { padding: 4px 25px 22px; } }
.sidebar-shrink .kt-footer { padding-left: 40px; }

.kt-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 14px 20px;
  background: var(--kt-surface);
  border: 1px solid var(--kt-border);
  border-radius: var(--kt-radius);
  box-shadow: var(--kt-shadow-sm);
  font-size: .82rem;
  color: var(--kt-text-muted);
}
.kt-footer-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--kt-text); }
.kt-footer-brand i { color: var(--kt-primary); font-size: 1rem; }
.kt-footer-credit a {
  color: var(--kt-primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease;
}
.kt-footer-credit a:hover { border-bottom-color: var(--kt-primary); }

@media (max-width: 575px) {
  .kt-footer { padding: 4px 15px 18px; }
  .kt-footer-bar { flex-direction: column; justify-content: center; text-align: center; gap: 6px; padding: 12px; }
}
@media print { .kt-footer { display: none !important; } }
