/* Custom CSS for TalaPress Premium Admin Panel */

/* Fonts Definition */
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/almarai/Almarai-Light.ttf') format('truetype');
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/almarai/Almarai-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/almarai/Almarai-Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/almarai/Almarai-ExtraBold.ttf') format('truetype');
}

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/cairo/cairo-arabic-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/cairo/cairo-arabic-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/cairo/cairo-arabic-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter/inter-latin-700-normal.woff2') format('woff2');
}

:root, [data-bs-theme="light"] {
  --tp-bg-primary: #f3f4f6;
  --tp-bg-secondary: #ffffff;
  --tp-bg-tertiary: #e5e7eb;
  --tp-text-primary: #111827;
  --tp-text-secondary: #4b5563;
  --tp-text-muted: #9ca3af;
  --tp-border-color: #e5e7eb;
  --tp-form-border-color: #94a3b8;
  --tp-form-border-focus: #0284c7;
  --tp-primary: #0284c7;
  --tp-primary-rgb: 2, 132, 199;
  --tp-secondary: #0ea5e9;
  --tp-accent: #6366f1;
  --tp-card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --tp-top-nav-bg: #f1f1f1de;
  --tp-top-nav-text: #334155;
  --tp-top-nav-hover: #e2e8f0;
  --tp-top-nav-active: #0284c7;
  --tp-sub-nav-bg: #0284c7;
  --tp-sub-nav-text: #ffffff;
}

[data-bs-theme="dark"] {
  --tp-bg-primary: #090d16;
  --tp-bg-secondary: #111827;
  --tp-bg-tertiary: #1f2937;
  --tp-text-primary: #f9fafb;
  --tp-text-secondary: #9ca3af;
  --tp-text-muted: #6b7280;
  --tp-border-color: #374151;
  --tp-form-border-color: #64748b;
  --tp-form-border-focus: #38bdf8;
  --tp-primary: #38bdf8;
  --tp-primary-rgb: 56, 189, 248;
  --tp-secondary: #0ea5e9;
  --tp-accent: #818cf8;
  --tp-card-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.3);
  --tp-top-nav-bg: #f1f1f1de;
  --tp-top-nav-text: #1e293b;
  --tp-top-nav-hover: #e2e8f0;
  --tp-top-nav-active: #0284c7;
  --tp-sub-nav-bg: #0f172a;
  --tp-sub-nav-text: #ffffff;
}

/* Global Styles */
body {
  font-family: 'Almarai', 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--tp-bg-primary);
  color: var(--tp-text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Adjust font families based on direction */
[dir="rtl"] body {
  font-family: 'Almarai', 'Cairo', system-ui, sans-serif;
}
[dir="ltr"] body {
  font-family: 'Inter', system-ui, sans-serif;
}

.form-control,
.form-select,
.input-group-text {
  border-color: var(--tp-form-border-color) !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--tp-form-border-focus) !important;
  box-shadow: 0 0 0 .2rem rgba(var(--tp-primary-rgb), .16) !important;
}

.form-control::placeholder {
  color: #94a3b8;
}

/* Top Navigation Bar */
.tp-top-nav {
  background-color: var(--tp-top-nav-bg);
  padding: 0;
  border-bottom: 1px solid var(--tp-border-color);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.tp-brand-logo {
  color: #0284c7 !important; /* Blue brand color */
  font-weight: 800 !important;
  transition: color 0.2s ease;
}

.tp-brand-logo img {
  max-height: 48px;
  width: auto;
}

.tp-brand-logo:hover {
  color: #090d16 !important; /* Dark black on hover */
}

.tp-nav-container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}

@media (max-width: 991.98px) {
  .tp-nav-container {
    display: none; /* Collapsed on mobile, shown in sidebar */
  }
}

.tp-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--tp-top-nav-text);
  text-decoration: none;
  padding: 12px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  border-bottom: 3px solid transparent;
}

.tp-nav-item i {
  font-size: 1.6rem;
  margin-bottom: 6px;
  transition: transform 0.2s ease;
}

