/* ==========================================
   مكتبة الأستاذ - نظام الحسابات
   WordPress Admin Plugin Styles
   RTL Support - Scoped to .mao-wrap
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

/* ==========================================
   CSS Variables / Design Tokens
   ========================================== */
.mao-wrap {
  /* Colors */
  --primary: #6C5CE7;
  --primary-light: #a29bfe;
  --primary-dark: #4834d4;
  --secondary: #00B894;
  --secondary-light: #55efc4;
  --accent: #fd79a8;
  --danger: #E17055;
  --danger-light: #fab1a0;
  --warning: #fdcb6e;
  --info: #74b9ff;
  
  /* Dark theme */
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a3e;
  --bg-tertiary: #252550;
  --bg-card: rgba(30, 30, 70, 0.6);
  --bg-card-hover: rgba(40, 40, 90, 0.8);
  --bg-input: rgba(20, 20, 50, 0.8);
  --bg-sidebar: rgba(15, 15, 40, 0.95);
  
  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #b2b2d8;
  --text-muted: #6c6c9c;
  --text-accent: #a29bfe;
  
  /* Borders */
  --border-color: rgba(108, 92, 231, 0.2);
  --border-light: rgba(255, 255, 255, 0.08);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.3);
  
  /* Glassmorphism */
  --glass-bg: rgba(30, 30, 70, 0.4);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(20px);
  
  /* Spacing */
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ==========================================
   Scoped Reset (inside .mao-wrap only)
   ========================================== */
.mao-wrap *,
.mao-wrap *::before,
.mao-wrap *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.mao-wrap {
  font-family: 'Cairo', sans-serif !important;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  /* Take over the WP admin content area, respecting admin sidebar */
  position: fixed;
  top: 32px; /* WP admin bar height */
  left: 0;
  right: 160px; /* WP admin sidebar width (RTL: sidebar is on the right) */
  bottom: 0;
  z-index: 99;
  overflow: hidden;
}

/* When WP admin sidebar is collapsed/folded */
.folded .mao-wrap {
  right: 36px;
}

/* Auto-fold at smaller screens */
@media screen and (max-width: 960px) {
  .auto-fold .mao-wrap {
    right: 36px;
  }
}

/* Mobile admin bar & no sidebar */
@media screen and (max-width: 782px) {
  .mao-wrap {
    top: 46px; /* Mobile admin bar */
    right: 0;
  }
}



/* Scrollbar */
.mao-wrap ::-webkit-scrollbar {
  width: 6px;
}

.mao-wrap ::-webkit-scrollbar-track {
  background: transparent;
}

.mao-wrap ::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.mao-wrap ::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ==========================================
   App Layout
   ========================================== */
.mao-wrap .app-container {
  display: flex;
  height: 100%;
  width: 100%;
}

/* ==========================================
   Sidebar
   ========================================== */
.mao-wrap .sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.mao-wrap .sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(108, 92, 231, 0.1), transparent);
  pointer-events: none;
}

.mao-wrap .sidebar-header {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.mao-wrap .sidebar-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-glow);
  animation: maoLogoPulse 3s ease-in-out infinite;
}

@keyframes maoLogoPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.3); }
  50% { box-shadow: 0 0 30px rgba(108, 92, 231, 0.5); }
}

.mao-wrap .sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.mao-wrap .sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mao-wrap .sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mao-wrap .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-normal);
  color: var(--text-secondary);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
}

.mao-wrap .nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  transform: scaleY(0);
  transition: var(--transition-normal);
}

.mao-wrap .nav-item:hover {
  background: rgba(108, 92, 231, 0.1);
  color: var(--text-primary);
}

.mao-wrap .nav-item.active {
  background: rgba(108, 92, 231, 0.15);
  color: var(--primary-light);
}

.mao-wrap .nav-item.active::before {
  transform: scaleY(1);
}

.mao-wrap .nav-item .icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.mao-wrap .nav-item .badge {
  margin-right: auto;
  margin-left: 0;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

.mao-wrap .sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.mao-wrap .sidebar-footer .nav-item {
  font-size: 0.85rem;
  padding: 10px 16px;
}

/* ==========================================
   Main Content
   ========================================== */
.mao-wrap .main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg-primary);
  position: relative;
}

