/* pc.css – desktop-only styles (Product.php, admin.php) */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", "Leelawadee UI", Tahoma, sans-serif; font-size: 14px; color: #1f2937; background: #f3f4f6; line-height: 1.45; }
button, input, select, textarea { font: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 8px; background: #e5e7eb; color: #111827; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: filter .15s, opacity .15s; }
.btn:hover { filter: brightness(.94); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-outline { background: #fff; border-color: #d1d5db; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.noimg { color: #9ca3af; font-size: 12px; }
mark { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 2px; }
.qty-zero { color: #dc2626; } .qty-low { color: #d97706; } .qty-ok { color: #16a34a; }

/* ================= Product.php ================= */
body.catalog { display: flex; height: 100vh; overflow: hidden; }
.sidebar { flex: 0 0 25%; width: 25%; height: 100vh; display: flex; flex-direction: column; gap: 12px;
  padding: 22px 18px; background: #111827; color: #e5e7eb; overflow-y: auto; }
.brand { font-size: 20px; font-weight: 700; color: #fff; }
.brand small { display: block; font-size: 12px; font-weight: 400; color: #9ca3af; }
.side-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #9ca3af; margin-top: 6px; }
.search-wrap { position: relative; }
.search-wrap input { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid #374151; background: #1f2937; color: #fff; outline: none; }
.search-wrap input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.3); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; margin: 0; padding: 6px; list-style: none;
  background: #fff; color: #111827; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.35); max-height: 420px; overflow-y: auto; }
.suggest li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.suggest li.active, .suggest li:hover { background: #eff6ff; }
.suggest li > div { min-width: 0; }
.suggest img, .sug-noimg { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 6px; object-fit: cover; background: #f3f4f6; }
.sug-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-sub { font-size: 12px; color: #6b7280; }
.sug-empty { color: #6b7280; cursor: default !important; }
.sidebar select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #374151; background: #1f2937; color: #fff; outline: none; cursor: pointer; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; color: #d1d5db; transition: background .12s; }
.cat-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-list li:hover { background: #1f2937; }
.cat-list li.active { background: #2563eb; color: #fff; }
.cat-list .count { flex: 0 0 auto; font-size: 12px; background: rgba(255,255,255,.12); padding: 1px 8px; border-radius: 999px; }
.side-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid #1f2937; display: flex; justify-content: space-between; font-size: 12px; color: #9ca3af; }
.side-footer a { color: #93c5fd; text-decoration: none; }
.side-footer .live { color: #4ade80; } .side-footer .off { color: #f87171; }

.canvas { flex: 1 1 75%; width: 75%; height: 100vh; overflow-y: auto; padding: 24px 28px; }
.canvas.detail-mode { padding: 0; overflow: hidden; }
.canvas-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.canvas-head h2 { margin: 0; font-size: 22px; }
.canvas-head span { color: #6b7280; }
.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.p-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: pointer;
  transition: transform .12s, box-shadow .12s; outline: none; }
.p-card:hover, .p-card:focus { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.thumb { aspect-ratio: 1 / 1; background: #f9fafb; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-body { padding: 8px 10px 10px; }
.p-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.p-meta { font-size: 11.5px; color: #4b5563; line-height: 1.35; margin-top: 3px; }
.p-meta b { display: block; font-size: 10.5px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .04em; }
.p-qty { margin-top: 6px; font-weight: 700; font-size: 13px; }
.empty { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: #9ca3af; font-size: 15px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 24px 0 8px; }
.pager span { color: #6b7280; }

/* detail: row 1 = 40% height, row 2 = 60% height; picture = 30% of canvas width */
.detail-top { height: 40vh; display: flex; background: #fff; border-bottom: 1px solid #e5e7eb; }
.detail-img { flex: 0 0 30%; width: 30%; height: 100%; padding: 16px; display: flex; align-items: center; justify-content: center; background: #f9fafb; }
.detail-img a { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
.detail-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.detail-info { flex: 1; min-width: 0; height: 100%; padding: 20px 28px; overflow-y: auto; display: flex; flex-direction: column; }
.detail-info h1 { margin: 0 0 10px; font-size: 24px; word-break: break-word; }
.info-table { border-collapse: collapse; margin-bottom: 14px; }
.info-table th { text-align: left; font-weight: 600; color: #6b7280; padding: 4px 24px 4px 0; white-space: nowrap; }
.info-table td { padding: 4px 0; }
.qty-big { font-size: 20px; font-weight: 800; }
.detail-info .btn { align-self: flex-start; margin-top: auto; }
.detail-bottom { height: 60vh; overflow-y: auto; padding: 22px 28px; background: #f9fafb; }
.detail-bottom h3 { margin: 0 0 10px; font-size: 16px; color: #374151; }
.desc { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.7; background: #fff; padding: 18px 20px;
  border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }

/* ================= admin.php ================= */
body.admin { min-width: 1100px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; background: #111827; color: #fff; }
.admin-header h1 { margin: 0; font-size: 20px; }
.admin-header a { color: #93c5fd; text-decoration: none; font-weight: 600; }
.admin-main { padding: 24px 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.panel { background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.panel-wide { grid-column: 1 / -1; }
.panel h2 { margin: 0 0 14px; font-size: 17px; }
.panel h2 small { font-weight: 400; color: #6b7280; font-size: 13px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.input, .inline-form input, .form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; outline: none; }
.inline-form input { flex: 1; }
input:focus, select:focus, textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; padding: 8px 10px; border-bottom: 2px solid #e5e7eb; white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafafa; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn + .btn { margin-left: 6px; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid #e5e7eb; }
.empty-row { text-align: center; color: #9ca3af; padding: 24px !important; }
.cat-input { width: 100%; padding: 7px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; }
.cat-input:hover { border-color: #e5e7eb; }
.cat-input:focus { background: #fff; border-color: #2563eb; outline: none; }
.mini-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #f3f4f6; display: flex; align-items: center; justify-content: center; }
.small { font-size: 12px; color: #6b7280; }
.search-row { margin-bottom: 12px; }
.search-row input { max-width: 460px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #f9fafb; border-radius: 10px; padding: 12px 14px; }
.stat .v { font-size: 26px; font-weight: 800; color: #111827; }
.stat .k { font-size: 12px; color: #6b7280; }
.bar { display: inline-block; vertical-align: middle; width: 120px; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-right: 8px; }
.bar i { display: block; height: 100%; background: #2563eb; }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(17,24,39,.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-box { width: 760px; max-width: 100%; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 14px; padding: 22px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-box h3 { margin: 0 0 16px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: #374151; }
.form-grid textarea { min-height: 140px; resize: vertical; }
.img-edit { display: flex; gap: 16px; align-items: center; }
.img-edit .preview { width: 140px; height: 140px; flex: 0 0 140px; border-radius: 10px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.img-edit .preview img { width: 100%; height: 100%; object-fit: contain; }
.img-edit .small { margin-top: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 200; padding: 12px 18px; border-radius: 10px; color: #fff; background: #111827; box-shadow: 0 10px 25px rgba(0,0,0,.25); font-weight: 600; }
.toast.error { background: #dc2626; }
.toast.success { background: #16a34a; }