/* Cairo font import for Arabic - MUST be at the very beginning */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* Admin login logo sizing */
.login_admin .company-logo img {
  object-fit: contain;
}

/* FIRST: Protect all icon elements from font override - Apply to BOTH RTL and LTR */
i,
.fa, 
.fab, 
.fas, 
.far, 
.fal, 
.fad,
.fa-solid,
.fa-regular,
.fa-light,
.fa-thin,
.fa-duotone,
.fa-brands,
[class*="fa-"],
[class*="icon-"],
.menu-icon,
i[class*="fa"],
i[class*="icon"],
span[class*="fa"],
span[class*="icon"],
.glyphicon,
.material-icons,
[class*="material-icons"],
.arrow {
  font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Pro', 'Font Awesome 5 Free', 'Font Awesome 5 Pro', 'FontAwesome', 'Glyphicons Halflings', 'Material Icons' !important;
}

/* THEN: Apply Cairo font to everything else using :not() to exclude icons */
html[dir="rtl"] *:not(i):not(.fa):not(.fab):not(.fas):not(.far):not(.fal):not(.fad):not(.fa-solid):not(.fa-regular):not(.fa-light):not(.fa-thin):not(.fa-duotone):not(.fa-brands):not([class*="fa-"]):not([class*="icon-"]):not(.menu-icon):not(.glyphicon):not(.material-icons):not(.arrow) {
  font-family: 'Cairo', sans-serif !important;
}

html[dir="rtl"], 
html[dir="rtl"] body {
  font-family: 'Cairo', sans-serif !important;
}

