/* ═══════════════════════════════════════════════════════════════
   KatalogPro — Admin CSS
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary:   #4A6CF7;
  --primary-d: #3451d1;
  --secondary: #8B5CF6;
  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --dark:      #1e1e2e;
  --dark-2:    #2a2a3e;
  --dark-3:    #363650;
  --text:      #e2e8f0;
  --text-m:    #94a3b8;
  --card-bg:   #ffffff;
  --sidebar-w: 240px;
  --radius:    14px;
  --shadow:    0 4px 20px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.15);
}

* { box-sizing: border-box; }

body {
  background: #f1f5f9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #334155;
  margin: 0;
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--dark-3);
}

.brand-icon { font-size: 1.8rem; }
.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-m);
  text-decoration: none;
  font-weight: 500;
  font-size: .92rem;
  border-left: 3px solid transparent;
  transition: all .2s;
}

.sidebar-link:hover {
  color: #fff;
  background: var(--dark-2);
  border-left-color: var(--primary);
}

.sidebar-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(74,108,247,.2), transparent);
  border-left-color: var(--primary);
}

.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--dark-3);
  text-align: center;
}

/* ─── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-area {
  padding: 28px;
  flex: 1;
}

/* ─── CARDS ─────────────────────────────────────────────────── */
.card {
  border: 1px solid #e8ecf4;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

.card-header-custom {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── STATS CARDS ───────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  border: 1px solid #e8ecf4;
  text-decoration: none;
  color: inherit;
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}

.stat-icon.blue   { background: rgba(74,108,247,.12); }
.stat-icon.purple { background: rgba(139,92,246,.12); }
.stat-icon.green  { background: rgba(16,185,129,.12); }
.stat-icon.orange { background: rgba(245,158,11,.12); }

.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: #1e293b; }
.stat-label { font-size: .82rem; color: #64748b; margin-top: 4px; font-weight: 500; }

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn-gradient {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff !important;
  border: none;
  font-weight: 600;
}
.btn-gradient:hover { opacity: .9; color: #fff; }

/* ─── IMAGE GRID (pool) ─────────────────────────────────────── */
.img-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.img-pool-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color .2s;
  aspect-ratio: 1;
  background: #f8fafc;
}

.img-pool-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.img-pool-item:hover  { border-color: var(--primary); }
.img-pool-item.selected { border-color: var(--primary); }
.img-pool-item.selected::after {
  content: '✓';
  position: absolute; top: 6px; right: 6px;
  background: var(--primary);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}

.img-pool-item .img-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff;
  font-size: .7rem;
  padding: 18px 6px 5px;
  text-align: center;
  word-break: break-all;
}

/* ─── UPLOAD ZONE ───────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #f8fafc;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(74,108,247,.04);
}

.upload-zone .upload-icon { font-size: 3rem; display: block; margin-bottom: 8px; }

/* ─── PRODUCT CARD ──────────────────────────────────────────── */
.product-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #e8ecf4;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.product-card-img {
  width: 100%; aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #f1f5f9;
}

.product-card-body {
  padding: 12px;
}

.product-card-name {
  font-weight: 600;
  font-size: .9rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
}

.product-card-cat {
  font-size: .72rem;
  color: #64748b;
  margin-top: 2px;
}

/* ─── COLOR PICKER ──────────────────────────────────────────── */
.color-swatch {
  display: inline-flex; align-items: center;
  gap: 8px; cursor: pointer;
}
.color-preview {
  width: 32px; height: 32px;
  border-radius: 8px; border: 2px solid #e2e8f0;
}

/* ─── CATALOG EDITOR ────────────────────────────────────────── */
.catalog-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid #e8ecf4;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
  transition: box-shadow .2s;
}

.catalog-item:hover { box-shadow: var(--shadow); }

.catalog-item-img {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.catalog-item-name { font-weight: 600; font-size: .9rem; }
.catalog-item-cat  { font-size: .75rem; color: #64748b; }

.price-input {
  width: 120px;
  text-align: right;
  font-weight: 600;
}

/* ─── TABLE ─────────────────────────────────────────────────── */
.table-custom {
  border-collapse: separate;
  border-spacing: 0;
}
.table-custom thead th {
  background: #f8fafc;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #64748b;
  padding: 12px 16px;
  border-bottom: 2px solid #e2e8f0;
}
.table-custom tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.table-custom tbody tr:last-child td { border-bottom: none; }
.table-custom tbody tr:hover td { background: #f8fafc; }

/* ─── BADGES ────────────────────────────────────────────────── */
.badge-cat {
  padding: 4px 10px;
  border-radius: 30px;
  font-size: .72rem;
  font-weight: 600;
  color: #fff;
}

/* ─── CATEGORY COLOR DOTS ───────────────────────────────────── */
.cat-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* ─── FORMS ─────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74,108,247,.15);
}

/* ─── DRAG HANDLE ───────────────────────────────────────────── */
.drag-handle {
  cursor: grab;
  color: #94a3b8;
  font-size: 1.1rem;
}
.drag-handle:active { cursor: grabbing; }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ─── ANIMATIONS ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .3s ease; }

/* ─── MODAL TWEAKS ──────────────────────────────────────────── */
.modal-content { border-radius: var(--radius); border: none; }
.modal-header  { border-bottom: 1px solid #f1f5f9; }
.modal-footer  { border-top: 1px solid #f1f5f9; }

/* ─── PAGINATION ────────────────────────────────────────────── */
.page-link { border-radius: 8px !important; margin: 0 2px; border: 1px solid #e2e8f0; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ─── TOAST ─────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; }
