/* ========================================================
   4 Girl Store / Hoor Beauty - Ultra-Luxurious Admin Dashboard
   SaaS-Grade UI inspired by Shopify, Stripe & Salla
   ======================================================== */

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

:root {
  --admin-primary: #8b485d;
  --admin-primary-dark: #683042;
  --admin-primary-light: #fdf2f4;
  --admin-accent: #c4974f;
  
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2a374e;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  
  --body-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-hover: 0 12px 30px -4px rgba(15, 23, 42, 0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  direction: rtl;
  text-align: right;
  background-color: var(--body-bg);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ========================================================
   Sidebar
   ======================================================== */
.admin-sidebar {
  width: 270px;
  background: var(--sidebar-bg);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid #1e293b;
  z-index: 50;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 24px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #1e293b;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--admin-primary) 0%, #b27a58 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(178, 122, 88, 0.3);
}

.sidebar-brand-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand-tagline {
  font-size: 11px;
  color: var(--admin-accent);
  font-weight: 600;
}

.sidebar-nav {
  padding: 20px 14px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px 4px;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}

.sidebar-item a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-item.active a {
  background: linear-gradient(135deg, rgba(139, 72, 93, 0.9) 0%, rgba(178, 122, 88, 0.85) 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(139, 72, 93, 0.25);
}

.sidebar-item-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-icon {
  font-size: 18px;
  width: 22px;
  display: inline-flex;
  justify-content: center;
}

.sidebar-badge {
  background: var(--admin-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #090e17;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #334155;
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid var(--admin-accent);
}

/* ========================================================
   Main View & Header
   ======================================================== */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--body-bg);
}

.admin-topbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-content-area {
  padding: 30px;
  flex-grow: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ========================================================
   KPI Stats Grid
   ======================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #cbd5e1;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--admin-primary), var(--admin-accent));
  opacity: 0;
  transition: var(--transition);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 20px;
}

.kpi-trend.positive {
  background: var(--success-bg);
  color: var(--success);
}

.kpi-trend.neutral {
  background: #f1f5f9;
  color: var(--text-secondary);
}

.kpi-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-icon-rose { background: #fdf2f4; color: var(--admin-primary); }
.kpi-icon-emerald { background: var(--success-bg); color: var(--success); }
.kpi-icon-amber { background: var(--warning-bg); color: var(--warning); }
.kpi-icon-blue { background: var(--info-bg); color: var(--info); }

/* ========================================================
   Glass & Elevated Cards
   ======================================================== */
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 25px;
  overflow: hidden;
}

.admin-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  background: #ffffff;
}

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card-body {
  padding: 24px;
}

/* ========================================================
   Modern Interactive Tables
   ======================================================== */
.modern-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

table.modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  text-align: right;
}

table.modern-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.modern-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  color: #334155;
  vertical-align: middle;
  transition: background 0.15s;
}

table.modern-table tr:hover td {
  background: #fdfcfb;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.status-new { background: #dbeafe; color: #1e40af; }
.status-pill.status-confirmed { background: #dcfce7; color: #166534; }
.status-pill.status-preparing { background: #fef3c7; color: #92400e; }
.status-pill.status-shipped { background: #e0e7ff; color: #3730a3; }
.status-pill.status-delivered { background: #d1fae5; color: #065f46; }
.status-pill.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-pill.status-returned { background: #f1f5f9; color: #475569; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ========================================================
   Buttons & Form Controls
   ======================================================== */
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-admin-primary {
  background: linear-gradient(135deg, var(--admin-primary) 0%, #a8586f 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(139, 72, 93, 0.25);
}

.btn-admin-primary:hover {
  background: linear-gradient(135deg, var(--admin-primary-dark) 0%, var(--admin-primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 72, 93, 0.35);
}

.btn-admin-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid var(--border-color);
}

.btn-admin-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-admin-success { background: var(--success); color: #fff; }
.btn-admin-danger { background: var(--danger); color: #fff; }

.btn-admin-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.form-control-admin {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
}

.form-control-admin:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(139, 72, 93, 0.12);
}

/* ========================================================
   Products Grid in Admin
   ======================================================== */
.admin-products-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.admin-product-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.admin-product-item:hover {
  box-shadow: var(--shadow-card);
  border-color: #cbd5e1;
}

.admin-product-img-box {
  aspect-ratio: 16/10;
  background: #faf7f5;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.admin-product-img-box img {
  max-height: 100%;
  object-fit: contain;
}

.admin-product-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

/* ========================================================
   Print Styles for Order Invoices
   ======================================================== */
@media print {
  .admin-sidebar, .admin-topbar, .btn-no-print {
    display: none !important;
  }
  body, .admin-layout, .admin-main, .admin-content-area {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .admin-card {
    border: none !important;
    box-shadow: none !important;
  }
}
