/* ==========================================================================
   BOXD - Master Admin Dashboard & Logistics Command Center Stylesheet
   Sleek Side Panel Layout & High-Readability Retro-Pixel Theme
   ========================================================================== */

:root {
  --sidebar-width: 280px;
  --admin-font-spacing: 0.04em;
  --admin-line-height: 1.65;
}

/* Global Readability Overrides for Admin */
.admin-body {
  background-color: #f8fafc;
  color: #121214;
  font-family: var(--font-body), sans-serif;
  letter-spacing: var(--admin-font-spacing);
  line-height: var(--admin-line-height);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Form controls & labels readability */
.admin-body input,
.admin-body select,
.admin-body textarea {
  font-family: var(--font-body), sans-serif;
  letter-spacing: 0.035em;
  font-size: 1.2rem;
}

.admin-body .form-label {
  letter-spacing: 0.03em;
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 6px;
  display: block;
}

/* Wrapper Layout: Sidebar + Main Content */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   SIDEBAR (SIDE PANEL) NAVIGATION
   ========================================================================== */
.admin-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: #ffffff;
  border-right: 2.5px solid #121214;
  box-shadow: 4px 0 0 rgba(18, 18, 20, 0.04);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

[dir="rtl"] .admin-sidebar {
  border-right: none;
  border-left: 2.5px solid #121214;
  box-shadow: -4px 0 0 rgba(18, 18, 20, 0.04);
}

.sidebar-header {
  padding: 24px 20px 18px;
  border-bottom: 2px solid #121214;
  background: #faf5ff;
}

.sidebar-logo {
  height: 36px;
  object-fit: contain;
  margin-bottom: 14px;
}

.admin-profile-card {
  background: #ffffff;
  border: 1.5px solid #121214;
  box-shadow: 2px 2px 0px #9333ea;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #9333ea;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.15rem;
  border: 1.5px solid #121214;
}

.admin-profile-info {
  line-height: 1.25;
  overflow: hidden;
}

.admin-profile-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #121214;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.admin-profile-role {
  font-size: 0.95rem;
  font-weight: 800;
  color: #9333ea;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sidebar Menu */
.sidebar-menu {
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.12s ease-in-out;
  text-align: left;
}

[dir="rtl"] .sidebar-nav-item {
  text-align: right;
}

.sidebar-nav-item:hover {
  background: #fdfaff;
  border-color: #9333ea;
  color: #9333ea;
  transform: translateX(3px);
}

[dir="rtl"] .sidebar-nav-item:hover {
  transform: translateX(-3px);
}

.sidebar-nav-item.active {
  background: #121214;
  color: #ffffff;
  border-color: #121214;
  box-shadow: 3px 3px 0px #9333ea;
  transform: translate(-1px, -1px);
}

.sidebar-nav-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-nav-content i {
  width: 20px;
  text-align: center;
  font-size: 1.2rem;
}

.sidebar-badge {
  background: #f1f5f9;
  color: #121214;
  border: 1px solid #121214;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
}

.sidebar-nav-item.active .sidebar-badge {
  background: #9333ea;
  color: #ffffff;
  border-color: #9333ea;
}

/* Sidebar Footer Utilities */
.sidebar-footer {
  padding: 16px 14px;
  border-top: 2px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fafafa;
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1.5px solid #121214;
  box-shadow: 2px 2px 0px #121214;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 800;
  color: #121214;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.sidebar-footer-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #9333ea;
}

.sidebar-footer-btn.logout {
  background: #fee2e2;
  color: #dc2626;
  border-color: #ef4444;
}

.sidebar-footer-btn.logout:hover {
  box-shadow: 3px 3px 0px #dc2626;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.admin-main-content {
  flex: 1;
  padding: 32px 36px 80px;
  min-width: 0;
  max-width: 100%;
}

/* Content Header */
.admin-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-page-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 900;
  color: #121214;
  margin: 0;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-page-subtitle {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin: 4px 0 0;
  letter-spacing: 0.02em;
}

/* Quick Action Toolbar */
.admin-quick-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.btn-quick-action {
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: var(--shadow-pixel-sm);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  color: #121214;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.025em;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

.btn-quick-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0px #9333ea;
  background: #fdfaff;
}

.btn-quick-action.primary {
  background: #9333ea;
  color: #ffffff;
  border-color: #121214;
}

.btn-quick-action.primary:hover {
  background: #7e22ce;
  box-shadow: 4px 4px 0px #121214;
}

/* Stats Overview KPI Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}

.admin-stat-card {
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: var(--shadow-pixel);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.12s, box-shadow 0.12s;
}

.admin-stat-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px #9333ea;
}

.admin-stat-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: #f3e8ff;
  border: 2px solid #121214;
  border-radius: var(--radius-sm);
  color: #9333ea;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.admin-stat-icon.emerald { background: #d1fae5; color: #059669; }
.admin-stat-icon.blue { background: #dbeafe; color: #2563eb; }
.admin-stat-icon.amber { background: #fef3c7; color: #d97706; }
.admin-stat-icon.crimson { background: #fee2e2; color: #dc2626; }

.admin-stat-val {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: #121214;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.admin-stat-label {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

/* ==========================================================================
   FILTERS & SEARCH BARS
   ========================================================================== */
.admin-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: var(--shadow-pixel-sm);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  flex: 1;
  max-width: 440px;
}