.mao-wrap .main-content::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.05), transparent);
  pointer-events: none;
}

/* ==========================================
   Page Header
   ========================================== */
.mao-wrap .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.mao-wrap .page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 0;
  margin: 0;
  line-height: 1.4;
}

.mao-wrap .page-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================
   Cards
   ========================================== */
.mao-wrap .card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition-normal);
}

.mao-wrap .card:hover {
  border-color: rgba(108, 92, 231, 0.3);
  box-shadow: var(--shadow-glow);
}

.mao-wrap .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.mao-wrap .card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================
   Stats Cards Grid
   ========================================== */
.mao-wrap .stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.mao-wrap .stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition-normal);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.mao-wrap .stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.mao-wrap .stat-card.income::after { background: linear-gradient(90deg, var(--secondary), var(--secondary-light)); }
.mao-wrap .stat-card.expense::after { background: linear-gradient(90deg, var(--danger), var(--danger-light)); }
.mao-wrap .stat-card.profit::after { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.mao-wrap .stat-card.products::after { background: linear-gradient(90deg, var(--info), #a29bfe); }

.mao-wrap .stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
}

.mao-wrap .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.mao-wrap .stat-card.income .stat-icon { background: rgba(0, 184, 148, 0.15); }
.mao-wrap .stat-card.expense .stat-icon { background: rgba(225, 112, 85, 0.15); }
.mao-wrap .stat-card.profit .stat-icon { background: rgba(108, 92, 231, 0.15); }
.mao-wrap .stat-card.products .stat-icon { background: rgba(116, 185, 255, 0.15); }

.mao-wrap .stat-info {
  flex: 1;
}

.mao-wrap .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.mao-wrap .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.mao-wrap .stat-card.income .stat-value { color: var(--secondary); }
.mao-wrap .stat-card.expense .stat-value { color: var(--danger); }
.mao-wrap .stat-card.profit .stat-value { color: var(--primary-light); }
.mao-wrap .stat-card.products .stat-value { color: var(--info); }

/* ==========================================
   Buttons
   ========================================== */
.mao-wrap .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  line-height: 1.4;
  text-decoration: none;
}

.mao-wrap .btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.mao-wrap .btn:active::after {
  width: 300px;
  height: 300px;
}

.mao-wrap .btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.mao-wrap .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
  color: white;
}

.mao-wrap .btn-success {
  background: linear-gradient(135deg, var(--secondary), #00a884);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.mao-wrap .btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
  color: white;
}

.mao-wrap .btn-danger {
  background: linear-gradient(135deg, var(--danger), #d63031);
  color: white;
  box-shadow: 0 4px 15px rgba(225, 112, 85, 0.3);
}

.mao-wrap .btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(225, 112, 85, 0.4);
  color: white;
}

.mao-wrap .btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.mao-wrap .btn-ghost:hover {
  background: rgba(108, 92, 231, 0.1);
  color: var(--text-primary);
  border-color: var(--primary);
}

.mao-wrap .btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.mao-wrap .btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ==========================================
   Form Controls
   ========================================== */
.mao-wrap .form-group {
  margin-bottom: 16px;
}

.mao-wrap .form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.mao-wrap .form-input,
.mao-wrap .form-select,
.mao-wrap .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition-normal);
  direction: rtl;
}

.mao-wrap .form-input:focus,
.mao-wrap .form-select:focus,
.mao-wrap .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.mao-wrap .form-input::placeholder {
  color: var(--text-muted);
}

.mao-wrap .form-textarea {
  resize: vertical;
  min-height: 80px;
}

.mao-wrap .form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c6c9c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}

.mao-wrap .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==========================================
   Table
   ========================================== */
.mao-wrap .table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.mao-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.mao-wrap thead {
  background: rgba(108, 92, 231, 0.1);
}

