/* ============================================================================
   KHOTWA LOGISTICS ERP - COMMERCIAL MANAGEMENT PORTAL STYLES (إدارة التجارية)
   Eye-Comfort Blue Palette: #1d4ed8, #0284c7, #bae6fd, #f0f9ff, #0f172a
   ============================================================================ */

:root {
  --primary-blue: #1d4ed8;
  --secondary-blue: #0284c7;
  --light-blue: #f0f9ff;
  --border-blue: #bae6fd;
  --dark-sidebar: #0f172a;
  --sidebar-active: #1e293b;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --font-arabic: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-arabic);
  direction: rtl;
  background-color: #f8fafc;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP HEADER */
.comm-header {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.comm-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.comm-logo-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.comm-logo-text {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary-blue);
  letter-spacing: -0.5px;
}

.comm-dept-badge {
  background: var(--light-blue);
  color: var(--secondary-blue);
  border: 1px solid var(--border-blue);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comm-search-bar {
  position: relative;
  width: 320px;
}

.comm-search-input {
  width: 100%;
  padding: 8px 36px 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  font-size: 0.85rem;
  outline: none;
  font-family: var(--font-arabic);
  transition: all 0.2s;
}

.comm-search-input:focus {
  border-color: var(--secondary-blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.comm-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
}

.comm-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.comm-pill-btn {
  background: #ffffff;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  text-decoration: none;
}

.comm-pill-btn:hover {
  background: var(--light-blue);
  color: var(--secondary-blue);
  border-color: var(--border-blue);
}

.comm-user-pill {
  background: var(--light-blue);
  border: 1px solid var(--border-blue);
  border-radius: 20px;
  padding: 4px 12px 4px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
}

.comm-user-avatar {
  width: 28px;
  height: 28px;
  background: var(--primary-blue);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

/* MAIN LAYOUT (Sidebar on Right, Workspace on Left) */
.comm-layout {
  display: flex;
  flex: 1;
}

/* SIDEBAR */
.comm-sidebar {
  width: 250px;
  background: var(--dark-sidebar);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
}

.comm-sidebar-header {
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.comm-sidebar-brand-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.comm-version-pill {
  font-size: 0.68rem;
  font-family: var(--font-en);
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #94a3b8;
}

.comm-sidebar-brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comm-sidebar-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0.5rem;
}

.comm-sidebar-input {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  color: #f1f5f9;
  font-size: 0.75rem;
  outline: none;
  font-family: var(--font-arabic);
}

.comm-sidebar-input:focus {
  border-color: #38bdf8;
}

.comm-sidebar-input::placeholder {
  color: #64748b;
}

/* SIDEBAR NAV MENU */
.comm-sidebar-menu {
  list-style: none;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.comm-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.comm-nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #f8fafc;
}

.comm-nav-item.active {
  background: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

.comm-nav-item i {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
}

.comm-nav-badge {
  margin-right: auto;
  background: rgba(255,255,255,0.15);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-en);
}

.comm-sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* MAIN WORKSPACE */
.comm-workspace {
  flex: 1;
  padding: 1.5rem 2rem;
  background: #f8fafc;
  overflow-x: hidden;
}

/* SECTION HEADERS & HERO BANNERS */
.comm-banner {
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  color: #ffffff;
  border-radius: 14px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comm-banner-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.comm-banner-desc {
  font-size: 0.88rem;
  opacity: 0.9;
}

/* STATS GRID */
.comm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.comm-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}

.comm-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.08);
  border-color: var(--border-blue);
}

.comm-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--light-blue);
  color: var(--secondary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.comm-stat-info {
  text-align: left;
}

.comm-stat-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-align: right;
}

.comm-stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-dark);
  font-family: var(--font-en);
  text-align: right;
}

/* DATA TABLES & CONTAINERS */
.comm-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.comm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.comm-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comm-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.comm-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comm-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
}

.comm-select, .comm-date-input, .comm-input {
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: var(--font-arabic);
  background: #ffffff;
  outline: none;
}

.comm-select:focus, .comm-date-input:focus, .comm-input:focus {
  border-color: var(--secondary-blue);
}

.comm-btn-search {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 18px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.comm-btn-search:hover {
  background: #1e40af;
}

.comm-btn-add {
  background: var(--secondary-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
}

.comm-btn-add:hover {
  background: #0369a1;
}

/* TABLE */
.comm-table-wrapper {
  overflow-x: auto;
}

.comm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.comm-table th {
  background: #f1f5f9;
  color: var(--text-dark);
  font-weight: 800;
  text-align: right;
  padding: 12px 14px;
  border-bottom: 2px solid #e2e8f0;
}

.comm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-dark);
}

.comm-table tr:hover td {
  background: #f8fafc;
}

.comm-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  margin-left: 4px;
}

.comm-btn-view {
  background: #e0f2fe;
  color: #0284c7;
}

.comm-btn-view:hover {
  background: #0284c7;
  color: #ffffff;
}

.comm-btn-delete {
  background: #fee2e2;
  color: #dc2626;
}

.comm-btn-delete:hover {
  background: #dc2626;
  color: #ffffff;
}

/* BANNER CARDS GRID (الصور الإعلانية) */
.comm-banners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.comm-banner-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.comm-banner-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.12);
  border-color: var(--border-blue);
}

.comm-banner-img-box {
  height: 140px;
  background: linear-gradient(135deg, #0284c7, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.comm-banner-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comm-banner-status-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
}

.comm-status-active {
  background: #10b981;
  color: #ffffff;
}

.comm-status-inactive {
  background: #64748b;
  color: #ffffff;
}

.comm-banner-details {
  padding: 1rem;
}

.comm-banner-item-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.comm-banner-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0.75rem;
}

.comm-banner-actions {
  display: flex;
  gap: 8px;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

/* MODALS */
.comm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.comm-modal-box {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  overflow: hidden;
}

.comm-modal-header {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comm-modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.comm-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #94a3b8;
  cursor: pointer;
}

.comm-modal-close:hover {
  color: var(--text-dark);
}

.comm-modal-body {
  padding: 1.25rem;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .comm-search-bar { width: 220px; }
  .comm-sidebar { width: 220px; }
}

@media (max-width: 768px) {
  .comm-layout { flex-direction: column; }
  .comm-sidebar { width: 100%; min-height: auto; position: static; }
  .comm-workspace { padding: 1rem; }
  .comm-header-actions { display: none; }
}
