/* ===== CSS Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #e85d04;
  --primary-light: #f48c06;
  --primary-dark: #d04e03;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --border: #e5e5e5;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 20px 16px;
  text-align: center;
  flex-shrink: 0;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.header p {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

.header-back {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-back .back-btn {
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

/* ===== Password Lock Screen ===== */
.lock-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.lock-screen .lock-icon {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 20px;
}

.lock-screen h2 {
  color: #fff;
  font-size: 22px;
  margin-bottom: 8px;
}

.lock-screen p {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  margin-bottom: 24px;
}

.lock-screen .input-group {
  width: 100%;
  max-width: 300px;
}

.lock-screen input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 16px;
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}

.lock-screen input::placeholder {
  color: rgba(255,255,255,0.6);
}

.lock-screen input:focus {
  border-color: #fff;
  background: rgba(255,255,255,0.25);
}

.lock-screen .unlock-btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.lock-screen .unlock-btn:active {
  opacity: 0.85;
}

.lock-screen .error-msg {
  color: #fff;
  font-size: 13px;
  margin-top: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}

.lock-screen .error-msg.show {
  opacity: 1;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Product Card Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.product-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-lg);
}

.product-card .card-icon {
  height: 120px;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.product-card .card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card .card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.product-card .card-desc {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.product-card .card-arrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* ===== Video Section ===== */
.video-wrapper {
  width: 100%;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.video-wrapper video {
  width: 100%;
  display: block;
}

.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 10;
  cursor: pointer;
}

.play-overlay.hidden {
  display: none;
}

.play-btn {
  width: 76px;
  height: 76px;
  background: rgba(232,93,4,0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(232,93,4,0.4);
}

.play-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 16px 0 16px 26px;
  border-color: transparent transparent transparent #fff;
  margin-left: 5px;
}

.play-text {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* ===== Steps Section ===== */
.steps-section {
  margin-top: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.steps-section h2 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 14px;
  font-weight: 700;
}

.steps-list {
  list-style: none;
  counter-reset: step;
}

.steps-list li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-light);
  counter-increment: step;
  padding-left: 40px;
  position: relative;
  padding-bottom: 12px;
}

.steps-list li:last-child {
  padding-bottom: 0;
}

.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== Contact Section ===== */
.contact-section {
  margin-top: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.contact-section h3 {
  font-size: 16px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 14px;
  text-align: center;
}

.contact-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
  border: none;
}

.contact-btn:active {
  opacity: 0.8;
}

.btn-phone {
  background: #07c160;
  color: #fff;
}

.btn-wechat {
  background: #f5f5f5;
  color: var(--text);
  border: 2px solid #07c160;
}

.wechat-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.wechat-id {
  font-size: 15px;
  color: var(--text-light);
}

.copy-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.copy-btn:active {
  opacity: 0.8;
}

.copy-hint {
  font-size: 13px;
  color: #07c160;
  margin-top: 8px;
  text-align: center;
  display: none;
}

.copy-hint.show {
  display: block;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 20px 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer p {
  line-height: 1.8;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ===== Admin Page ===== */
.admin-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.admin-section h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: var(--font);
}

.btn:active {
  opacity: 0.8;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-success {
  background: #07c160;
  color: #fff;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-secondary {
  background: #f0f0f0;
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.admin-product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #f9f9f9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.admin-product-item .product-info {
  flex: 1;
  min-width: 0;
}

.admin-product-item .product-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-product-item .product-id {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-product-item .product-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.qr-canvas {
  display: block;
  margin: 12px auto;
  border-radius: 8px;
}

.steps-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steps-editor .step-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.steps-editor .step-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.steps-editor .step-row .step-num {
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.steps-editor .step-row .remove-step {
  width: 28px;
  height: 28px;
  background: #fee;
  color: #dc3545;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal .modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ===== Utilities ===== */
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }

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

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