.mao-wrap th {
  text-align: right;
  padding: 14px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.mao-wrap td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.mao-wrap tr:hover td {
  background: rgba(108, 92, 231, 0.05);
}

.mao-wrap .table-actions {
  display: flex;
  gap: 6px;
}

/* ==========================================
   Modal
   ========================================== */
.mao-wrap .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.mao-wrap .modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mao-wrap .modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition-normal);
  box-shadow: var(--shadow-lg);
}

.mao-wrap .modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.mao-wrap .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.mao-wrap .modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mao-wrap .modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(225, 112, 85, 0.1);
  color: var(--danger);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition-fast);
}

.mao-wrap .modal-close:hover {
  background: var(--danger);
  color: white;
}

.mao-wrap .modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================
   Search Bar
   ========================================== */
.mao-wrap .search-bar {
  position: relative;
  max-width: 320px;
}

.mao-wrap .search-bar .form-input {
  padding-right: 40px;
}

.mao-wrap .search-bar .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================
   Toolbar
   ========================================== */
.mao-wrap .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mao-wrap .toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================
   Filter Chips
   ========================================== */
.mao-wrap .filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mao-wrap .filter-chip {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mao-wrap .filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.mao-wrap .filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ==========================================
   Charts Container
   ========================================== */
.mao-wrap .charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.mao-wrap .chart-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ==========================================
   Empty State
   ========================================== */
.mao-wrap .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.mao-wrap .empty-state .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.mao-wrap .empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.mao-wrap .empty-state p {
  font-size: 0.85rem;
  max-width: 300px;
  margin: 0 auto;
}

/* ==========================================
   Notification / Toast
   ========================================== */
.mao-wrap .toast-container {
  position: fixed;
  top: 60px;
  left: 20px;
  z-index: 200000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mao-wrap .toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  min-width: 280px;
  animation: maoSlideIn 0.3s ease;
  color: var(--text-primary);
}

.mao-wrap .toast.success { border-right: 3px solid var(--secondary); }
.mao-wrap .toast.error { border-right: 3px solid var(--danger); }
.mao-wrap .toast.warning { border-right: 3px solid var(--warning); }

@keyframes maoSlideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* ==========================================
   Section pages (hidden by default)
   ========================================== */
.mao-wrap .page-section {
  display: none;
  animation: maoFadeIn 0.3s ease;
}

.mao-wrap .page-section.active {
  display: block;
}

@keyframes maoFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   Tags / Badges
   ========================================== */
.mao-wrap .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.mao-wrap .tag-income {
  background: rgba(0, 184, 148, 0.15);
  color: var(--secondary);
}

.mao-wrap .tag-expense {
  background: rgba(225, 112, 85, 0.15);
  color: var(--danger);
}

.mao-wrap .tag-warning {
  background: rgba(253, 203, 110, 0.15);
  color: var(--warning);
}

.mao-wrap .tag-info {
  background: rgba(116, 185, 255, 0.15);
  color: var(--info);
}

/* ==========================================
   Period Selector
   ========================================== */
.mao-wrap .period-selector {
  display: flex;
  background: rgba(20, 20, 50, 0.6);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--border-light);
}

.mao-wrap .period-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.mao-wrap .period-btn:hover {
  color: var(--text-primary);
}

.mao-wrap .period-btn.active {
  background: var(--primary);
  color: white;
}

/* ==========================================
   Reports Section
   ========================================== */
.mao-wrap .report-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.mao-wrap .report-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.mao-wrap .report-card .value {
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 8px;
}

.mao-wrap .report-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mao-wrap .report-card.income .value { color: var(--secondary); }
.mao-wrap .report-card.expense .value { color: var(--danger); }
.mao-wrap .report-card.profit .value { color: var(--primary-light); }
.mao-wrap .report-card.loss .value { color: var(--danger); }

/* ==========================================
   Category List in Reports
   ========================================== */
.mao-wrap .category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mao-wrap .category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.mao-wrap .category-item:last-child {
  border-bottom: none;
}

.mao-wrap .category-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.mao-wrap .category-amount {
  font-weight: 700;
  font-size: 0.95rem;
}

.mao-wrap .category-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.mao-wrap .category-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.mao-wrap .category-bar-fill.income {
  background: linear-gradient(90deg, var(--secondary), var(--secondary-light));
}

