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

body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f4f6f9; color: #2a2a2a; font-size: 0.92rem; }

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

/* Sidebar */
.sidebar {
  width: 230px;
  background: #1e2a38;
  color: #c8d6e5;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 1rem;
}
.brand-icon { font-size: 1.6rem; }
.sidebar-brand strong { display: block; color: #fff; font-size: 1rem; }
.sidebar-brand small  { color: #7a9bb5; font-size: 0.75rem; }

.sidebar-nav { display: flex; flex-direction: column; padding: 12px 0; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #a0b4c8;
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: rgba(95,138,131,0.2); color: #7ecdc4; border-left-color: #5f8a83; }

.sidebar-logout {
  display: block;
  padding: 14px 18px;
  color: #e07070;
  text-decoration: none;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  transition: background 0.2s;
}
.sidebar-logout:hover { background: rgba(255,100,100,0.1); }

/* Main */
.admin-main { margin-left: 230px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.admin-topbar {
  background: #fff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e8ecf0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.page-title { font-size: 1.2rem; font-weight: 700; color: #1e2a38; }
.admin-user  { font-size: 0.85rem; color: #666; }

.admin-content { padding: 24px 28px; }

/* Cards */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.card-title { font-size: 1rem; font-weight: 700; color: #1e2a38; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon { font-size: 2rem; }
.stat-info strong { display: block; font-size: 1.6rem; font-weight: 800; color: #1e2a38; }
.stat-info span   { font-size: 0.8rem; color: #888; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th { background: #f4f6f9; padding: 10px 14px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #e8ecf0; white-space: nowrap; }
tbody td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-green  { background: #e8f5e9; color: #2e7d32; }
.badge-red    { background: #fdecea; color: #c0392b; }
.badge-teal   { background: #e0f2f1; color: #00695c; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-gray   { background: #f0f0f0; color: #666; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; text-decoration: none; transition: all 0.2s; }
.btn-primary  { background: #5f8a83; color: #fff; }
.btn-primary:hover  { background: #4a6e68; }
.btn-danger   { background: #e74c3c; color: #fff; }
.btn-danger:hover   { background: #c0392b; }
.btn-warning  { background: #f39c12; color: #fff; }
.btn-warning:hover  { background: #d68910; }
.btn-secondary { background: #ecf0f1; color: #555; }
.btn-secondary:hover { background: #dde1e3; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: #444; }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 9px 12px;
  border: 1.5px solid #dde1e3;
  border-radius: 7px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #fafbfc;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: #5f8a83; background: #fff; }
.form-group textarea { resize: vertical; min-height: 90px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; font-weight: 500; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4caf50; }
.alert-danger   { background: #fdecea; color: #c0392b; border-left: 4px solid #e74c3c; }
.alert-info     { background: #e3f2fd; color: #1565c0; border-left: 4px solid #2196f3; }

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

/* Product image thumb */
.thumb { width: 48px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #eee; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e2a38, #2c3e50); }
.login-box { background: #fff; border-radius: 14px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo span { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.login-logo h2 { font-size: 1.3rem; color: #1e2a38; }
.login-logo small { color: #888; font-size: 0.82rem; }

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .admin-main { margin-left: 200px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 16px; }
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}
.filter-input {
  padding: 8px 12px;
  border: 1.5px solid #dde1e3;
  border-radius: 7px;
  font-size: 0.88rem;
  outline: none;
  min-width: 220px;
  flex: 1;
  transition: border-color 0.2s;
}
.filter-input:focus { border-color: #5f8a83; }
.filter-select {
  padding: 8px 12px;
  border: 1.5px solid #dde1e3;
  border-radius: 7px;
  font-size: 0.88rem;
  outline: none;
  background: #fafbfc;
  cursor: pointer;
  min-width: 140px;
}

/* Bulk Action Bar */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff8e1;
  border: 1.5px solid #f39c12;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bulk-bar span { font-weight: 700; color: #e65100; font-size: 0.88rem; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 0 4px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1.5px solid #dde1e3;
  background: #fff;
  color: #444;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}
.page-btn:hover { background: #5f8a83; color: #fff; border-color: #5f8a83; }
.page-btn.active { background: #5f8a83; color: #fff; border-color: #5f8a83; font-weight: 700; }
.page-info { margin-left: 8px; font-size: 0.82rem; color: #888; }

/* Image Uploader */
.upload-zone {
  border: 2px dashed #c0cdd8;
  border-radius: 10px;
  background: #f8fafc;
  transition: all 0.2s;
  cursor: pointer;
}
.upload-zone.drag-over {
  border-color: #5f8a83;
  background: #eef6f5;
}
.upload-zone-inner {
  padding: 32px 20px;
  text-align: center;
  color: #888;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-zone-inner p { font-size: 0.92rem; font-weight: 500; color: #555; }
.upload-zone-inner small { font-size: 0.78rem; }
.upload-zone:hover { border-color: #5f8a83; background: #eef6f5; }

/* Progress bar */
.progress-bar-wrap {
  height: 6px;
  background: #e8ecf0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-bar {
  height: 100%;
  background: #5f8a83;
  border-radius: 4px;
  width: 0;
  transition: width 0.3s;
}

/* Image preview grid */
.img-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 14px;
  min-height: 10px;
}
.img-preview-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e8ecf0;
  background: #f4f6f9;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s;
  aspect-ratio: 3/4;
}
.img-preview-item:hover { border-color: #5f8a83; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

.img-remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  background: rgba(231,76,60,0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}
.img-remove-btn:hover { background: #c0392b; }

.img-primary-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: #5f8a83;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
}
