/* ============================================================
   style.css — 3D Print Tracker custom styles (mobile-first)
   ============================================================ */

/* --- Root & base ----------------------------------------- */
:root {
  --brand-green:  #2e7d32;
  --brand-light:  #e8f5e9;
  --accent:       #66bb6a;
  --danger-soft:  #fff3f3;
  --card-radius:  12px;
  --shadow-sm:    0 2px 8px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;  /* prevents iOS zoom on input focus */
  background: #f5f5f5;
  color: #212121;
}

/* --- Prevent iOS auto-zoom on inputs -------------------- */
input, select, textarea {
  font-size: 16px !important;
}

/* --- Touch targets ≥ 48px ------------------------------- */
.btn, button, a.btn { min-height: 48px; }
.btn-lg             { min-height: 56px; font-size: 1.1rem; }

/* ============================================================
   PUBLIC MENU (index.php)
   ============================================================ */

.public-header {
  background: var(--brand-green);
  color: #fff;
  padding: 20px 16px 16px;
  text-align: center;
}
.public-header h1 { font-size: 1.5rem; margin: 0 0 4px; }
.public-header p  { margin: 0; opacity: .85; font-size: .95rem; }

/* Category filter pills — horizontal scroll, no wrap */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 12px 4px;
  scrollbar-width: none;   /* Firefox */
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  border: 2px solid var(--brand-green);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--brand-green);
  background: #fff;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  scroll-snap-align: start;
  text-decoration: none;
}
.filter-pill.active,
.filter-pill:hover {
  background: var(--brand-green);
  color: #fff;
}

/* Product cards */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
}
@media (min-width: 540px)  { .menu-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .menu-grid { grid-template-columns: repeat(3, 1fr); } }

.product-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-card img,
.product-card .img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.product-card .img-placeholder {
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #9e9e9e;
}
.product-card .card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.product-card .card-title  { font-size: 1rem; font-weight: 700; margin: 0; }
.product-card .card-cat    { font-size: .8rem; color: #666; }
.product-card .card-price  { font-size: 1.15rem; font-weight: 700; color: var(--brand-green); margin-top: auto; }
.product-card .out-of-stock { font-size: .8rem; color: #e53935; font-weight: 600; }

/* ============================================================
   ADMIN — shared
   ============================================================ */

.admin-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1b5e20;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  min-height: 56px;
}
.admin-nav .nav-brand  { font-weight: 700; font-size: 1.1rem; color: #fff; text-decoration: none; }
.admin-nav .nav-links  { display: flex; gap: 8px; align-items: center; }
.admin-nav .nav-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .875rem;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .15s;
}
.admin-nav .nav-links a:hover { background: rgba(255,255,255,.15); }

/* ============================================================
   ADMIN — Quick-Add Form
   ============================================================ */

.quick-add-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  margin: 12px;
  padding: 16px;
}
.quick-add-card h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 12px; }

.form-label { font-weight: 600; font-size: .875rem; margin-bottom: 4px; }

.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #bdbdbd;
  padding: 10px 12px;
  width: 100%;
  transition: border-color .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(46,125,50,.15);
}

.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Camera / file input styled nicely */
.photo-input-wrap {
  position: relative;
}
.photo-input-wrap input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; left: 0; top: 0;
}
.photo-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border: 1.5px dashed #9e9e9e;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: .9rem;
  color: #555;
  width: 100%;
  min-height: 48px;
  transition: border-color .15s, background .15s;
}
.photo-btn:hover, .photo-btn:focus-within {
  border-color: var(--brand-green);
  background: var(--brand-light);
  color: var(--brand-green);
}
.photo-preview {
  max-width: 80px;
  max-height: 80px;
  border-radius: 6px;
  object-fit: cover;
  display: none;
  margin-top: 8px;
}

/* Custom-request toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.toggle-wrap input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--brand-green);
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-wrap label { font-size: .9rem; cursor: pointer; margin: 0; font-weight: 500; }

/* ============================================================
   ADMIN — Inventory List (card-based, mobile-first)
   ============================================================ */

.inv-section { padding: 0 12px 80px; }
.inv-section h2 { font-size: 1rem; font-weight: 700; margin: 16px 0 8px; }

.inv-card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.inv-card.is-custom { border-left: 4px solid #ff8f00; }

.inv-thumb {
  width: 72px;
  min-height: 72px;
  background: #e0e0e0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #9e9e9e;
}
.inv-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}

.inv-body {
  flex: 1;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.inv-name {
  font-weight: 700;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-meta { font-size: .8rem; color: #666; }

.inv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}

.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--brand-light);
  color: var(--brand-green);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.qty-btn:hover, .qty-btn:active { background: #c8e6c9; }
.qty-num { min-width: 28px; text-align: center; font-weight: 700; font-size: 1rem; }

.inv-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: background .15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn.edit-btn   { background: #e3f2fd; color: #1565c0; }
.icon-btn.delete-btn { background: #ffebee; color: #c62828; }
.icon-btn:hover { opacity: .8; }

.badge-custom {
  font-size: .7rem;
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
}

/* ============================================================
   ADMIN — Login page
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #e8f5e9;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
}
.login-card h1  { font-size: 1.5rem; text-align: center; margin-bottom: 24px; }
.login-card .site-icon { font-size: 2.5rem; text-align: center; display: block; margin-bottom: 8px; }

/* ============================================================
   ADMIN — Edit page
   ============================================================ */

.edit-wrap { padding: 12px; }
.edit-wrap h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 16px; }
.current-photo img {
  max-width: 120px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* ============================================================
   ADMIN — Categories page
   ============================================================ */

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.cat-item span { font-weight: 600; }

/* ============================================================
   Utilities & feedback
   ============================================================ */

.toast-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-msg {
  background: #212121;
  color: #fff;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: .9rem;
  box-shadow: var(--shadow-md);
  animation: slide-up .2s ease;
  pointer-events: none;
}
.toast-msg.success { background: #2e7d32; }
.toast-msg.error   { background: #c62828; }
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.alert { border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.alert-danger  { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