/* Override all possible selectors for RTL */
html[dir="rtl"] body, 
html[dir="rtl"] div, 
html[dir="rtl"] span, 
html[dir="rtl"] p, 
html[dir="rtl"] h1, 
html[dir="rtl"] h2, 
html[dir="rtl"] h3, 
html[dir="rtl"] h4, 
html[dir="rtl"] h5, 
html[dir="rtl"] h6, 
html[dir="rtl"] a, 
html[dir="rtl"] input, 
html[dir="rtl"] button, 
html[dir="rtl"] select, 
html[dir="rtl"] textarea, 
html[dir="rtl"] label, 
html[dir="rtl"] td, 
html[dir="rtl"] th, 
html[dir="rtl"] li, 
html[dir="rtl"] ul, 
html[dir="rtl"] ol {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Specific overrides for common classes in RTL */
html[dir="rtl"] .form-control, 
html[dir="rtl"] .btn, 
html[dir="rtl"] .input-group, 
html[dir="rtl"] .card, 
html[dir="rtl"] .modal, 
html[dir="rtl"] .dropdown, 
html[dir="rtl"] .nav, 
html[dir="rtl"] .navbar, 
html[dir="rtl"] .table, 
html[dir="rtl"] .panel {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Additional specificity for authentication pages in RTL */
html[dir="rtl"] body[class*="login"], 
html[dir="rtl"] body[class*="auth"] {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Icon font protection is already handled above for all languages */

/* Keep English fonts for LTR */
html[dir="ltr"], 
html[dir="ltr"] body, 
html[dir="ltr"] * {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Override Inter font specifically for RTL */
html[dir="rtl"][style*="font-family"],
html[dir="rtl"] *[style*="font-family"] {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* Make menu items bold */
#side-menu a,
#side-menu .menu-text,
.metis-menu a,
.metis-menu .menu-text,
.sidebar .nav a,
.sidebar .nav .menu-text,
.nav.metis-menu a,
.nav.metis-menu .menu-text,
.nav-second-level a,
.nav-second-level .menu-text,
.menu-item a,
.sub-menu-item a {
  font-weight: 700 !important;
}

/* ============================================
   Admin – Gold theme (whole system, logo-style)
   ============================================ */

/* Gold palette */
body.admin {
  background: #f5f0e8;
  color: #2c2416;
}

body.admin #wrapper {
  background: linear-gradient(165deg, #faf8f5 0%, #f5f0e8 40%, #f0ebe3 100%);
  min-height: 100vh;
}

/* Header – warm white with gold accent */
body.admin #header {
  background: linear-gradient(180deg, #fffefb 0%, #fdfbf7 100%);
  border-bottom: 1px solid rgba(184, 134, 11, 0.2);
  box-shadow: 0 1px 3px rgba(184, 134, 11, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.admin #header .logo-text {
  color: #2c2416 !important;
}

body.admin #header .logo-text:hover {
  color: #b8860b !important;
}

body.admin #header li > a.active {
  background: rgba(212, 175, 55, 0.15);
  color: #8b6914;
}

body.admin #header .hide-menu:hover {
  background: rgba(212, 175, 55, 0.12) !important;
  color: #8b6914 !important;
}

/* Hide Todo icon from header */
body.admin #header .header-todo,
body.admin .header-todo {
  display: none !important;
}

/* Quick create button + primary Tailwind – gold */
body.admin .tw-bg-primary-600,
body.admin .group-hover\:tw-bg-primary-700:hover .tw-bg-primary-600,
body.admin a .tw-bg-primary-600 {
  background-color: #c9a227 !important;
}

body.admin .tw-bg-primary-600:hover,
body.admin .group-hover\:\!tw-bg-primary-700:hover,
body.admin .tw-bg-primary-700 {
  background-color: #b8860b !important;
}

body.admin .tw-text-primary-600,
body.admin .tw-text-primary-700 {
  color: #b8860b !important;
}

/* Sidebar – modern style */
body.admin .sidebar {
  background: linear-gradient(180deg, #faf8f5 0%, #f5f0e8 50%, #f0ebe3 100%);
  border-right: 1px solid rgba(184, 134, 11, 0.12);
  padding: 12px 10px 24px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.6);
}

[dir="rtl"] body.admin .sidebar {
  border-right: 0;
  border-left: 1px solid rgba(184, 134, 11, 0.12);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.6);
}

/* User profile block – card style */
body.admin .sidebar-user-profile {
  margin-top: 72px;
  margin-left: 4px;
  margin-right: 4px;
}

[dir="rtl"] body.admin .sidebar-user-profile {
  margin-left: 4px;
  margin-right: 4px;
}

body.admin .sidebar-user-profile .dropdown-toggle.profile {
  border: 1px solid rgba(184, 134, 11, 0.2);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

body.admin .sidebar-user-profile .dropdown-toggle.profile:hover {
  background: #fdfbf7;
  border-color: rgba(184, 134, 11, 0.35);
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.1);
}

body.admin .sidebar-user-profile .tw-font-semibold {
  font-weight: 600;
  color: #2c2416;
}

body.admin .sidebar-user-profile .tw-text-neutral-500,
body.admin .sidebar-user-profile .tw-text-neutral-700 {
  color: #6b6348 !important;
}

/* Main nav list */
body.admin #side-menu.nav {
  margin-top: 20px;
  padding: 0 4px;
}

body.admin .sidebar > ul.nav > li {
  border-left: none;
  margin-bottom: 4px;
}

[dir="rtl"] body.admin .sidebar > ul.nav > li {
  border-right: none;
}

body.admin .sidebar ul.nav > li > a {
  color: #4a4539;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

body.admin .sidebar ul.nav li a i.menu-icon {
  margin-right: 12px;
  width: 20px;
  font-size: 17px;
  text-align: center;
  color: #7a735a;
  transition: color 0.2s ease;
}

[dir="rtl"] body.admin .sidebar ul.nav li a i.menu-icon {
  margin-right: 0;
  margin-left: 12px;
}

body.admin .sidebar > ul.nav > li:hover > a:first-child,
body.admin .sidebar > ul.nav > li.active > a:first-child {
  background: #fff;
  border-radius: 10px;
  border-color: rgba(184, 134, 11, 0.2);
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.08);
}

body.admin .sidebar > ul.nav > li.active > a:first-child {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.12) 0%, #fff 100%);
  border-color: rgba(184, 134, 11, 0.3);
}

