/* =============================================
   ProductVerify — Admin Panel Styles
   ============================================= */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --transition: all .2s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- SIDEBAR ---- */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: var(--transition);
  overflow-y: auto; overflow-x: hidden;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-icon-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-logo { height: 38px; border-radius: 8px; }
.sidebar-brand-text { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.05rem; color: white; letter-spacing: -.3px; }

.sidebar-nav-label {
  font-size: .65rem; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: #475569;
  padding: .75rem 1.25rem .3rem;
}

.sidebar-nav { list-style: none; padding: 0 .75rem; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 9px;
  font-size: .875rem; font-weight: 500;
  transition: var(--transition);
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-nav a.active {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white; box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: .75rem;
}

.admin-info { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.admin-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .8rem; flex-shrink: 0;
}
.admin-name { font-size: .8rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role { font-size: .68rem; color: #64748b; }
.sidebar-logout {
  color: #475569; transition: var(--transition);
  padding: .4rem; border-radius: 6px; text-decoration: none;
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239,68,68,.1); }

/* ---- MAIN CONTENT ---- */
#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: var(--transition);
}

/* ---- TOPBAR ---- */
.admin-topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 999;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem;
  padding: .4rem .5rem; border-radius: 7px;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--body-bg); color: var(--text-main); }

.topbar-breadcrumb {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: var(--text-muted); flex: 1;
}
.breadcrumb-home { color: var(--primary); }
.breadcrumb-sep { font-size: .6rem; }

.topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--body-bg);
  color: var(--text-muted); text-decoration: none;
  transition: var(--transition);
}
.topbar-btn:hover { background: var(--primary); color: white; }
.topbar-user {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 600; color: var(--text-main);
}
.topbar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-size: .75rem;
}

/* ---- PAGE BODY ---- */
.page-body { padding: 1.75rem; flex: 1; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-title { font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--text-main); }
.page-subtitle { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }

/* Table scroll wrapper — keeps table full-width on mobile like PC */
.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}
.table-scroll-wrap .pv-table { min-width: 600px; }

