/* ==========================================================================
   Ubay.shop — Commercial SaaS Admin Dashboard Styles
   ========================================================================== */

.adm-shell {
  display: flex;
  min-height: 100vh;
  background: var(--adm-bg);
}

/* Collapsible Dark Navy Sidebar */
.adm-sidebar {
  width: 262px;
  background: var(--adm-sidebar);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.22s ease, transform 0.22s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.adm-sidebar.collapsed {
  width: 74px;
}
.adm-sidebar.collapsed .adm-brand-text,
.adm-sidebar.collapsed .adm-nav-label,
.adm-sidebar.collapsed .adm-nav-badge,
.adm-sidebar.collapsed .adm-nav-group-label,
.adm-sidebar.collapsed .adm-user-meta {
  display: none;
}

.adm-sidebar-header {
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.adm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
}
.adm-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563EB, #0EA5E9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}
.adm-brand-text span { color: #60A5FA; }

.adm-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.adm-nav-group-label {
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748B;
  padding: 12px 12px 5px;
}

.adm-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #CBD5E1;
  font-size: 0.855rem;
  font-weight: 600;
  text-align: left;
  transition: all 0.15s ease;
}
.adm-nav-btn:hover {
  background: var(--adm-sidebar-hover);
  color: #fff;
}
.adm-nav-btn.active {
  background: var(--adm-sidebar-active);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.adm-nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-nav-badge {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.adm-nav-badge.warn { background: #F59E0B; color: #0F172A; }
.adm-nav-badge.danger { background: #EF4444; color: #fff; }

.adm-sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Main Content Area */
.adm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.adm-topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--adm-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 25;
}
.adm-topbar-left { display: flex; align-items: center; gap: 12px; }
.adm-topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--ub-navy); }
.adm-topbar-right { display: flex; align-items: center; gap: 10px; }

.adm-content {
  padding: 24px;
  flex: 1;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* KPI Stat Cards (8 Overview Cards) */
.adm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.adm-kpi-card {
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.16s, box-shadow 0.16s;
}
.adm-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.adm-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ub-muted);
  margin-bottom: 6px;
}
.adm-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ub-navy);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.adm-kpi-sub {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--ub-muted);
  font-weight: 500;
}
.adm-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Panels & Cards */
.adm-card {
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
}
.adm-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.adm-card-header h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ub-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.adm-card-body { padding: 20px; }

.adm-charts-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Data Tables */
.adm-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.adm-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ub-muted);
  background: var(--ub-gray-50);
  border-bottom: 1px solid var(--adm-border);
  white-space: nowrap;
}
.adm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ub-gray-100);
  vertical-align: middle;
}
.adm-table tr:hover td { background: #F8FAFC; }

/* Filter Bar & Tabs */
.adm-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.adm-tabs-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.adm-tabs-4 .adm-tab {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding: 10px 10px;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: all 0.16s ease;
}
.adm-tabs-4 .adm-tab:hover:not(.active) {
  border-color: var(--ub-primary);
  color: var(--ub-primary);
  background: var(--ub-primary-soft);
}

.ord-filter-bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
  flex: 1;
  min-width: 240px;
}
.ord-date-pair {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ord-date-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ord-date-field label {
  font-size: 0.66rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  line-height: 1;
}
.ord-export-pair {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.adm-tab {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--adm-border);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ub-slate);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.adm-tab.active {
  background: var(--ub-primary);
  color: #fff;
  border-color: var(--ub-primary);
}
.adm-tab .cnt {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.08);
}
.adm-tab.active .cnt { background: rgba(255, 255, 255, 0.22); }

.adm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.adm-search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 400px;
}
.adm-search-box input { padding-left: 36px; }
.adm-search-box .search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ub-muted);
}

/* Pagination */
.adm-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--adm-border);
  background: var(--ub-gray-50);
  font-size: 0.82rem;
  color: var(--ub-muted);
  flex-wrap: wrap;
  gap: 10px;
}
.adm-page-btns { display: flex; gap: 5px; }

/* Product Grid / Variation Matrix */
.adm-prod-thumb {
  width: 46px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--adm-border);
}
.adm-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.adm-img-tile {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 3/4;
  border: 1.5px solid var(--adm-border);
}
.adm-img-tile img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.adm-img-tile .rm-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Integration Status Cards */
.adm-int-card {
  border: 1.5px solid var(--adm-border);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.adm-int-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Fraud Score Meter */
.fraud-meter {
  width: 72px;
  height: 6px;
  border-radius: 999px;
  background: var(--ub-gray-200);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.fraud-meter-fill { height: 100%; border-radius: 999px; }

/* Login Screen */
.adm-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 60%, #1D4ED8 100%);
}
.adm-login-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 20px;
  padding: 34px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
}

/* Responsive Admin */
@media (max-width: 1180px) {
  .adm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .adm-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  .adm-sidebar.mobile-open { transform: translateX(0); }
  .adm-topbar { padding: 0 12px; gap: 8px; }
  .adm-topbar h1 { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .adm-content { padding: 12px; }
  .adm-kpi-grid { grid-template-columns: 1fr; }
  .adm-tabs-4 { gap: 5px; margin-bottom: 12px; }
  .adm-tabs-4 .adm-tab {
    padding: 8px 4px;
    font-size: 0.7rem;
    gap: 3px;
    border-radius: 9px;
  }
  .adm-tabs-4 .adm-tab .ord-tab-word { display: none; }
  .adm-tabs-4 .adm-tab .cnt {
    padding: 1px 5px;
    font-size: 0.64rem;
  }
  .adm-card-header { padding: 12px; gap: 10px; }
  .ord-filter-bar { width: 100%; min-width: 0; flex-direction: column; align-items: stretch; gap: 8px; }
  .ord-filter-bar .adm-search-box { width: 100% !important; max-width: none !important; min-width: 0 !important; }
  .ord-date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .ord-date-pair input { width: 100% !important; }
  .ord-export-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .ord-export-pair .btn { width: 100%; justify-content: center; }
}
