/* Target all images on the page and make them responsive */
img {
  max-width: 100% !important;
  height: auto !important;
}

/* Collapse sidebar by default */
body {
  --sidebar-width: 300px;
}

/* Sidebar logo - centered in sidebar - comprehensive targeting */
[data-css="sidebar-branding"],
[data-css="sidebar"] > div:first-child,
[data-css="sidebar-branding"] > div,
[data-css="sidebar-branding"] > a,
[data-css="sidebar-branding"] h1,
aside[data-css="sidebar"] > div:first-child {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px 12px !important;
  text-align: center !important;
  width: 100% !important;
}

[data-css="sidebar-branding"] img,
[data-css="sidebar"] > div:first-child img,
[data-css="sidebar-branding"] a img,
[data-css="sidebar-branding"] h1 img,
aside[data-css="sidebar"] img:first-child,
aside[data-css="sidebar"] > div:first-child img {
  max-width: 140px !important;
  max-height: 120px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 auto !important;
  display: block !important;
  object-fit: contain !important;
}

/* Logo styling - target by class */
.adminjs_Logo,
.adminjs_Logo img {
  max-width: 120px !important;
  height: 120px !important;
  width: auto !important;
  display: block !important;
  margin: 0 auto !important;
  object-fit: contain !important;
}

/* Header styling */
.adminjs_Header,
.adminjs_H2,
h5.adminjs_Header,
h5.adminjs_H2 {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Target images in headers specifically */
.adminjs_Header img,
.adminjs_H2 img,
h5 img {
  max-height: 150px !important;
  width: auto !important;
  object-fit: contain !important;
  display: inline-block !important;
  margin: 0 auto !important;
}

/* Catch any image that might be the logo */
header img,
[role="banner"] img {
  max-width: 150px !important;
  height: auto !important;
  display: block !important;
  margin: 0 auto !important;
}

/* public/css/admin-custom.css */
body[lang="ar"] {
  direction: rtl;
  text-align: right;
}

/* Role-specific Dashboard Styles */

/* Super Admin Dashboard */
.dashboard-super-admin .card-primary {
  border-left: 4px solid #2196f3;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.dashboard-super-admin .card-info {
  border-left: 4px solid #00bcd4;
  box-shadow: 0 2px 8px rgba(0, 188, 212, 0.1);
}

.dashboard-super-admin .card-success {
  border-left: 4px solid #4caf50;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
}

.dashboard-super-admin .card-warning {
  border-left: 4px solid #ff9800;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.1);
}

.dashboard-super-admin .card-technical {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* Admin Dashboard */
.dashboard-admin .card-primary {
  border-left: 4px solid #3f51b5;
  transition: transform 0.2s;
}

.dashboard-admin .card-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.2);
}

.dashboard-admin .card-info {
  border-left: 4px solid #009688;
  transition: transform 0.2s;
}

.dashboard-admin .card-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 150, 136, 0.2);
}

.dashboard-admin .card-success {
  border-left: 4px solid #4caf50;
  transition: transform 0.2s;
}

.dashboard-admin .card-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.dashboard-admin .card-warning {
  border-left: 4px solid #ff9800;
  transition: transform 0.2s;
}

.dashboard-admin .card-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
}

/* Manager Dashboard */
.dashboard-manager {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.dashboard-manager .card-primary {
  border-top: 3px solid #5e72e4;
}

.dashboard-manager .card-info {
  border-top: 3px solid #11cdef;
}

.dashboard-manager .card-success {
  border-top: 3px solid #2dce89;
}

.dashboard-manager .card-warning {
  border-top: 3px solid #fb6340;
}

/* Warehouse Dashboard */
.dashboard-warehouse {
  background: #f8f9fa;
}

.dashboard-warehouse .warehouse-action-btn {
  transition: all 0.3s ease;
  background: white;
}

.dashboard-warehouse .warehouse-action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.dashboard-warehouse .card-info {
  border-left: 5px solid #17a2b8;
}

.dashboard-warehouse .card-success {
  border-left: 5px solid #28a745;
}

.dashboard-warehouse .card-warning {
  border-left: 5px solid #ffc107;
}

.dashboard-warehouse .card-primary {
  border-left: 5px solid #007bff;
}

/* Sales Dashboard */
.dashboard-sales {
  background: linear-gradient(to bottom, #ffffff 0%, #e3f2fd 100%);
}

.dashboard-sales .sales-action-btn {
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.dashboard-sales .sales-action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.3);
}

.dashboard-sales .product-card {
  transition: all 0.2s ease;
  border: 1px solid #e0e0e0;
}

.dashboard-sales .product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  border-color: #2196f3;
}

.dashboard-sales .card-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
}