.mao-wrap .category-bar-fill.expense {
  background: linear-gradient(90deg, var(--danger), var(--danger-light));
}

/* ==========================================
   Date Range Picker
   ========================================== */
.mao-wrap .date-range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mao-wrap .date-range .separator {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mao-wrap .date-range .form-input {
  width: 160px;
}

/* ==========================================
   Low Stock Alert
   ========================================== */
.mao-wrap .alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(225, 112, 85, 0.1);
  border: 1px solid rgba(225, 112, 85, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: var(--danger-light);
  font-size: 0.85rem;
}

.mao-wrap .alert-banner .icon {
  font-size: 1.2rem;
}

/* ==========================================
   Loading Spinner
   ========================================== */
.mao-wrap .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: maoSpin 0.8s linear infinite;
}

@keyframes maoSpin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   Chart Placeholder & Bar Chart
   ========================================== */
.mao-wrap .chart-placeholder {
  width: 100%;
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.mao-wrap .bar-chart-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 10px 0;
  width: 100%;
}

.mao-wrap .bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.mao-wrap .bar {
  width: 70%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease;
  min-height: 4px;
  position: relative;
}

.mao-wrap .bar.income-bar {
  background: linear-gradient(180deg, var(--secondary), rgba(0, 184, 148, 0.4));
}

.mao-wrap .bar.expense-bar {
  background: linear-gradient(180deg, var(--danger), rgba(225, 112, 85, 0.4));
}

.mao-wrap .bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.mao-wrap .bar-value {
  font-size: 0.6rem;
  color: var(--text-muted);
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Donut chart */
.mao-wrap .donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 10px;
}