[dir="rtl"] body.admin .sidebar > ul.nav > li.active > a:first-child {
  background: linear-gradient(270deg, rgba(212, 175, 55, 0.12) 0%, #fff 100%);
}

body.admin .sidebar > ul.nav > li.active {
  border-left: none;
  position: relative;
}

body.admin .sidebar > ul.nav > li.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: linear-gradient(180deg, #d4af37 0%, #b8860b 100%);
  border-radius: 0 3px 3px 0;
}

[dir="rtl"] body.admin .sidebar > ul.nav > li.active {
  border-right: none;
}

[dir="rtl"] body.admin .sidebar > ul.nav > li.active::before {
  left: auto;
  right: 0;
  border-radius: 3px 0 0 3px;
}

body.admin .sidebar ul.nav li.active > a,
body.admin .sidebar ul.nav > li > a:hover,
body.admin .sidebar ul.nav > li > a:focus,
body.admin .sidebar ul.nav li.active > a .menu-icon,
body.admin .sidebar ul.nav > li > a:hover .menu-icon,
body.admin .sidebar ul.nav > li > a:focus .menu-icon {
  color: #8b6914;
}

body.admin .sidebar ul.nav li.active > a .menu-icon,
body.admin .sidebar ul.nav > li > a:hover .menu-icon {
  color: #c9a227;
}

/* Submenu – modern indent */
body.admin .sidebar ul.nav li .nav-second-level {
  list-style: none;
  padding: 6px 0 6px 0;
  margin: 4px 0 8px 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

body.admin .sidebar ul.nav li .nav-second-level li a {
  padding: 8px 14px 8px 44px;
  font-size: 13px;
  font-weight: 500;
  color: #5c5544;
  border-radius: 8px;
  margin: 0 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

[dir="rtl"] body.admin .sidebar ul.nav li .nav-second-level li a {
  padding: 8px 44px 8px 14px;
}

body.admin .sidebar ul.nav li .nav-second-level a .menu-icon {
  margin-right: 8px;
  font-size: 14px;
}

[dir="rtl"] body.admin .sidebar ul.nav li .nav-second-level a .menu-icon {
  margin-right: 0;
  margin-left: 8px;
}

body.admin .sidebar ul.nav li .nav-second-level li.active a {
  font-weight: 600;
  color: #8b6914;
  background: rgba(212, 175, 55, 0.12);
}

body.admin .sidebar ul.nav > li .nav-second-level > li:not(.active) > a:hover,
body.admin .sidebar ul.nav > li .nav-second-level > li:not(.active) > a:focus {
  color: #8b6914;
  background: rgba(212, 175, 55, 0.08);
}

body.admin .sidebar ul.nav li .nav-second-level a:hover .menu-icon,
body.admin .sidebar ul.nav li .nav-second-level a:focus .menu-icon {
  color: #c9a227;
}

/* Arrow / chevron */
body.admin .sidebar .arrow {
  float: right;
  padding-top: 4px;
  font-size: 11px;
  color: #7a735a;
  transition: transform 0.25s ease, color 0.2s ease;
}

body.admin .sidebar .active > a > .arrow {
  color: #c9a227;
}

body.admin .sidebar .fa.arrow:before {
  content: "\f107";
}

body.admin .sidebar .active > a > .fa.arrow:before {
  content: "\f106";
}

[dir="rtl"] body.admin .sidebar .arrow {
  float: left;
}

/* Badges in menu */
body.admin .sidebar .badge {
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
}

/* Setup / Settings menu item */
body.admin #setup-menu-item a {
  margin-top: 8px;
  border-top: 1px solid rgba(184, 134, 11, 0.12);
  padding-top: 14px !important;
}

/* Content area */
body.admin .content {
  background: transparent;
}

/* Buttons – primary gold */
body.admin .btn-primary {
  background: linear-gradient(180deg, #d4af37 0%, #c9a227 50%, #b8860b 100%);
  border-color: #b8860b;
  color: #1a1510;
}

body.admin .btn-primary:hover,
body.admin .btn-primary:focus,
body.admin .btn-primary:active {
  background: linear-gradient(180deg, #c9a227 0%, #b8860b 100%);
  border-color: #8b6914;
  color: #fff;
}

body.admin .btn-default:hover,
body.admin .btn-default:focus {
  border-color: rgba(184, 134, 11, 0.4);
  color: #8b6914;
  background: rgba(212, 175, 55, 0.08);
}

/* Links – gold accent */
body.admin a:not(.btn):not(.dropdown-toggle):not(.logo):not([class*="tw-bg"]) {
  color: #4a4539;
}

body.admin a:not(.btn):not(.dropdown-toggle):not(.logo):not([class*="tw-bg"]):hover {
  color: #b8860b;
}

/* Panels / cards – subtle gold border and shadow */
body.admin .panel_s,
body.admin .panel {
  border-radius: 10px;
  border: 1px solid rgba(184, 134, 11, 0.12);
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
}

body.admin .panel-body {
  border-radius: 0 0 10px 10px;
}

body.admin .panel-heading,
body.admin .panel-default > .panel-heading {
  background: linear-gradient(180deg, #fdfbf7 0%, #f8f4ed 100%);
  border-bottom: 1px solid rgba(184, 134, 11, 0.15);
  color: #2c2416;
}

/* Tables – header gold tint */
body.admin .table thead th {
  background: linear-gradient(180deg, #fdfbf7 0%, #f8f4ed 100%);
  border-bottom: 1px solid rgba(184, 134, 11, 0.2);
  color: #2c2416;
  font-weight: 600;
}

/* Dropdowns – warm background */
body.admin .dropdown-menu {
  border: 1px solid rgba(184, 134, 11, 0.15);
  box-shadow: 0 4px 16px rgba(184, 134, 11, 0.08);
}

body.admin .dropdown-menu > li > a:hover {
  background: rgba(212, 175, 55, 0.1);
  color: #8b6914;
}

/* Alerts, badges, labels – gold tint where appropriate */
body.admin .alert-info {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(184, 134, 11, 0.25);
  color: #2c2416;
}

body.admin .breadcrumb {
  background: transparent;
}

body.admin .breadcrumb > .active {
  color: #8b6914;
}

/* Footer if visible */
body.admin footer {
  background: linear-gradient(180deg, #f5f0e8 0%, #f0ebe3 100%);
  border-top: 1px solid rgba(184, 134, 11, 0.15);
}

/* Form focus – gold ring */
body.admin .form-control:focus {
  border-color: rgba(184, 134, 11, 0.5);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* ============================================
   Dashboard – Modern gold theme (logo-style)
   ============================================ */
body.dashboard #wrapper {
  background: linear-gradient(160deg, #faf8f5 0%, #f5f0e8 50%, #f0ebe3 100%);
  min-height: 100vh;
}

body.dashboard .content {
  padding: 28px 30px 40px;
  max-width: 1600px;
  margin: 0 auto;
}

body.dashboard .content > .row {
  margin-left: -12px;
  margin-right: -12px;
}

/* Dashboard widget cards – modern card with gold accent */
body.dashboard .widget {
  margin-bottom: 24px;
}

body.dashboard .widget .panel_s {
  position: relative;
  background: #fff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(184, 134, 11, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  overflow: visible; /* allow widget-dragger (left: -15px) to show */
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}

body.dashboard .widget .panel_s:hover {
  box-shadow: 0 4px 20px rgba(184, 134, 11, 0.1), 0 12px 32px rgba(0, 0, 0, 0.06);
}

body.dashboard .widget .panel_s::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #d4af37 0%, #c9a227 50%, #b8860b 100%);
  border-radius: 14px 0 0 14px;
}

[dir="rtl"] body.dashboard .widget .panel_s::before {
  left: auto;
  right: 0;
  border-radius: 0 14px 14px 0;
}

body.dashboard .widget .panel-body {
  border: none;
  border-radius: 14px;
  padding: 18px 20px 20px 22px;
  background: #fff;
}

/* Widget titles – gold tint */
body.dashboard .widget .tw-text-neutral-700,
body.dashboard .widget .tw-text-neutral-500,
body.dashboard .widget p.tw-font-semibold,
body.dashboard .widget p.tw-font-medium {
  color: #2c2416 !important;
}

body.dashboard .widget a:not(.btn):not(.dropdown-toggle) {
  color: #b8860b;
  font-weight: 500;
  transition: color 0.2s ease;
}

body.dashboard .widget a:not(.btn):not(.dropdown-toggle):hover {
  color: #8b6914;
}

body.dashboard .widget svg.tw-text-neutral-500 {
  color: #c9a227 !important;
}

/* Screen options button – gold when active/hover */
body.dashboard .screen-options-btn {
  background: linear-gradient(180deg, #f0ebe3 0%, #e8e0d5 100%);
  color: #2c2416;
  border: 1px solid rgba(184, 134, 11, 0.25);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  padding: 8px 18px;
  box-shadow: 0 -2px 8px rgba(184, 134, 11, 0.08);
}

body.dashboard .screen-options-btn:hover {
  background: linear-gradient(180deg, #e8dfd0 0%, #d4af37 100%);
  color: #1a1510;
  border-color: rgba(184, 134, 11, 0.4);
}

body.dashboard .screen-options-area {
  background: linear-gradient(180deg, #fdfbf7 0%, #f8f4ed 100%);
  border-bottom: 1px solid rgba(184, 134, 11, 0.2);
  padding: 14px 30px 18px;
}

/* Placeholder for drag-and-drop */
body.dashboard .placeholder-dashboard-widgets {
  border: 2px dashed rgba(201, 162, 39, 0.5);
  background: rgba(245, 230, 200, 0.2);
  border-radius: 14px;
  margin-bottom: 24px;
  min-height: 140px;
}

/* Widget dragger icon – gold */
body.dashboard .widget-dragger {
  color: rgba(201, 162, 39, 0.6);
}

body.dashboard .widget-dragger:hover,
body.dashboard .widget-dragger:active {
  color: #b8860b;
}

/* Alerts on dashboard */
body.dashboard .alert {
  border-radius: 10px;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Data container spacing */
body.dashboard [data-container] {
  min-height: 24px;
}