.tp-nav-item:hover {
  background-color: var(--tp-top-nav-hover);
  color: var(--tp-top-nav-active);
}

.tp-nav-item:hover i {
  transform: translateY(-2px);
}

.tp-nav-item.active {
  border-bottom-color: var(--tp-top-nav-active);
  color: var(--tp-top-nav-active);
  background-color: rgba(var(--tp-primary-rgb), 0.05);
}

/* Secondary header (Blue Bar) */
.tp-sub-header {
  background: linear-gradient(135deg, var(--tp-sub-nav-bg), #0369a1);
  color: var(--tp-sub-nav-text);
  padding: 18px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.tp-sub-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}

.tp-sub-header p {
  font-size: 0.85rem;
  margin: 4px 0 0 0;
  opacity: 0.8;
}

.tp-btn-outline-light {
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
  transition: all 0.2s;
}

.tp-btn-outline-light:hover {
  background-color: #ffffff;
  color: var(--tp-primary);
  border-color: #ffffff;
}

/* Custom Cards */
.tp-card {
  background-color: var(--tp-bg-secondary);
  border: 1px solid var(--tp-border-color);
  border-radius: 12px;
  box-shadow: var(--tp-card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  margin-bottom: 24px;
  overflow: hidden;
}

.tp-card-header {
  padding: 16px 20px;
  background-color: var(--tp-bg-secondary);
  border-bottom: 1px solid var(--tp-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tp-card-header h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--tp-text-primary);
}

.tp-card-body {
  padding: 20px;
}

/* Shortcut Grid */
.tp-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.tp-shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: var(--tp-bg-tertiary);
  border: 1px solid var(--tp-border-color);
  border-radius: 8px;
  color: var(--tp-text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.tp-shortcut-btn i {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: var(--tp-primary);
}

.tp-shortcut-btn:hover {
  background-color: var(--tp-primary);
  color: #ffffff;
  border-color: var(--tp-primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(var(--tp-primary-rgb), 0.25);
}

.tp-shortcut-btn:hover i {
  color: #ffffff;
}

/* Lists and list items */
.tp-list-group {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tp-list-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--tp-border-color);
  transition: background-color 0.2s;
}

.tp-list-item:last-child {
  border-bottom: none;
}

.tp-list-item:hover {
  background-color: rgba(var(--tp-primary-rgb), 0.03);
}

.tp-list-item a {
  font-weight: 600;
  color: var(--tp-primary);
  text-decoration: none;
}

.tp-list-item a:hover {
  text-decoration: underline;
}

.tp-list-item p {
  margin: 4px 0 0 0;
  font-size: 0.88rem;
  color: var(--tp-text-secondary);
}

/* BPMN Modeler Container */
.tp-bpmn-container {
  height: 550px;
  border: 1px solid var(--tp-border-color);
  border-radius: 8px;
  background-color: var(--tp-bg-secondary);
  position: relative;
  overflow: hidden;
}

/* Light / Dark adjustments for bpmn-js canvas background */
[data-bs-theme="dark"] .tp-bpmn-container {
  background-color: #1e2530;
  filter: invert(0.9) hue-rotate(180deg); /* Modern trick to get clean dark BPMN canvas without rewriting full canvas styles */
}
[data-bs-theme="dark"] .djs-palette {
  filter: invert(1) hue-rotate(180deg);
}

.tp-bpmn-toolbar {
  background-color: var(--tp-bg-tertiary);
  padding: 10px 16px;
  border-bottom: 1px solid var(--tp-border-color);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Theme / Language Switcher Widget */
.tp-controls-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mini Statistics Cards */
.tp-stat-card {
  border-left: 4px solid var(--tp-primary);
}
[dir="rtl"] .tp-stat-card {
  border-left: none;
  border-right: 4px solid var(--tp-primary);
}

.tp-stat-card.accent {
  border-left-color: var(--tp-accent);
}
[dir="rtl"] .tp-stat-card.accent {
  border-right-color: var(--tp-accent);
}

.tp-stat-card.success {
  border-left-color: #10b981;
}
[dir="rtl"] .tp-stat-card.success {
  border-right-color: #10b981;
}

.tp-stat-card.warning {
  border-left-color: #f59e0b;
}
[dir="rtl"] .tp-stat-card.warning {
  border-right-color: #f59e0b;
}

/* Mobile Sidebar Styles */
.tp-mobile-header {
  background-color: var(--tp-top-nav-bg);
  border-bottom: 1px solid var(--tp-border-color);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tp-mobile-header a, .tp-mobile-header button {
  color: var(--tp-top-nav-text) !important;
}
.tp-mobile-header button:hover {
  background-color: var(--tp-top-nav-hover) !important;
}

.tp-offcanvas-menu {
  background-color: var(--tp-top-nav-bg);
  color: var(--tp-top-nav-text);
  max-width: 280px !important;
}

.tp-offcanvas-header {
  border-bottom: 1px solid var(--tp-border-color);
}

.tp-offcanvas-body {
  padding: 0;
}

.tp-mobile-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tp-mobile-nav-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: var(--tp-top-nav-text);
  text-decoration: none;
  border-bottom: 1px solid var(--tp-border-color);
  transition: background-color 0.2s;
}

.tp-mobile-nav-item i {
  font-size: 1.3rem;
  margin-right: 15px;
}
[dir="rtl"] .tp-mobile-nav-item i {
  margin-right: 0;
  margin-left: 15px;
}

.tp-mobile-nav-item:hover, .tp-mobile-nav-item.active {
  background-color: var(--tp-top-nav-hover);
  color: #ffffff;
}

.tp-mobile-nav-item.active {
  border-left: 4px solid var(--tp-primary);
}
[dir="rtl"] .tp-mobile-nav-item.active {
  border-left: none;
  border-right: 4px solid var(--tp-primary);
}

/* Forms tweaks */
.form-control, .form-select, .input-group-text {
    border-radius: 10px;
    /* padding: 0.625rem 1rem; */
    font-size: 0.9rem;
    border-color: var(--tp-border-color);
    background-color: var(--tp-bg-secondary);
    color: var(--tp-text-primary);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
    padding-top: 10px;
    padding-bottom: 10px;
}

.form-control::placeholder {
  color: var(--tp-text-muted);
}

.form-control:hover, .form-select:hover {
  border-color: rgba(var(--tp-primary-rgb), 0.4);
}

.form-control:focus, .form-select:focus {
  border-color: var(--tp-primary);
  background-color: var(--tp-bg-secondary);
  color: var(--tp-text-primary);
  box-shadow: 0 0 0 4px rgba(var(--tp-primary-rgb), 0.12);
}

.input-group-text {
  background-color: var(--tp-bg-tertiary);
  color: var(--tp-text-secondary);
  border-color: var(--tp-border-color);
}

/* Make sure input-group keeps rounded corners on children */
.input-group > :first-child {
  border-top-left-radius: 10px !important;
  border-bottom-left-radius: 10px !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.input-group > :last-child {
  border-top-right-radius: 10px !important;
  border-bottom-right-radius: 10px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}
.input-group > :not(:first-child):not(:last-child) {
  border-radius: 0 !important;
}

[dir="rtl"] .input-group > :first-child {
  border-top-right-radius: 10px !important;
  border-bottom-right-radius: 10px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}
[dir="rtl"] .input-group > :last-child {
  border-top-left-radius: 10px !important;
  border-bottom-left-radius: 10px !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
[dir="rtl"] .input-group > :not(:first-child):not(:last-child) {
  border-radius: 0 !important;
}

.form-label {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tp-text-secondary);
}

/* Premium Card (صناديق النموذج) tweaks */
.tp-card {
  border-radius: 16px; /* Softer, more visually comfortable corners */
  border-color: var(--tp-border-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.02);
}

[data-bs-theme="dark"] .tp-card {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.tp-card-header {
  border-bottom: 1px solid var(--tp-border-color);
  padding: 18px 24px;
}

.tp-card-body {
  padding: 24px;
}

/* Header Toolbar & User Account Dropdown */
.tp-header-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tp-toolbar-btn {
  color: var(--tp-top-nav-text) !important;
  font-size: 1.25rem;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
  border-radius: 8px;
  background: transparent;
  border: none;
  text-decoration: none;
}

.tp-toolbar-btn:hover {
  background-color: var(--tp-top-nav-hover);
  color: #ffffff !important;
}

.tp-toolbar-btn .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  transform: translate(25%, -25%);
  font-size: 0.65rem;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--tp-top-nav-bg);
  padding: 0;
}

[dir="rtl"] .tp-toolbar-btn .badge {
  right: auto;
  left: 2px;
  transform: translate(-25%, -25%);
}

.tp-toolbar-divider {
  width: 1px;
  height: 28px;
  background-color: var(--tp-border-color);
  opacity: 0.2;
  margin: 0 4px;
}

/* Hide Bootstrap dropdown caret indicator */
.no-caret::after {
  display: none !important;
}

/* Dropdown Menu customizations */
.dropdown-menu {
  background-color: var(--tp-bg-secondary);
  border: 1px solid var(--tp-border-color);
  box-shadow: var(--tp-card-shadow);
  border-radius: 10px;
}

.dropdown-item {
  color: var(--tp-text-primary);
  transition: all 0.15s ease;
  font-size: 0.9rem;
}

.dropdown-item:hover {
  background-color: var(--tp-bg-tertiary);
  color: var(--tp-text-primary);
}

.dropdown-item i {
  font-size: 1.1rem;
  color: var(--tp-text-secondary);
}

.dropdown-item:hover i {
  color: var(--tp-primary);
}

/* Quill Editor Custom Styling & Dark Mode support */
.ql-toolbar.ql-snow {
  border: 1px solid var(--tp-border-color) !important;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background-color: var(--tp-bg-tertiary);
  padding: 10px 16px !important;
}

.ql-container.ql-snow {
  border: 1px solid var(--tp-border-color) !important;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  font-family: inherit !important;
  background-color: var(--tp-bg-secondary);
}

.ql-editor {
  min-height: 220px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--tp-text-primary);
  text-align: right; /* Default to RTL */
}

[dir="ltr"] .ql-editor {
  text-align: left;
}

/* Adjust toolbar colors in dark mode */
[data-bs-theme="dark"] .ql-snow .ql-stroke {
  stroke: var(--tp-text-primary) !important;
}
[data-bs-theme="dark"] .ql-snow .ql-fill {
  fill: var(--tp-text-primary) !important;
}
[data-bs-theme="dark"] .ql-snow .ql-picker {
  color: var(--tp-text-primary) !important;
}
[data-bs-theme="dark"] .ql-snow .ql-picker-options {
  background-color: var(--tp-bg-tertiary) !important;
  border-color: var(--tp-border-color) !important;
}

/* ==========================================
   Login Page Styles
   ========================================== */
.tp-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(90, 92, 234, 0.2) 0%, rgba(32, 45, 99, 0.4) 90.1%),
              linear-gradient(135deg, var(--tp-bg-primary) 0%, #0c0f1d 100%);
  padding: 20px;
  position: relative;
}

.tp-login-container {
  width: 100%;
  max-width: 1000px;
  background-color: var(--tp-bg-secondary);
  border: 1px solid var(--tp-border-color);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
}

/* Left pane (Illustration/Teamwork bg) */
.tp-login-left {
  flex: 1;
  background-image: url('/assets/images/login_bg.png');
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
  min-height: 550px;
}

.tp-login-left::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.85) 0%, rgba(79, 70, 229, 0.85) 100%);
  z-index: 1;
}