.dashboard-sales .card-info {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.dashboard-sales .card-warning {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: white;
}

.dashboard-sales .card-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* Finance Dashboard */
.dashboard-finance {
  background: #fafafa;
}

.dashboard-finance .finance-positive {
  border-left: 5px solid #4caf50;
  background: linear-gradient(to right, #ffffff 0%, #e8f5e9 100%);
}

.dashboard-finance .finance-negative {
  border-left: 5px solid #f44336;
  background: linear-gradient(to right, #ffffff 0%, #ffebee 100%);
}

.dashboard-finance .card-success {
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.dashboard-finance .card-error {
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2);
}

.dashboard-finance .card-info {
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.dashboard-finance .card-warning {
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  border-left: 5px solid #ffc107;
}

/* Auditor Dashboard */
.dashboard-auditor {
  background: #f5f5f5;
}

.dashboard-auditor .audit-card {
  border: 2px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dashboard-auditor .audit-stat {
  background: white;
  border-left: 4px solid #607d8b;
}

.dashboard-auditor .card-info {
  border-color: #2196f3;
}

.dashboard-auditor .card-error {
  border-color: #f44336;
}

.dashboard-auditor .card-success {
  border-color: #4caf50;
}

.dashboard-auditor .card-primary {
  border-color: #9c27b0;
}

/* Common card enhancements */
[class*="dashboard-"] [class*="card"] {
  border-radius: 8px;
  overflow: hidden;
}

/* Smooth transitions for all interactive elements */
button, [role="button"], .clickable {
  transition: all 0.2s ease;
}

button:hover, [role="button"]:hover, .clickable:hover {
  cursor: pointer;
}

/* Hide Product Detail from sidebar navigation */
a[href*="/admin/pages/product-detail"] {
  display: none !important;
}

/* ===== Sidebar Navigation Button Styling ===== */

/* Paint-in animation keyframes */
@keyframes paintIn {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

@keyframes fadeSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-8px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* All sidebar navigation links - borders and base styling */
[data-css="sidebar"] a[href] {
  border: 1px solid rgba(195, 207, 226, 0.45) !important;
  border-radius: 6px !important;
  margin: 3px 8px !important;
  padding: 8px 12px !important;
  transition: all 0.3s ease !important;
  background-size: 200% 100% !important;
  background-image: linear-gradient(to left, transparent 50%, rgba(102, 126, 234, 0.08) 50%) !important;
  background-position: 100% 0 !important;
  animation: fadeSlideIn 0.4s ease both;
}

/* Stagger the animation for each nav item */
[data-css="sidebar"] a[href]:nth-child(1) { animation-delay: 0.05s; }
[data-css="sidebar"] a[href]:nth-child(2) { animation-delay: 0.10s; }
[data-css="sidebar"] a[href]:nth-child(3) { animation-delay: 0.15s; }
[data-css="sidebar"] a[href]:nth-child(4) { animation-delay: 0.20s; }
[data-css="sidebar"] a[href]:nth-child(5) { animation-delay: 0.25s; }
[data-css="sidebar"] a[href]:nth-child(6) { animation-delay: 0.30s; }
[data-css="sidebar"] a[href]:nth-child(7) { animation-delay: 0.35s; }
[data-css="sidebar"] a[href]:nth-child(8) { animation-delay: 0.40s; }
[data-css="sidebar"] a[href]:nth-child(9) { animation-delay: 0.45s; }
[data-css="sidebar"] a[href]:nth-child(10) { animation-delay: 0.50s; }
[data-css="sidebar"] a[href]:nth-child(11) { animation-delay: 0.55s; }
[data-css="sidebar"] a[href]:nth-child(12) { animation-delay: 0.60s; }
[data-css="sidebar"] a[href]:nth-child(13) { animation-delay: 0.65s; }
[data-css="sidebar"] a[href]:nth-child(14) { animation-delay: 0.70s; }
[data-css="sidebar"] a[href]:nth-child(15) { animation-delay: 0.75s; }
[data-css="sidebar"] a[href]:nth-child(n+16) { animation-delay: 0.80s; }

/* Hover effect - paint fill animation */
[data-css="sidebar"] a[href]:hover {
  border-color: rgba(102, 126, 234, 0.5) !important;
  background-position: 0 0 !important;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12) !important;
  transform: translateX(2px);
}

/* Active/selected link - painted state */
[data-css="sidebar"] a[href][class*="selected"],
[data-css="sidebar"] a[href][aria-current="page"] {
  border-color: rgba(102, 126, 234, 0.6) !important;
  background-image: linear-gradient(to right, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.08)) !important;
  background-size: 100% 100% !important;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.15) !important;
  border-left: 3px solid #667eea !important;
}

/* Navigation section labels/headers */
[data-css="sidebar"] [data-css="sidebar-pages"] > nav > section > label,
[data-css="sidebar"] [data-css="sidebar-resources"] > nav > section > label {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 1.2px !important;
  color: #8898aa !important;
  padding: 12px 12px 4px !important;
}

/* Collapse the resources wrapper when empty so it doesn't eat flexGrow space */
[data-css="sidebar-resources"]:empty,
[data-css="sidebar-resources"]:not(:has(a)) {
  display: none !important;
  flex-grow: 0 !important;
}

[data-css="sidebar-pages"]:empty {
  display: none !important;
}

/* When sidebar resources section has no visible links, hide it */
[data-css="sidebar-resources"] nav:empty,
[data-css="sidebar-resources"] nav section:empty {
  display: none !important;
}

/* ===== Category Color Theming ===== */

/* Inventory Category - Blue */
[data-category="inventory"] nav > section > label {
  color: #2196F3 !important;
  border-bottom: 2px solid rgba(33, 150, 243, 0.2);
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
}

[data-category="inventory"] a[href] {
  border-color: rgba(33, 150, 243, 0.35) !important;
  background-image: linear-gradient(to left, transparent 50%, rgba(33, 150, 243, 0.08) 50%) !important;
}

[data-category="inventory"] a[href]:hover {
  border-color: rgba(33, 150, 243, 0.6) !important;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15) !important;
}

[data-category="inventory"] a[href][class*="selected"],
[data-category="inventory"] a[href][aria-current="page"] {
  border-color: rgba(33, 150, 243, 0.7) !important;
  background-image: linear-gradient(to right, rgba(33, 150, 243, 0.15), rgba(33, 150, 243, 0.08)) !important;
  box-shadow: 0 2px 10px rgba(33, 150, 243, 0.2) !important;
  border-left: 3px solid #2196F3 !important;
}

/* Sales Category - Purple */
[data-category="sales"] nav > section > label {
  color: #667eea !important;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
}

[data-category="sales"] a[href] {
  border-color: rgba(102, 126, 234, 0.35) !important;
  background-image: linear-gradient(to left, transparent 50%, rgba(102, 126, 234, 0.08) 50%) !important;
}

[data-category="sales"] a[href]:hover {
  border-color: rgba(102, 126, 234, 0.6) !important;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15) !important;
}

[data-category="sales"] a[href][class*="selected"],
[data-category="sales"] a[href][aria-current="page"] {
  border-color: rgba(102, 126, 234, 0.7) !important;
  background-image: linear-gradient(to right, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.10)) !important;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2) !important;
  border-left: 3px solid #667eea !important;
}

