/* ==========================================================================
   Banki Plus (بنكي بلس) - Admin Dashboard CSS Theme & Components
   ========================================================================== */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: #f1f5f9;
  font-family: var(--font-family);
  direction: rtl;
}

/* Admin Sidebar */
.admin-sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #1c3e8d 100%);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-header {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.sidebar-logo {
  font-family: 'Cairo', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-white);
}

.sidebar-logo span {
  color: var(--accent-gold);
}

.sidebar-badge {
  background: rgba(78, 119, 214, 0.3);
  border: 1px solid var(--primary-light);
  color: #a5f3fc;
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.sidebar-menu {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.sidebar-menu-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 800;
  padding: 0.5rem 0.75rem;
  letter-spacing: 0.5px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sidebar-item:hover, .sidebar-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-white);
}

.sidebar-item.active {
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(78, 119, 214, 0.3);
}

.sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Admin Main Content Wrapper */
.admin-main {
  margin-right: 280px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Admin Top Bar */
.admin-topbar {
  height: 75px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.topbar-title-wrap h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.topbar-user-area {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-alt);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-dark);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

/* Admin Content Body */
.admin-content {
  padding: 2rem;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.metric-info h4 {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-icon.blue { background: rgba(28, 62, 141, 0.1); color: var(--primary-dark); }
.metric-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.metric-icon.gold { background: rgba(245, 158, 11, 0.1); color: var(--accent-gold); }
.metric-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

/* Admin Data Card & Tables */
.admin-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  overflow: hidden;
}

.admin-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.admin-card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th {
  background: #f8fafc;
  padding: 1rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 0.95rem;
}

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

.table-img-thumb {
  width: 60px;
  height: 42px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.action-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.btn-icon.edit { background: rgba(78, 119, 214, 0.1); color: var(--primary-light); }
.btn-icon.edit:hover { background: var(--primary-light); color: var(--text-white); }

.btn-icon.delete { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.btn-icon.delete:hover { background: var(--accent-red); color: var(--text-white); }

.btn-icon.view { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.btn-icon.view:hover { background: var(--accent-green); color: var(--text-white); }

/* Form Controls & Modal Windows */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.95rem;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(78, 119, 214, 0.15);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Modal Overlay */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
  padding: 1.5rem;
}

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

.admin-modal {
  background: var(--bg-surface);
  width: 100%;
  max-width: 680px;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #fafafa;
}

.img-preview-box {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 0.5rem;
  background: var(--bg-main);
}

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

@media (max-width: 1024px) {
  .admin-sidebar {
    width: 80px;
  }
  .sidebar-logo-text, .sidebar-menu-title, .sidebar-item span {
    display: none;
  }
  .admin-main {
    margin-right: 80px;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .admin-content {
    padding: 1rem;
  }
}

/* ==========================================================================
   Admin Table Custom Pagination Controls
   ========================================================================== */
.admin-table-footer .pagination-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-table-footer .page-link {
  min-width: 36px;
  height: 36px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm, 6px);
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--primary-dark, #0b1736);
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  user-select: none;
}

.admin-table-footer .page-link:hover:not(.disabled):not(.active) {
  background: #eef2ff;
  border-color: var(--primary-light, #4e77d6);
  color: var(--primary-light, #1c3e8d);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(28, 62, 141, 0.12);
}

.admin-table-footer .page-link.active {
  background: linear-gradient(135deg, var(--primary-dark, #0b1736) 0%, var(--primary-color, #1c3e8d) 100%);
  color: #ffffff;
  border-color: var(--primary-dark, #0b1736);
  box-shadow: 0 3px 8px rgba(11, 23, 54, 0.25);
}

.admin-table-footer .page-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
}

