/* ============================================================
   Ultra Deal Finder — Admin Stylesheet
   ============================================================ */

:root {
  --blue:       #0071DC;
  --blue-dark:  #004f9a;
  --blue-light: #e8f3ff;
  --yellow:     #FFC220;
  --red:        #dc2626;
  --red-light:  #fef2f2;
  --green:      #16a34a;
  --green-light:#f0fdf4;
  --white:      #ffffff;
  --gray-50:    #f8f9fb;
  --gray-100:   #f0f2f5;
  --gray-200:   #e2e6ea;
  --gray-400:   #9aa5b4;
  --gray-600:   #5a6474;
  --gray-800:   #1f2937;
  --text:       #1a1e2e;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 10px rgba(0,0,0,.07);
  --font:       'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--gray-50); color: var(--text); min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Admin layout ─────────────────────────────────────────── */
.admin-header {
  background: var(--blue-dark);
  color: #fff;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 800; color: #fff;
}
.admin-logo span { color: var(--yellow); }
.admin-nav { display: flex; gap: 4px; }
.admin-nav a {
  color: rgba(255,255,255,.8);
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  transition: background .2s;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.admin-nav .logout { color: rgba(255,100,100,.9); }
.admin-nav .logout:hover { background: rgba(220,38,38,.2); }

.admin-main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

/* ── Cards / panels ───────────────────────────────────────── */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.panel-head h2 { font-size: 1rem; font-weight: 800; color: var(--text); }
.panel-head h3 { font-size: .9rem; font-weight: 700; color: var(--text); }
.panel-body { padding: 20px; }

/* ── Forms ────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-group input,
.form-group textarea,
.form-group select {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,113,220,.12);
}
.form-group textarea { resize: vertical; min-height: 120px; font-family: 'Courier New', monospace; font-size: .82rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background .18s, transform .15s;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--yellow); color: var(--blue-dark); }
.btn-warning:hover { background: #e6a800; }
.btn-ghost { background: var(--gray-100); color: var(--text); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-sm { padding: 5px 10px; font-size: .76rem; }
.btn-xs { padding: 3px 8px; font-size: .72rem; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-light); color: var(--green); border-color: #bbf7d0; }
.alert-error { background: var(--red-light); color: var(--red); border-color: #fecaca; }
.alert-info { background: var(--blue-light); color: var(--blue-dark); border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert ul { margin-top: 6px; padding-left: 18px; }
.alert li { margin: 2px 0; }

/* ── Product list (admin) ─────────────────────────────────── */
.date-group { margin-bottom: 28px; }
.date-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .85rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.date-group-head:hover { background: var(--blue-light); }
.date-group-head .dg-left { display: flex; align-items: center; gap: 10px; }
.date-group-head .dg-count {
  background: var(--blue);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.date-group-head .dg-today {
  background: var(--yellow);
  color: var(--blue-dark);
  font-size: .65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.date-group-body {
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .15s;
  font-size: .82rem;
}
.product-row:last-child { border-bottom: none; }
.product-row:hover { background: var(--gray-50); }
.product-row.selected { background: var(--blue-light); }

.product-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.product-thumb {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 5px;
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
  flex-shrink: 0;
}
.product-thumb-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 5px;
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gray-400);
  font-size: .9rem;
}
.product-info { flex: 1; min-width: 0; }
.product-info-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.product-info-meta {
  color: var(--gray-600);
  font-size: .74rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.product-info-meta .price { color: var(--blue); font-weight: 700; }
.product-info-meta .disc  { color: #b45309; font-weight: 700; }
.product-info-meta .stars { color: #f59e0b; }

.product-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Bulk actions bar ─────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
  border: 1px solid #bfdbfe;
}
.bulk-bar span { font-size: .85rem; font-weight: 600; color: var(--blue-dark); }

/* ── Stats row ────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 140px;
}
.stat-icon { font-size: 1.5rem; }
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-size: 1.4rem; font-weight: 900; color: var(--blue); }
.stat-label { font-size: .74rem; color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* ── Login page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .spark-big {
  width: 56px; height: 56px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.login-logo h1 { font-size: 1.3rem; font-weight: 900; color: var(--text); }
.login-logo p  { font-size: .82rem; color: var(--gray-600); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { font-size: .8rem; font-weight: 700; color: var(--gray-600); display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.login-form input {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .2s;
}
.login-form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,220,.12); }
.login-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s;
  margin-top: 4px;
}
.login-btn:hover { background: var(--blue-dark); }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .18s;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn:hover { color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Import result ────────────────────────────────────────── */
.import-result {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--green-light);
  border: 1px solid #bbf7d0;
  font-size: .88rem;
}
.import-result .ir-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.import-result .ir-ok  { color: var(--green); font-weight: 700; }
.import-result .ir-err { color: var(--red); font-weight: 700; }

/* ── Tooltip ──────────────────────────────────────────────── */
.tip { font-size: .78rem; color: var(--gray-600); margin-top: 4px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .admin-header { padding: 0 14px; }
  .admin-main { padding: 16px 12px 40px; }
  .panel-body { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .bulk-bar { gap: 8px; }
  .product-row { gap: 8px; padding: 8px 12px; }
  .product-info-title { font-size: .78rem; }
}