/* Orders Category - Green */
[data-category="orders"] nav > section > label {
  color: #4CAF50 !important;
  border-bottom: 2px solid rgba(76, 175, 80, 0.2);
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
}

[data-category="orders"] a[href] {
  border-color: rgba(76, 175, 80, 0.35) !important;
  background-image: linear-gradient(to left, transparent 50%, rgba(76, 175, 80, 0.08) 50%) !important;
}

[data-category="orders"] a[href]:hover {
  border-color: rgba(76, 175, 80, 0.6) !important;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15) !important;
}

[data-category="orders"] a[href][class*="selected"],
[data-category="orders"] a[href][aria-current="page"] {
  border-color: rgba(76, 175, 80, 0.7) !important;
  background-image: linear-gradient(to right, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.08)) !important;
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.2) !important;
  border-left: 3px solid #4CAF50 !important;
}

/* Admin Category - Orange */
[data-category="admin"] nav > section > label {
  color: #FF9800 !important;
  border-bottom: 2px solid rgba(255, 152, 0, 0.2);
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
}

[data-category="admin"] a[href] {
  border-color: rgba(255, 152, 0, 0.35) !important;
  background-image: linear-gradient(to left, transparent 50%, rgba(255, 152, 0, 0.08) 50%) !important;
}

[data-category="admin"] a[href]:hover {
  border-color: rgba(255, 152, 0, 0.6) !important;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.15) !important;
}

[data-category="admin"] a[href][class*="selected"],
[data-category="admin"] a[href][aria-current="page"] {
  border-color: rgba(255, 152, 0, 0.7) !important;
  background-image: linear-gradient(to right, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.08)) !important;
  box-shadow: 0 2px 10px rgba(255, 152, 0, 0.2) !important;
  border-left: 3px solid #FF9800 !important;
}

/* Category section spacing */
[data-category] {
  margin-bottom: 16px !important;
}

[data-category]:last-child {
  margin-bottom: 8px !important;
}