.tp-login-left > * {
  position: relative;
  z-index: 2;
  color: #ffffff;
}

/* Right pane (Form inputs) */
.tp-login-right {
  width: 450px;
  padding: 50px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: var(--tp-bg-secondary);
}

@media (max-width: 991.98px) {
  .tp-login-left {
    display: none; /* Hide left side on smaller devices */
  }
  .tp-login-container {
    max-width: 460px;
  }
  .tp-login-right {
    width: 100%;
    padding: 40px 30px;
  }
}

/* floating toolbar in corners */
.tp-login-toolbar {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  background-color: var(--tp-bg-secondary);
  border: 1px solid var(--tp-border-color);
  padding: 6px 12px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

[dir="rtl"] .tp-login-toolbar {
  right: auto;
  left: 20px;
}

.tp-login-toolbar button, .tp-login-toolbar a {
  color: var(--tp-text-primary);
  text-decoration: none;
  background: none;
  border: none;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tp-login-toolbar button:hover, .tp-login-toolbar a:hover {
  color: var(--tp-primary);
}

/* Slider dots */
.tp-slider-dots {
  display: flex;
  gap: 6px;
  margin-top: 20px;
}

.tp-slider-dot {
  width: 24px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.tp-slider-dot.active {
  background-color: #ffffff;
}

/* ==========================================
   Roles & Users Helper Classes (No Inline Styles)
   ========================================== */
.tp-permissions-list {
  max-height: 650px;
  overflow-y: auto;
}

.tp-role-item {
  cursor: pointer;
  transition: all 0.2s;
}

.tp-max-w-200 {
  max-width: 200px;
}

.tp-min-w-250 {
  min-width: 250px;
}

.tp-cursor-pointer {
  cursor: pointer;
}

.tp-avatar-lg {
  width: 40px;
  height: 40px;
}

.tp-scroll-y-200 {
  max-height: 200px;
  overflow-y: auto;
}

/* Helper Classes to eliminate inline styles */
.tp-sub-header-btn-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tp-profile-dropdown {
  min-width: 240px;
  border-radius: 10px;
  overflow: hidden;
}

.tp-login-toolbar-divider {
  width: 1px;
  height: 16px;
  background-color: var(--tp-border-color);
}

.tp-login-feature-icon-wrapper {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#feature-icon, #feature-title, #feature-badge, #feature-desc {
  transition: opacity 0.2s;
}

.tp-login-feature-desc-wrapper {
  min-height: 72px;
}

.tp-text-accent {
  color: var(--tp-accent) !important;
}

.tp-shortcut-label {
  font-size: 0.8rem;
  font-weight: bold;
}

.tp-rounded-icon-wrapper-50 {
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tp-file-upload-zone {
  border-style: dashed !important;
  cursor: pointer;
}

.tp-chart-container {
  min-height: 350px;
}

.tp-w-100 {
  width: 100%;
}

.tp-font-xs {
  font-size: 0.75rem;
}

.tp-font-xxs {
  font-size: 0.7rem;
}

.tp-overflow-hidden {
  overflow: hidden;
}

.tp-slug-wrapper {
  direction: ltr !important;
  text-align: left !important;
}

.tp-slug-input-group {
  direction: ltr !important;
  flex-direction: row !important;
  text-align: left !important;
}

.tp-slug-prefix {
  direction: ltr !important;
  text-align: left !important;
  border-top-left-radius: 10px !important;
  border-bottom-left-radius: 10px !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.tp-slug-input {
  direction: ltr !important;
  text-align: left !important;
  border-radius: 0 !important;
}

.tp-slug-lock-btn {
  border-top-right-radius: 10px !important;
  border-bottom-right-radius: 10px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.tp-tree-indent-spacer {
  width: 22px;
  display: inline-block;
}

/* ==========================================
   Categories Tree Styles
   ========================================== */
.tp-tree-container {
    max-height: 600px;
    overflow-y: auto;
    padding: 5px;
}

.tp-tree-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

/* Nesting indentation lines */
.tp-tree-list .tp-tree-list {
    padding-right: 20px; /* Arabic RTL */
    border-right: 1px dotted var(--tp-border-color);
    margin-right: 8px;
}
[dir="ltr"] .tp-tree-list .tp-tree-list {
    padding-right: 0;
    padding-left: 20px; /* English LTR */
    border-right: none;
    border-left: 1px dotted var(--tp-border-color);
    margin-right: 0;
    margin-left: 8px;
}

.tp-tree-item {
    margin-bottom: 6px;
}

.tp-tree-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    background-color: var(--tp-bg-tertiary);
    border: 1px solid var(--tp-border-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-tree-node:hover {
    background-color: rgba(var(--tp-primary-rgb), 0.08);
    border-color: rgba(var(--tp-primary-rgb), 0.3);
    transform: translateX(-4px);
}
[dir="ltr"] .tp-tree-node:hover {
    transform: translateX(4px);
}

/* Selected node */
.tp-tree-node.active-node {
    background-color: rgba(var(--tp-primary-rgb), 0.15);
    border-color: var(--tp-primary);
    box-shadow: 0 0 0 4px rgba(var(--tp-primary-rgb), 0.15);
}

.tp-tree-node-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    overflow: hidden;
}

.tp-tree-node-icon {
    font-size: 1.25rem;
    color: var(--tp-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.tp-tree-node-text {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.tp-tree-node-actions {
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.tp-tree-node:hover .tp-tree-node-actions {
    opacity: 1;
}

/* Interactive tree node buttons */
.tp-tree-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: 1px solid var(--tp-border-color);
    background-color: var(--tp-bg-secondary);
    color: var(--tp-text-secondary);
    transition: all 0.2s;
}

.tp-tree-btn:hover {
    background-color: var(--tp-primary);
    color: #ffffff;
    border-color: var(--tp-primary);
    transform: scale(1.08);
}

.tp-tree-btn.btn-delete:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Tree expand/collapse toggle */
.tp-tree-toggle-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--tp-text-secondary);
    transition: transform 0.2s ease;
    cursor: pointer;
    border-radius: 50%;
    background-color: var(--tp-bg-secondary);
    border: 1px solid var(--tp-border-color);
}

.tp-tree-toggle-btn:hover {
    background-color: var(--tp-bg-tertiary);
}

.tp-tree-toggle-btn.collapsed {
    transform: rotate(-90deg);
}
[dir="rtl"] .tp-tree-toggle-btn.collapsed {
    transform: rotate(90deg);
}

/* Inactive nodes styling */
.tp-tree-node.inactive-node {
    opacity: 0.6;
}

.tp-tree-node.inactive-node .tp-tree-node-text {
    text-decoration: line-through;
    color: var(--tp-text-muted);
}

/* Icon Grid in form */
.tp-icon-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
    max-height: 210px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--tp-border-color);
    border-radius: 12px;
    background-color: var(--tp-bg-primary);
}

.tp-icon-select-box {
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--tp-border-color);
    background-color: var(--tp-bg-secondary);
    color: var(--tp-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tp-icon-select-box:hover {
    border-color: var(--tp-primary);
    background-color: rgba(var(--tp-primary-rgb), 0.08);
    transform: scale(1.08);
}

.tp-icon-select-box.selected {
    border-color: var(--tp-primary);
    background-color: var(--tp-primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(var(--tp-primary-rgb), 0.3);
}

/* Smart Form highlight animations */
.smart-form-edit-mode {
    border-color: var(--tp-accent) !important;
    box-shadow: 0 8px 32px rgba(129, 140, 248, 0.15) !important;
}

/* Breadcrumbs inside the form card */
.tp-form-breadcrumb {
    font-size: 0.85rem;
    color: var(--tp-text-muted);
    margin-bottom: 12px;
    padding: 6px 12px;
    background-color: var(--tp-bg-primary);
    border-radius: 8px;
    display: inline-block;
}

/* Language Toggle Alignment */
[dir="rtl"] .tp-action-buttons {
    flex-direction: row-reverse;
}

/* Force Slug LTR direction styling and fix rounded corners for RTL pages */
.tp-slug-group {
    direction: ltr !important;
    text-align: left !important;
    flex-direction: row !important; /* Force standard LTR flex-row layout */
}
.tp-slug-group .input-group-text,
.tp-slug-group .form-control {
    direction: ltr !important;
    text-align: left !important;
}

/* Force LTR border radiuses for slug input group components regardless of page dir */
.tp-slug-group > :first-child {
    border-top-left-radius: 10px !important;
    border-bottom-left-radius: 10px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
.tp-slug-group > :last-child {
    border-top-right-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}
.tp-slug-group > .form-control {
    border-radius: 0 !important;
}

/* Drag and Drop premium tree styling */
.tp-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 24px;
    color: var(--tp-text-muted);
    cursor: grab;
    margin-left: 8px; /* Arabic RTL gap */
    transition: color 0.2s;
}
[dir="ltr"] .tp-drag-handle {
    margin-left: 0;
    margin-right: 8px; /* English LTR gap */
}
.tp-drag-handle:hover {
    color: var(--tp-primary);
}
.tp-drag-handle:active {
    cursor: grabbing;
}

body.dragging-active .tp-tree-node * {
    pointer-events: none !important;
}

/* SortableJS drag classes */
.tp-sortable-ghost {
    opacity: 0.4;
    background-color: rgba(var(--tp-primary-rgb), 0.12) !important;
    border: 2px dashed var(--tp-primary) !important;
}

.tp-sortable-chosen {
    background-color: var(--tp-bg-secondary) !important;
}

.tp-sortable-drag {
    opacity: 0.85;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    background-color: var(--tp-bg-primary) !important;
    border: 1px solid var(--tp-primary) !important;
}

/* Make empty category lists receptive as nesting drop zones during drag */
.tp-tree-list {
    min-height: 4px;
}
body.dragging-active .tp-tree-list {
    min-height: 24px;
    border: 1px dashed rgba(var(--tp-primary-rgb), 0.25);
    border-radius: 8px;
    padding: 4px;
    margin-top: 4px;
    transition: background-color 0.2s;
}
body.dragging-active .tp-tree-list:hover {
    background-color: rgba(var(--tp-primary-rgb), 0.05);
    border-color: var(--tp-primary);
}

/* Language Specific Visibility Classes */
body.lang-ar .tp-only-en {
    display: none !important;
}
body.lang-en .tp-only-ar {
    display: none !important;
}

/* Premium Export Buttons */
.tp-btn-icon-only {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
}

.tp-btn-icon-only:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1) !important;
    background-color: #f8f9fa !important;
    border-color: #ced4da !important;
    z-index: 10;
}

[data-bs-theme="dark"] .tp-btn-icon-only {
    background-color: var(--tp-bg-tertiary) !important;
    border-color: var(--tp-border-color) !important;
}

[data-bs-theme="dark"] .tp-btn-icon-only:hover {
    background-color: var(--tp-bg-secondary) !important;
}

/* Pearl API Docs */
.tp-api-docs-body {
    min-height: 100vh;
    background-color: var(--tp-bg-primary);
    color: var(--tp-text-primary);
    overflow-x: hidden;
}

.tp-api-docs-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: var(--tp-bg-secondary);
    border-bottom: 1px solid var(--tp-border-color);
    box-shadow: var(--tp-card-shadow);
}

.tp-api-docs-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    max-width: 100%;
}

@media (min-width: 992px) {
    .tp-api-docs-header-inner {
        padding-inline: 1.5rem;
    }
}

.tp-api-docs-header-start,
.tp-api-docs-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tp-api-docs-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--tp-text-primary) !important;
    font-weight: 700;
    white-space: nowrap;
}

.tp-api-docs-logo {
    max-height: 28px;
    width: auto;
}

.tp-api-docs-version {
    background: rgba(var(--tp-primary-rgb), 0.12) !important;
    color: var(--tp-primary) !important;
    font-weight: 600;
}

.tp-api-docs-btn-outline,
.tp-api-docs-icon-btn {
    border: 1px solid var(--tp-border-color);
    background: var(--tp-bg-secondary);
    color: var(--tp-text-primary);
}

.tp-api-docs-btn-outline:hover,
.tp-api-docs-icon-btn:hover {
    background: var(--tp-bg-tertiary);
    color: var(--tp-primary);
    border-color: rgba(var(--tp-primary-rgb), 0.35);
}

.tp-api-docs-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 60px);
    width: 100%;
}

