/* =============================================
   GADGETGRID — style.css
   Dark charcoal + electric amber accent
   ============================================= */

:root {
  --bg:        #0f0f11;
  --surface:   #1a1a1f;
  --surface2:  #242429;
  --border:    #2e2e36;
  --accent:    #f5a623;
  --accent2:   #ff6b35;
  --text:      #f0f0f0;
  --muted:     #8a8a9a;
  --amazon:    #ff9900;
  --flipkart:  #2874f0;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.45);
}

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

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

/* ── HEADER ─────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #1a1a1f 0%, #0f0f11 60%);
  border-bottom: 1px solid var(--border);
  padding: 28px 20px 22px;
  text-align: center;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ── CONTROLS BAR ────────────────────────────── */
.controls-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,15,17,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.controls-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 180px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 14px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.search-box:focus { border-color: var(--accent); }
.search-box::placeholder { color: var(--muted); }

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--accent); }

.btn-add {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-add:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-add:active { transform: translateY(0); }

/* ── GRID ────────────────────────────────────── */
.grid-section {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px 48px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

/* ── PRODUCT CARD ────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.card-img-wrap {
  background: #fff;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  transition: transform 0.3s;
}
.card:hover .card-img-wrap img { transform: scale(1.06); }

.card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge-amazon  { background: #ff9900; color: #000; }
.badge-flipkart { background: #2874f0; color: #fff; }
.badge-other   { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

.card-category {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.card-price {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

.card-link {
  display: block;
  margin-top: auto;
  padding-top: 8px;
}
.card-link a {
  display: block;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.card-link a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* card action buttons (edit / delete) */
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 1;
  z-index: 10;
}

.card-actions button {
  background: rgba(15,15,17,0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.7rem;
  padding: 4px 7px;
  cursor: pointer;
  transition: background 0.2s;
}
.card-actions .btn-edit:hover  { background: var(--accent); color: #000; border-color: var(--accent); }
.card-actions .btn-del:hover   { background: #e53e3e; border-color: #e53e3e; }

/* ── EMPTY STATE ──────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 60px 0;
}

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--muted); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}
.btn-cancel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 18px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: color 0.2s;
}
.btn-cancel:hover { color: var(--text); }

.btn-save {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 8px;
  color: #000;
  padding: 9px 22px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.88; }

/* ── ADMIN BUTTONS ───────────────────────────── */
.btn-admin {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.btn-admin:hover { border-color: var(--accent); color: var(--accent); }

.btn-logout {
  background: transparent;
  border: 1px solid #e53e3e55;
  border-radius: 8px;
  color: #e53e3e;
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-logout:hover { background: #e53e3e22; }

/* ── LOGIN MODAL ─────────────────────────────── */
.login-modal { max-width: 360px; }

.login-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.login-error {
  font-size: 0.8rem;
  color: #e53e3e;
  min-height: 18px;
  margin-top: -8px;
  margin-bottom: 4px;
}

/* admin mode indicator on header */
.site-header.admin-active {
  border-bottom-color: var(--accent);
}
.site-header.admin-active .tagline::after {
  content: ' · Admin Mode';
  color: var(--accent);
  font-weight: 600;
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 500px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .controls-inner { flex-direction: column; align-items: stretch; }
  .filter-group { flex-wrap: wrap; }
}

@media (min-width: 900px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