.mao-wrap .donut-chart {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mao-wrap .donut-center {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.mao-wrap .donut-center .value {
  font-size: 1rem;
  font-weight: 800;
}

.mao-wrap .donut-center .label {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.mao-wrap .donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mao-wrap .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.mao-wrap .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ==========================================
   Responsive Adjustments
   ========================================== */
@media (max-width: 1200px) {
  .mao-wrap .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .mao-wrap .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .mao-wrap .report-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .mao-wrap .sidebar {
    width: 70px;
  }
  
  .mao-wrap .sidebar .nav-item span:not(.icon):not(.badge),
  .mao-wrap .sidebar-title,
  .mao-wrap .sidebar-subtitle,
  .mao-wrap .sidebar .nav-item .badge {
    display: none;
  }
  
  .mao-wrap .sidebar-logo {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .mao-wrap .sidebar-header {
    padding: 16px 8px;
  }
  
  .mao-wrap .sidebar-nav {
    padding: 12px 8px;
  }
  
  .mao-wrap .nav-item {
    justify-content: center;
    padding: 12px;
  }
  
  .mao-wrap .nav-item .icon {
    margin: 0;
  }
}

/* ==========================================
   Animations
   ========================================== */
.mao-wrap .animate-count {
  transition: all 0.5s ease;
}

/* ==========================================
   Frontend Scoped Layout Adjustments
   ========================================== */
.mao-wrap.mao-frontend {
  right: 0 !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  position: fixed !important;
  z-index: 99999 !important;
  overflow: hidden !important;
}

body.admin-bar .mao-wrap.mao-frontend {
  top: 32px !important;
  bottom: 0 !important;
}

@media screen and (max-width: 782px) {
  body.admin-bar .mao-wrap.mao-frontend {
    top: 46px !important;
    bottom: 0 !important;
  }
}

/* ==========================================
   WordPress Theme Reset for System Pages
   ========================================== */
html.mao-system-page,
body.mao-system-page {
  background: #0f0f23 !important;
  background-color: #0f0f23 !important;
  overflow: hidden !important;
  height: 100% !important;
}

body.mao-system-page #page,
body.mao-system-page #content,
body.mao-system-page .site-content,
body.mao-system-page #primary,
body.mao-system-page #main,
body.mao-system-page article,
body.mao-system-page .entry-content,
body.mao-system-page .post-inner,
body.mao-system-page .container,
body.mao-system-page .edubin-container {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  transform: none !important;
  animation: none !important;
  filter: none !important;
}

/* Hide theme header/footer elements on system pages to keep it full-screen */
body.mao-system-page header,
body.mao-system-page footer,
body.mao-system-page .site-header,
body.mao-system-page .site-footer,
body.mao-system-page .navigation,
body.mao-system-page .breadcrumb-area,
body.mao-system-page #colophon {
  display: none !important;
}

/* ==========================================
   Mobile Responsive Overrides (max-width: 767px)
   ========================================== */
@media (max-width: 767px) {
  /* 1. App Layout: Convert sidebar to bottom navigation tab bar */
  .mao-wrap .app-container {
    flex-direction: column-reverse !important;
  }

  .mao-wrap .sidebar {
    width: 100% !important;
    height: 64px !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    flex-direction: row !important;
    border-left: none !important;
    border-top: 1px solid var(--border-light) !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4) !important;
    background: var(--bg-sidebar) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
  }

  .mao-wrap .sidebar::before {
    display: none !important;
  }

  .mao-wrap .sidebar-header {
    display: none !important; /* Hide logo header on mobile bottom bar */
  }

  .mao-wrap .sidebar-footer {
    display: none !important; /* Hide settings footer on mobile bottom bar */
  }

  .mao-wrap .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 8px !important;
    margin: 0 !important;
  }

  .mao-wrap .nav-item {
    flex: 1 !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 4px 0 !important;
    height: 100% !important;
    gap: 4px !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
  }

  .mao-wrap .sidebar .nav-item span:not(.icon):not(.badge) {
    display: block !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    color: #a2a2d0 !important;
    line-height: 1 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
  }

  .mao-wrap .sidebar .nav-item.active span:not(.icon):not(.badge) {
    color: var(--primary-light) !important;
  }

  .mao-wrap .nav-item .icon {
    font-size: 1.3rem !important;
    margin: 0 !important;
  }

  /* 2. Main Content Viewport Adjustments */
  .mao-wrap .main-content {
    padding: 16px 12px 80px 12px !important; /* Add bottom margin to avoid navbar overlap */
    width: 100% !important;
  }

  /* 3. Welcome Section scale-down */
  .mao-wrap .welcome-section {
    padding: 16px !important;
    margin-bottom: 16px !important;
  }

  .mao-wrap .welcome-section h1 {
    font-size: 1.3rem !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
  }

  .mao-wrap .welcome-section p {
    font-size: 0.8rem !important;
  }

  /* 4. Page Header scale-down */
  .mao-wrap .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .mao-wrap .page-header h1 {
    font-size: 1.4rem !important;
  }

  /* 5. Stats Cards Grid: scaled down for mobile screens */
  .mao-wrap .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .mao-wrap .stat-card {
    padding: 12px 10px !important;
    gap: 8px !important;
    flex-direction: row !important;
    align-items: center !important;
  }

  .mao-wrap .stat-card .icon-box {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.1rem !important;
    margin: 0 !important;
  }

  .mao-wrap .stat-card .stat-info {
    text-align: right !important;
  }

  .mao-wrap .stat-card .num {
    font-size: 1.15rem !important;
    margin-bottom: 2px !important;
  }

  .mao-wrap .stat-card .label {
    font-size: 0.7rem !important;
  }

  /* 6. Form Row: stack inputs vertically */
  .mao-wrap .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* 7. Date Range: stack start/end dates */
  .mao-wrap .date-range {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .mao-wrap .date-range .form-input {
    width: 100% !important;
  }

  .mao-wrap .date-range .separator {
    display: none !important;
  }

  /* 8. Table Container: force minimum width for scrolling */
  .mao-wrap .table-container table {
    min-width: 600px !important;
  }

  .mao-wrap .table-container {
    margin-bottom: 16px !important;
  }

  /* 9. Toolbars & Filters: Stack vertically */
  .mao-wrap .toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .mao-wrap .toolbar-group {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .mao-wrap .toolbar-group .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .mao-wrap .search-bar {
    width: 100% !important;
  }

  /* 10. Modals: tighter padding */
  .mao-wrap .modal {
    padding: 16px !important;
  }
}