.tp-api-docs-sidebar {
    flex: 0 0 260px;
    width: 260px;
    max-width: 260px;
    background-color: var(--tp-bg-secondary);
    border-inline-end: 1px solid var(--tp-border-color);
    padding: 1rem 0.75rem;
    position: sticky;
    top: 60px;
    align-self: flex-start;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.tp-api-docs-main {
    flex: 1 1 auto;
    min-width: 0;
    background-color: var(--tp-bg-primary);
}

.tp-api-docs-content {
    padding: 1.25rem;
    max-width: 960px;
}

@media (min-width: 1200px) {
    .tp-api-docs-content {
        padding: 2rem 2.5rem;
    }
}

.tp-api-docs-nav {
    width: 100%;
}

.tp-api-docs-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.tp-api-docs-nav ul li {
    margin-bottom: 0.2rem;
}

.tp-api-docs-nav .tp-api-docs-nav-label {
    padding: 0.35rem 0.85rem;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tp-text-muted);
    font-weight: 700;
}

.tp-api-docs-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    color: var(--tp-text-secondary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.tp-api-docs-nav a i {
    font-size: 1rem;
    opacity: 0.85;
}

.tp-api-docs-nav a:hover {
    background: rgba(var(--tp-primary-rgb), 0.08);
    color: var(--tp-text-primary);
}

.tp-api-docs-nav a.active {
    background: rgba(var(--tp-primary-rgb), 0.14);
    color: var(--tp-primary);
    font-weight: 600;
}

.tp-api-docs-page-header h1 {
    color: var(--tp-text-primary);
}

.tp-api-docs-endpoint {
    padding-inline-start: 1rem;
    border-inline-start: 3px solid rgba(var(--tp-primary-rgb), 0.85);
}

.tp-api-docs-path {
    font-size: 0.95rem;
    word-break: break-all;
    color: var(--tp-primary);
}

.tp-api-docs-code {
    position: relative;
    background: var(--tp-bg-tertiary);
    border: 1px solid var(--tp-border-color);
    border-radius: 0.625rem;
    padding: 1rem 1rem 1rem 1.25rem;
}

.tp-api-docs-code pre {
    margin: 0;
    color: var(--tp-text-primary);
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.tp-api-docs-copy {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.5rem;
    z-index: 2;
}

.tp-api-docs-offcanvas {
    background-color: var(--tp-bg-secondary);
    color: var(--tp-text-primary);
    width: min(300px, 88vw);
}

@media (min-width: 992px) {
    .tp-api-docs-offcanvas.offcanvas {
        visibility: hidden !important;
        transform: none !important;
        position: fixed;
        top: 0;
        z-index: -1;
    }
}

.tp-api-docs-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--tp-border-color);
}

.tp-api-docs-offcanvas .tp-api-docs-nav a {
    padding-inline: 1rem;
}

.tp-api-docs-main .table {
    --bs-table-bg: var(--tp-bg-secondary);
    --bs-table-color: var(--tp-text-primary);
    --bs-table-border-color: var(--tp-border-color);
    --bs-table-striped-bg: rgba(var(--tp-primary-rgb), 0.04);
    --bs-table-striped-color: var(--tp-text-primary);
}

.tp-api-docs-main .alert-info {
    background: rgba(var(--tp-primary-rgb), 0.1);
    color: var(--tp-text-primary);
    border: 1px solid rgba(var(--tp-primary-rgb), 0.2);
}

.tp-api-docs-main .alert-warning {
    background: rgba(255, 193, 7, 0.12);
    color: var(--tp-text-primary);
    border: 1px solid rgba(255, 193, 7, 0.25);
}