.admin-search-box input {
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  width: 100%;
  color: #121214;
}

.admin-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.1s;
}

.filter-pill-btn:hover {
  border-color: #9333ea;
  color: #9333ea;
}

.filter-pill-btn.active {
  background: #9333ea;
  color: #ffffff;
  border-color: #9333ea;
}

/* ==========================================================================
   DATA TABLES (MAXIMUM READABILITY)
   ========================================================================== */
.admin-table-card {
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: var(--shadow-pixel);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 32px;
}

.admin-table-header {
  padding: 18px 24px;
  border-bottom: 2px solid #121214;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-table-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  color: #121214;
  letter-spacing: 0.02em;
  margin: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

[dir="rtl"] .admin-table {
  text-align: right;
}

.admin-table th {
  background: #f1f5f9;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 800;
  color: #121214;
  border-bottom: 2px solid #121214;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px dashed #cbd5e1;
  font-family: var(--font-body);
  font-size: 1.15rem;
  letter-spacing: 0.025em;
  color: var(--text-main);
  vertical-align: middle;
  line-height: 1.45;
}

.admin-table tr:hover td {
  background: #faf5ff;
}

/* Badges & Status */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #121214;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-status.pending { background: #fef3c7; color: #92400e; }
.badge-status.processing { background: #e0e7ff; color: #3730a3; }
.badge-status.shipped { background: #dbeafe; color: #1e40af; }
.badge-status.delivered { background: #d1fae5; color: #065f46; }
.badge-status.cancelled { background: #fee2e2; color: #991b1b; }

.badge-tg {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #121214;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.badge-tg-pending { background: #fef3c7; color: #92400e; }
.badge-tg-requested { background: #e0e7ff; color: #3730a3; }
.badge-tg-transit { background: #dbeafe; color: #1e40af; }
.badge-tg-delivered { background: #d1fae5; color: #065f46; }

.badge-stock {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 800;
  border: 1.5px solid #121214;
  letter-spacing: 0.02em;
}

.badge-stock.in-stock { background: #d1fae5; color: #065f46; }
.badge-stock.low-stock { background: #fef3c7; color: #92400e; }
.badge-stock.out-of-stock { background: #fee2e2; color: #991b1b; }

.badge-role {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #121214;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
}

.badge-role.admin { background: #9333ea; color: #ffffff; }
.badge-role.customer { background: #f1f5f9; color: #475569; }

/* Steppers & Action Buttons */
.stock-stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #121214;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ffffff;
}

.stock-stepper button {
  background: #f1f5f9;
  border: none;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 900;
  font-size: 1.1rem;
}

.stock-stepper button:hover {
  background: #9333ea;
  color: #ffffff;
}

.stock-stepper span {
  padding: 0 12px;
  font-weight: 800;
  font-size: 1.2rem;
  min-width: 36px;
  text-align: center;
}

.admin-action-btn-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  vertical-align: middle;
}

.btn-action-sm {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #121214;
  box-shadow: 2px 2px 0px #121214;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.15rem;
  color: #121214;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-action-sm:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #9333ea;
}

.btn-action-sm.view { color: #2563eb; }
.btn-action-sm.view:hover { box-shadow: 3px 3px 0px #2563eb; }
.btn-action-sm.edit { color: #9333ea; }
.btn-action-sm.edit:hover { box-shadow: 3px 3px 0px #9333ea; }
.btn-action-sm.delete { color: #dc2626; }
.btn-action-sm.delete:hover { box-shadow: 3px 3px 0px #dc2626; border-color: #dc2626; }

.btn-ship-tg {
  background: #9333ea;
  color: #ffffff;
  border: 1.5px solid #121214;
  box-shadow: 2px 2px 0px #121214;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.03em;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-ship-tg:hover {
  background: #7e22ce;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #121214;
}

/* ==========================================================================
   MODALS & EDIT DRAWERS
   ========================================================================== */
.admin-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 18, 20, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-card {
  background: #ffffff;
  border: 2.5px solid #121214;
  box-shadow: 8px 8px 0px #9333ea;
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.admin-modal-header {
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 2px solid #121214;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: #121214;
  margin: 0;
  letter-spacing: 0.02em;
}

.btn-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
}

.btn-modal-close:hover {
  color: #dc2626;
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Modal Form Grids (2 Columns for compact, readable forms) */
.admin-form-grid,
.checkout-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group-full {
  grid-column: 1 / -1;
}

.admin-modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 2px solid #121214;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.admin-modal-body .admin-modal-footer {
  margin: 20px -24px -24px -24px;
  padding: 16px 24px;
  position: sticky;
  bottom: -24px;
  background: #f8fafc;
  border-top: 2px solid #121214;
  z-index: 5;
}

/* Image Upload Dropzone */
.image-upload-zone {
  border: 2px dashed #9333ea;
  background: #faf5ff;
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.image-upload-zone:hover,
.image-upload-zone.dragover {
  background: #f3e8ff;
  border-color: #7e22ce;
}

.image-upload-preview {
  max-width: 130px;
  max-height: 130px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid #121214;
  box-shadow: var(--shadow-pixel-sm);
  margin-top: 10px;
}

/* Switch Toggle */
.pixel-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.pixel-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pixel-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  border: 1.5px solid #121214;
  border-radius: 999px;
  transition: .2s;
}

.pixel-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2.5px;
  background-color: #ffffff;
  border: 1.5px solid #121214;
  border-radius: 50%;
  transition: .2s;
}

.pixel-switch input:checked + .pixel-slider {
  background-color: #9333ea;
}

.pixel-switch input:checked + .pixel-slider:before {
  transform: translateX(20px);
}

/* Order Details Grid */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.order-detail-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  line-height: 1.6;
}

.order-detail-box h4 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #121214;
  margin: 0 0 8px;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   RTL ARABIC STYLING (CHANGA ARCADE GAMING FONT)
   ========================================================================== */
[dir="rtl"] {
  font-family: var(--font-ar), 'Changa', sans-serif !important;
}

[dir="rtl"] .admin-sidebar,
[dir="rtl"] .sidebar-nav-item,
[dir="rtl"] .admin-page-title,
[dir="rtl"] .admin-table-title,
[dir="rtl"] .admin-stat-val,
[dir="rtl"] .admin-stat-label,
[dir="rtl"] .btn-quick-action,
[dir="rtl"] .filter-pill-btn,
[dir="rtl"] .admin-modal-header h3 {
  font-family: var(--font-ar), 'Changa', sans-serif !important;
  letter-spacing: 0.02em !important;
}

[dir="rtl"] .admin-stat-val {
  font-size: 1.75rem;
}

[dir="rtl"] .sidebar-nav-item {
  font-size: 1.1rem;
}

[dir="rtl"] .admin-table th {
  font-size: 1.05rem;
}

[dir="rtl"] .admin-table td {
  font-size: 1.12rem;
}

[dir="rtl"] .admin-modal-card {
  box-shadow: -8px 8px 0px #9333ea;
}

[dir="rtl"] .btn-action-sm {
  box-shadow: -2px 2px 0px #121214;
}

[dir="rtl"] .btn-action-sm:hover {
  transform: translate(1px, -1px);
  box-shadow: -3px 3px 0px #9333ea;
}

[dir="rtl"] .btn-action-sm.view:hover { box-shadow: -3px 3px 0px #2563eb; }
[dir="rtl"] .btn-action-sm.delete:hover { box-shadow: -3px 3px 0px #dc2626; }

[dir="rtl"] .btn-quick-action {
  box-shadow: -2px 2px 0px #121214;
}

[dir="rtl"] .btn-quick-action:hover {
  transform: translate(2px, -2px);
  box-shadow: -4px 4px 0px #9333ea;
}

[dir="rtl"] .admin-stat-card {
  box-shadow: -3px 3px 0px #121214;
}

[dir="rtl"] .admin-stat-card:hover {
  transform: translate(2px, -2px);
  box-shadow: -5px 5px 0px #9333ea;
}

[dir="rtl"] .admin-table-card {
  box-shadow: -3px 3px 0px #121214;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1280px) {
  .admin-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .admin-wrapper {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 2.5px solid #121214;
  }
  [dir="rtl"] .admin-sidebar {
    border-left: none;
  }
  .admin-main-content {
    padding: 24px 18px 60px;
  }
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .admin-stats-grid {
    grid-template-columns: 1fr;
  }
  .admin-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-search-box {
    max-width: 100%;
  }
  .order-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   SITE CONTENT & VISUAL CMS STUDIO STYLES
   ========================================================================== */
.cms-header-card {
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: var(--shadow-pixel);
  border-radius: var(--radius-sm);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.cms-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  color: #121214;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cms-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0;
}

.cms-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cms-live-sync-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  border: 1.5px solid #059669;
  color: #065f46;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 1.5px 1.5px 0px #065f46;
}

.cms-live-sync-indicator .pulse-dot {
  width: 9px;
  height: 9px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: cmsPulse 1.6s infinite;
}

@keyframes cmsPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.6; }
}

/* Unified Visual Studio Card */
.cms-visual-studio-card {
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: var(--shadow-pixel);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 18px;
}

/* Studio Top Toolbar */
.cms-studio-toolbar {
  padding: 12px 18px;
  background: #121214;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 3px solid #27272a;
}

.cms-page-pills {
  display: flex;
  align-items: center;
  background: #27272a;
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  overflow-x: auto;
}

.cms-page-pill {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 8px 14px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cms-page-pill:hover {
  color: #ffffff;
  background: #3f3f46;
}

.cms-page-pill.active {
  background: #9333ea;
  color: #ffffff;
  box-shadow: 1.5px 1.5px 0px #000000;
}

.cms-device-toggles {
  display: flex;
  background: #27272a;
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.cms-device-btn {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 8px 14px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.cms-device-btn:hover {
  color: #ffffff;
  background: #3f3f46;
}

.cms-device-btn.active {
  background: #059669;
  color: #ffffff;
  box-shadow: 1.5px 1.5px 0px #000000;
}

.cms-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cms-lang-toggles {
  display: flex;
  background: #27272a;
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.cms-lang-pill {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 8px 14px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cms-lang-pill:hover {
  color: #ffffff;
  background: #3f3f46;
}

.cms-lang-pill.active {
  background: #d97706;
  color: #ffffff;
  box-shadow: 1.5px 1.5px 0px #000000;
}

.cms-preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cms-action-pill-btn {
  background: #27272a;
  border: 1.5px solid #3f3f46;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cms-action-pill-btn:hover {
  background: #3f3f46;
  border-color: #a855f7;
}

.cms-action-pill-btn.active {
  background: #9333ea;
  border-color: #9333ea;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(147, 51, 234, 0.6);
}

.cms-action-icon-btn {
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.cms-action-icon-btn:hover {
  background: #9333ea;
  border-color: #9333ea;
  transform: translateY(-1px);
}

/* Canvas Viewport */
.cms-visual-canvas-viewport {
  background-color: #f1f5f9;
  background-image: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  padding: 24px;
  min-height: 820px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  overflow: auto;
}

.cms-viewport-shell {
  width: 100%;
  height: 800px;
  background: #ffffff;
  border: var(--border-pixel);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1), var(--shadow-pixel);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), height 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-radius 0.3s ease;
}

.cms-viewport-shell.mobile {
  width: 390px;
  height: 800px;
  border: 8px solid #121214;
  border-radius: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 6px 6px 0px #9333ea;
  padding-top: 24px;
}

.cms-mobile-notch-bar {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 18px;
  background: #121214;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.cms-speaker {
  width: 40px;
  height: 4px;
  background: #27272a;
  border-radius: 2px;
}

.cms-camera {
  width: 7px;
  height: 7px;
  background: #1e1b4b;
  border-radius: 50%;
}

.cms-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.cms-iframe-loader {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #121214;
}

.cms-iframe-loader i {
  font-size: 2.2rem;
  color: #9333ea;
}

.cms-iframe-loader.active {
  display: flex;
}

/* Quick Visual Edit Modal */
.cms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 20, 0.45);
  backdrop-filter: blur(3px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: cmsFadeIn 0.15s ease-out;
}

@keyframes cmsFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.cms-modal-card {
  background: #ffffff;
  border: 3px solid #121214;
  box-shadow: 10px 10px 0px #121214;
  border-radius: 12px;
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cms-modal-header {
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cms-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cms-modal-icon-badge {
  width: 38px;
  height: 38px;
  background: #f3e8ff;
  border: 2px solid #9333ea;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.cms-modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #121214;
  margin: 0;
}

.cms-modal-section-badge {
  display: inline-block;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-top: 3px;
}

.cms-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cms-modal-nav-arrows {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  gap: 4px;
}

.cms-modal-nav-btn {
  background: transparent;
  border: none;
  color: #475569;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.cms-modal-nav-btn:hover {
  background: #9333ea;
  color: #ffffff;
}

.cms-modal-nav-counter {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  color: #64748b;
  padding: 0 4px;
}

.cms-modal-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.cms-modal-close:hover {
  color: #ef4444;
}

.cms-modal-sync-bar {
  background: #fef9c3;
  border-top: 1.5px solid #fef08a;
  border-bottom: 1.5px solid #fef08a;
  padding: 8px 22px;
  font-size: 0.95rem;
  color: #854d0e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cms-modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cms-modal-inputs-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cms-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cms-input-lang-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #121214;
}

.cms-lang-tag {
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 900;
}

.cms-lang-tag.en {
  background: #dbeafe;
  color: #1d4ed8;
}

.cms-lang-tag.ar {
  background: #fef3c7;
  color: #b45309;
}

.cms-modal-footer {
  padding: 16px 22px;
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* All Fields Drawer */
.cms-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 20, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  justify-content: flex-end;
  animation: cmsFadeIn 0.2s ease;
}

.cms-content-drawer {
  width: 460px;
  max-width: 90vw;
  height: 100%;
  background: #ffffff;
  border-left: 3px solid #121214;
  box-shadow: -8px 0 25px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  animation: cmsDrawerSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cmsDrawerSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

[dir="rtl"] .cms-content-drawer {
  border-left: none;
  border-right: 3px solid #121214;
}

.cms-drawer-header {
  padding: 18px 20px;
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cms-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cms-drawer-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: #121214;
  margin: 0;
}

.cms-drawer-subtitle {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 2px 0 0;
}

.cms-drawer-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
}

.cms-drawer-close:hover {
  color: #ef4444;
}

.cms-drawer-search {
  padding: 12px 20px;
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cms-drawer-search i {
  color: var(--text-dim);
  font-size: 1.1rem;
}

.cms-drawer-search input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  color: #121214;
}

.cms-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cms-drawer-item {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}

.cms-drawer-item:hover {
  border-color: #9333ea;
  background: #faf5ff;
  transform: translateX(-2px);
}

.cms-drawer-item-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #121214;
}

.cms-drawer-item-preview {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.cms-drawer-item-btn {
  background: #f3e8ff;
  color: #9333ea;
  border: 1.5px solid #9333ea;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.9rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cms-drawer-item:hover .cms-drawer-item-btn {
  background: #9333ea;
  color: #ffffff;
}

/* Pulsing highlight for iframe elements */
@keyframes cmsHighlightPulse {
  0%, 100% { outline: 3px solid #9333ea; outline-offset: 4px; box-shadow: 0 0 15px rgba(147, 51, 234, 0.5); }
  50% { outline: 4px solid #ec4899; outline-offset: 6px; box-shadow: 0 0 25px rgba(236, 72, 153, 0.7); }
}

.cms-highlight-pulse {
  animation: cmsHighlightPulse 0.75s ease-in-out 2 !important;
}

@media (max-width: 900px) {
  .cms-studio-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .cms-toolbar-actions {
    justify-content: space-between;
  }
}

/* ==========================================================================
   MANGA 3D MOCKUP STUDIO (PIXEL RETRO ADMIN SUITE)
   ========================================================================== */
.manga-mockup-studio-panel {
  background: #faf5ff;
  border: 2px dashed #a855f7;
  border-radius: 8px;
  padding: 16px;
  margin-top: 14px;
  position: relative;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.manga-mockup-studio-panel.active-ready {
  background: #ffffff;
  border: 2.5px solid #121214;
  box-shadow: 4px 4px 0px #9333ea;
}

.manga-mockup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.manga-mockup-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #9333ea;
  color: #ffffff;
  font-family: var(--font-display, inherit);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1.5px solid #121214;
  box-shadow: 2px 2px 0px #121214;
}

.manga-mockup-hint {
  font-size: 0.9rem;
  color: #6b21a8;
  font-weight: 600;
}

.manga-mockup-placeholder {
  text-align: center;
  padding: 24px 16px;
  background: rgba(243, 232, 255, 0.6);
  border-radius: 6px;
  border: 1.5px dashed #c084fc;
}

.manga-mockup-stage-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 680px) {
  .manga-mockup-stage-row {
    grid-template-columns: 1fr;
  }
}

.manga-mockup-canvas-wrapper {
  position: relative;
  background: #f8fafc;
  border: 2px solid #121214;
  border-radius: 8px;
  box-shadow: 3px 3px 0px #121214;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  min-height: 270px;
}

.manga-mockup-canvas {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 8/9;
  object-fit: contain;
  display: block;
}

.manga-mockup-applied-tag {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid #121214;
  box-shadow: 2px 2px 0px #121214;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.manga-mockup-controls-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manga-style-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 500px) {
  .manga-style-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.manga-style-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: all 0.15s ease;
}

.manga-style-card:hover {
  border-color: #a855f7;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(147, 51, 234, 0.15);
}

.manga-style-card.active {
  border-color: #9333ea;
  background: #faf5ff;
  border-width: 2px;
  box-shadow: 2px 2px 0px #9333ea;
}

.manga-style-thumb {
  width: 100%;
  height: 60px;
  background: #f1f5f9;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.manga-thumb-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.manga-style-card span {
  font-size: 0.8rem;
  font-weight: 800;
  color: #121214;
  line-height: 1.1;
}

.manga-mockup-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.form-select-sm, .form-input-sm {
  padding: 4px 8px !important;
  font-size: 0.85rem !important;
  height: 32px !important;
}

.manga-mockup-actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