/* ---- STAT CARDS ---- */
.stat-card {
  background: white; border-radius: var(--radius);
  padding: 1.5rem; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1.25rem;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: white;
}
.stat-value { font-family: 'Poppins', sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.stat-bg-icon { position: absolute; right: -10px; top: 50%; transform: translateY(-50%); font-size: 5rem; opacity: .05; }

.stat-blue  .stat-icon { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.stat-blue  .stat-value { color: #2563eb; }
.stat-green .stat-icon { background: linear-gradient(135deg, #16a34a, #22c55e); }
.stat-green .stat-value { color: #16a34a; }
.stat-purple .stat-icon { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.stat-purple .stat-value { color: #7c3aed; }
.stat-orange .stat-icon { background: linear-gradient(135deg, #ea580c, #f97316); }
.stat-orange .stat-value { color: #ea580c; }

/* ---- CARD PANEL ---- */
.card-panel {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: .95rem; font-weight: 600; font-family: 'Poppins', sans-serif; color: var(--text-main); }
.panel-link { font-size: .8rem; color: var(--primary); text-decoration: none; font-weight: 500; }
.panel-link:hover { text-decoration: underline; }
.panel-badge { font-size: .75rem; background: #f0f9ff; color: #0369a1; padding: .25rem .6rem; border-radius: 20px; font-weight: 600; }

/* ---- TABLES ---- */
.pv-table { margin: 0; font-size: .85rem; }
.pv-table thead th {
  background: #f8fafc; font-weight: 600; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border); padding: .75rem 1rem;
}
.pv-table tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--border); }
.pv-table tbody tr:hover { background: #f8fafc; }

.product-cell { display: flex; align-items: center; gap: .75rem; }
.product-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; border: 1.5px solid var(--border); }
.product-thumb-placeholder {
  width: 38px; height: 38px; border-radius: 8px; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center; color: #cbd5e1; border: 1.5px solid var(--border);
}
.product-name { font-weight: 500; color: var(--text-main); }
.category-badge {
  background: #eff6ff; color: #2563eb; font-size: .72rem;
  font-weight: 600; padding: .25rem .6rem; border-radius: 20px;
}

/* Action buttons in table */
.btn-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; background: #f8fafc;
  color: var(--text-muted); text-decoration: none;
  font-size: .8rem; transition: var(--transition); border: 1px solid var(--border);
}
.btn-icon:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-icon.danger:hover { background: #ef4444; color: white; border-color: #ef4444; }
.btn-icon.success:hover { background: #16a34a; color: white; border-color: #16a34a; }

/* ---- SCAN LIST ---- */
.scan-list { padding: .75rem; }
.scan-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem .5rem; border-radius: 9px; transition: var(--transition);
}
.scan-item:hover { background: #f8fafc; }
.scan-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: #eff6ff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .85rem;
}
.scan-product { font-size: .83rem; font-weight: 500; }
.scan-meta { font-size: .7rem; color: var(--text-muted); }
.scan-time { font-size: .7rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* ---- FORMS ---- */
.form-panel { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem; }
.form-section-title {
  font-size: .7rem; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: #94a3b8;
  border-bottom: 1.5px solid var(--border); padding-bottom: .5rem; margin-bottom: 1.25rem;
}
.form-label { font-size: .83rem; font-weight: 600; color: #374151; margin-bottom: .35rem; }
.form-control, .form-select {
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  font-size: .875rem; padding: .6rem .9rem; color: var(--text-main);
  transition: var(--transition); background: white;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12); outline: none;
}
.form-control.is-invalid { border-color: #ef4444; }
.required-star { color: #ef4444; }

/* ---- BUTTONS ---- */
.btn-primary { background: linear-gradient(135deg, var(--primary), #3b82f6); border: none; font-weight: 600; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.btn-success { background: linear-gradient(135deg, #16a34a, #22c55e); border: none; font-weight: 600; }
.btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); border: none; font-weight: 600; }
.btn-outline-secondary { border: 1.5px solid var(--border); font-weight: 500; }

/* ---- LOGIN PAGE ---- */
.login-page { font-family: 'Poppins', sans-serif; }
.login-particles { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.3), transparent);
  animation: float 8s ease-in-out infinite;
}
.particle:nth-child(1) { width: 200px; height: 200px; top: 10%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { width: 150px; height: 150px; top: 60%; right: 15%; animation-delay: 2s; }
.particle:nth-child(3) { width: 100px; height: 100px; bottom: 20%; left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { width: 250px; height: 250px; top: 30%; right: 30%; animation-delay: 1s; }
.particle:nth-child(5) { width: 80px; height: 80px; bottom: 10%; right: 10%; animation-delay: 3s; }

@keyframes float { 0%,100% { transform: translateY(0) scale(1); opacity: .4; } 50% { transform: translateY(-20px) scale(1.1); opacity: .7; } }

.login-card {
  background: white; border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  padding: 2.5rem; width: 100%; max-width: 420px;
  position: relative; z-index: 10;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-logo-icon {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.8rem; margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(37,99,235,.4);
}
.login-title { font-size: 1.6rem; font-weight: 700; color: #0f172a; margin: 0; }
.login-subtitle { font-size: .85rem; color: #64748b; margin-top: 4px; }

.form-floating label { font-size: .875rem; color: #64748b; }
.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #94a3b8; cursor: pointer; z-index: 5; padding: .25rem;
}
.password-toggle:hover { color: var(--primary); }

.btn-login {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white; border: none; padding: .75rem; border-radius: 12px;
  font-weight: 600; font-size: 1rem; transition: var(--transition);
  box-shadow: 0 4px 15px rgba(37,99,235,.35);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37,99,235,.45); color: white; }
.login-footer { text-align: center; }
.alert-sm { font-size: .85rem; padding: .6rem .9rem; border-radius: 9px; }

/* ---- FIELD BUILDER ---- */
.field-row {
  display: flex; align-items: center; gap: .75rem;
  background: #f8fafc; border: 1.5px solid var(--border);
  border-radius: 10px; padding: .75rem 1rem; margin-bottom: .5rem;
  cursor: grab; transition: var(--transition);
}
.field-row:hover { border-color: var(--primary); background: #eff6ff; }
.field-handle { color: #cbd5e1; font-size: 1rem; cursor: grab; }
.field-info { flex: 1; }
.field-label-text { font-size: .85rem; font-weight: 600; color: var(--text-main); }
.field-meta { font-size: .72rem; color: var(--text-muted); }
.field-type-badge {
  background: #eff6ff; color: var(--primary);
  font-size: .7rem; font-weight: 600; padding: .2rem .5rem; border-radius: 6px;
}
.required-indicator { color: #ef4444; font-size: .7rem; font-weight: 600; }

/* ---- GENERATE OUTPUT ---- */
.generate-output {
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  border: 2px solid #bbf7d0; border-radius: 14px; padding: 1.5rem;
}
.generate-output .public-link-box {
  background: white; border: 1.5px solid var(--border);
  border-radius: 9px; padding: .6rem 1rem;
  font-family: monospace; font-size: .85rem; word-break: break-all;
}
.qr-preview { max-width: 160px; border-radius: 5px; border: 2px solid var(--border); }
.barcode-preview { max-width: 240px; border: 2px solid var(--border); }

/* ---- SIDEBAR COLLAPSED ---- */
body.sidebar-collapsed #sidebar { width: 68px; }
body.sidebar-collapsed #sidebar .sidebar-brand-text,
body.sidebar-collapsed #sidebar .sidebar-nav-label,
body.sidebar-collapsed #sidebar span,
body.sidebar-collapsed #sidebar .admin-details { display: none !important; }
body.sidebar-collapsed #sidebar .sidebar-nav a { justify-content: center; padding: .65rem 0; }
body.sidebar-collapsed #sidebar .sidebar-brand { padding: 1rem .8rem; justify-content: center; }
body.sidebar-collapsed #sidebar .admin-info { justify-content: center; }
body.sidebar-collapsed #main-content { margin-left: 68px; }

/* ---- STATUS COLORS ---- */
.badge.bg-success-subtle { background: #dcfce7 !important; }
.badge.bg-warning-subtle { background: #fef9c3 !important; }
.text-purple { color: #7c3aed !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  body.sidebar-open #sidebar { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .page-body { padding: .85rem; }
  .stat-value { font-size: 1.5rem; }

  /* Compact page header on mobile */
  .page-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }
  .page-header > div:first-child { flex: 1; min-width: 0; }
  .page-title { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-subtitle { font-size: .75rem; }
  .page-header .d-flex { gap: 6px !important; flex-shrink: 0; }
  .page-header .btn, .page-header .pv-btn {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }

  /* Tables: show as horizontally scrollable — full PC layout on mobile */
  .table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll-wrap .pv-table { min-width: 580px; }

  /* Stat cards compact */
  .stat-card { padding: 1rem; }
  .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
}
