/*
Theme Name: HandCraft AI
Theme URI: https://example.com
Author: You
Version: 1.1.2
Text Domain: handcraft
*/

:root {
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --dark: #2C3E50;
  --light: #F7F9FC;
  --radius: 12px;
  --paper: #F5F0E6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 28px; border-radius: var(--radius); border: none;
  cursor: pointer; font-size: 15px; font-weight: 600;
  transition: all 0.2s; text-decoration: none; touch-action: manipulation;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #FF8E53);
  color: #fff; box-shadow: 0 4px 14px rgba(255,107,107,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,107,107,0.45); }
.btn-secondary {
  background: #fff; color: var(--dark); border: 2px solid #E1E8ED;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost {
  background: transparent; color: var(--primary); border: 2px solid var(--primary);
}
.btn-ghost:hover { background: var(--primary); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.card {
  background: #fff; border-radius: var(--radius); padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.grid-3 {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px;
}

.badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-free { background: #E3F2FD; color: #1976D2; }
.badge-pro { background: #FFF3E0; color: #F57C00; }
.badge-urgent { background: #FFEBEE; color: #C62828; animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.header-bar {
  background: #fff; border-bottom: 1px solid #E1E8ED;
  padding: 16px 0; position: sticky; top: 0; z-index: 100;
}
.header-bar .container { display: flex; align-items: center; justify-content: space-between; }
.logo {
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.nav-links {
  display: flex; align-items: center; flex-shrink: 0;
}
.nav-links a {
  margin-left: 24px; color: var(--dark); text-decoration: none;
  font-weight: 500; font-size: 14px; white-space: nowrap;
}
.nav-links a:hover { color: var(--primary); }

.hero { padding: 50px 0 30px; text-align: center; }
.hero h1 { font-size: 40px; margin-bottom: 12px; letter-spacing: -0.5px; }
.hero p { color: #7F8C8D; font-size: 18px; max-width: 600px; margin: 0 auto 28px; }

.festival-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff; padding: 14px 0; text-align: center; font-size: 15px;
}
.festival-bar a { color: #FFE082; font-weight: 700; text-decoration: underline; margin-left: 8px; }

.first-order-banner {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff; padding: 16px 0; text-align: center;
  position: relative; overflow: hidden;
}
.first-order-banner::before {
  content: "NEW"; position: absolute; left: -20px; top: -10px;
  background: #FFD700; color: #333; font-size: 10px; font-weight: 800;
  padding: 20px 30px 4px; transform: rotate(-45deg);
}
.first-order-banner h4 { font-size: 18px; margin-bottom: 4px; }
.first-order-banner p { font-size: 14px; opacity: 0.95; }

.urgent-card {
  background: linear-gradient(135deg, #FF416C, #FF4B2B);
  color: #fff; text-align: center; padding: 20px;
  border-radius: var(--radius); cursor: pointer;
  transition: transform 0.2s;
}
.urgent-card:hover { transform: translateY(-3px); }
.urgent-card h3 { font-size: 20px; margin-bottom: 6px; }
.urgent-card p { font-size: 13px; opacity: 0.9; }

.history-strip {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 16px;
  -webkit-overflow-scrolling: touch;
}
.history-item {
  flex-shrink: 0; width: 100px; text-align: center; cursor: pointer;
}
.history-item img {
  width: 100px; height: 140px; object-fit: cover; border-radius: 8px;
  border: 2px solid transparent; transition: border-color 0.2s;
}
.history-item:hover img { border-color: var(--primary); }
.history-item span { font-size: 11px; color: #95A5A6; margin-top: 4px; display: block; }

.theme-card { overflow: hidden; cursor: pointer; transition: transform 0.2s; }
.theme-card:hover { transform: translateY(-4px); }
.theme-card img {
  width: 100%; height: 180px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; background: #f0f0f0;
}
.theme-card h3 { font-size: 16px; margin-bottom: 6px; }
.theme-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #95A5A6; }

.generate-wrap {
  display: grid; grid-template-columns: 380px 1fr; gap: 32px; padding: 30px 0;
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 14px; border: 2px solid #E1E8ED;
  border-radius: 10px; font-size: 14px; outline: none; transition: border-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-item {
  padding: 6px 14px; background: #f0f3f5; border-radius: 20px;
  font-size: 13px; cursor: pointer; transition: all 0.2s; border: 2px solid transparent;
}
.tag-item:hover { background: #e1e8ed; }
.tag-item.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

.mode-tabs {
  display: flex; gap: 8px; margin-bottom: 20px; background: #f0f3f5;
  padding: 4px; border-radius: 10px;
}
.mode-tab {
  flex: 1; text-align: center; padding: 10px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; border: none; background: transparent;
}
.mode-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.batch-area { display: none; }
.batch-area textarea { min-height: 120px; font-size: 14px; }
.batch-hint { font-size: 12px; color: #95A5A6; margin-top: 6px; }
.batch-progress { margin-top: 16px; }
.batch-progress-bar {
  height: 8px; background: #e1e8ed; border-radius: 4px; overflow: hidden;
}
.batch-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s; width: 0%;
}

.preview-area {
  background: #fff; border-radius: var(--radius); min-height: 500px;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  border: 2px dashed #E1E8ED; position: relative;
}
.preview-area.has-image { border-style: solid; border-color: transparent; }
.preview-area img { max-width: 100%; max-height: 700px; border-radius: 8px; }

.print-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  display: flex; gap: 8px;
}
.print-toggle button {
  padding: 6px 14px; font-size: 12px; border-radius: 6px; border: 1px solid #ddd;
  background: #fff; cursor: pointer;
}
.print-toggle button.active { background: var(--dark); color: #fff; }
.paper-bg { background: var(--paper) !important; }

.price-tag { font-size: 24px; font-weight: 800; color: var(--primary); }
.price-tag small { font-size: 14px; color: #95A5A6; font-weight: 500; }
.price-strike { text-decoration: line-through; color: #BDC3C7; font-size: 14px; margin-right: 6px; }

.user-sidebar { width: 260px; }
.user-main { flex: 1; }
.user-layout { display: flex; gap: 32px; padding: 40px 0; }

.stat-card { text-align: center; padding: 20px; }
.stat-card .num { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: 13px; color: #7F8C8D; margin-top: 4px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th,
table.data-table td { padding: 14px; text-align: left; border-bottom: 1px solid #E1E8ED; }
table.data-table th {
  font-weight: 600; color: #7F8C8D; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-done { color: #27AE60; font-weight: 600; }
.status-wait { color: #F39C12; font-weight: 600; }

.recharge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 24px; }
.recharge-card { text-align: center; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; position: relative; }
.recharge-card:hover,
.recharge-card.active { border-color: var(--primary); box-shadow: 0 4px 20px rgba(255,107,107,0.15); }
.recharge-card .points { font-size: 36px; font-weight: 800; color: var(--primary); }
.recharge-card .price { font-size: 20px; font-weight: 700; margin: 8px 0; }
.recharge-card .save { font-size: 12px; color: #27AE60; font-weight: 600; }

.footer-bar {
  background: #fff; border-top: 1px solid #E1E8ED;
  padding: 24px 0; margin-top: 60px; text-align: center;
  color: #95A5A6; font-size: 13px;
}

.toast {
  position: fixed; top: 24px; right: 24px; background: var(--dark);
  color: #fff; padding: 14px 24px; border-radius: 10px;
  font-size: 14px; z-index: 9999; opacity: 0;
  transform: translateY(-10px); transition: all 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }

.loading-spin {
  width: 40px; height: 40px; border: 3px solid #E1E8ED;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 弹窗优化 ========== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center; z-index: 200;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 32px;
  max-width: 420px; width: 100%; text-align: center;
  position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 24px; color: #95A5A6;
  cursor: pointer; line-height: 1; padding: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all 0.2s;
}
.modal-close:hover { background: #f0f0f0; color: var(--dark); }
.qr-wrap img { width: 200px; height: 200px; margin: 16px auto; display: block; }

.wechat-tip {
  background: #FFF8E1; border: 1px solid #FFE082; border-radius: 8px;
  padding: 12px; font-size: 13px; color: #856404; margin-bottom: 12px;
}
.wechat-tip strong { color: #F57F17; }

.download-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.download-card {
  text-align: center; padding: 20px; border-radius: 10px; position: relative;
}
.download-card.free { background: #f8f9fa; border: 2px solid #e1e8ed; }
.download-card.paid {
  background: linear-gradient(135deg, #FFF8F0, #FFF3E0);
  border: 2px solid #FFD8A6;
}
.download-card .icon { font-size: 32px; margin-bottom: 8px; }
.download-card h4 { font-size: 15px; margin-bottom: 6px; }
.download-card p { font-size: 12px; color: #7F8C8D; margin-bottom: 12px; }
.download-card .btn { width: 100%; padding: 10px; font-size: 14px; }

.color-ref-preview {
  margin-top: 12px; padding: 12px; background: #f8f9fa; border-radius: 8px;
}
.color-ref-preview img {
  max-height: 120px; border-radius: 6px; border: 2px solid #e1e8ed;
}
.color-ref-preview span { font-size: 12px; color: #95A5A6; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
}
.print-page { background: #fff; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.print-area img { max-width: 100%; max-height: 100vh; object-fit: contain; }
.print-btn {
  position: fixed; bottom: 30px; right: 30px;
  padding: 14px 28px; background: var(--primary); color: #fff;
  border-radius: 50px; font-weight: 600; cursor: pointer; border: none;
  box-shadow: 0 4px 14px rgba(255,107,107,0.4);
}

/* ========== 移动端响应式 ========== */
@media (max-width: 768px) {
  .header-bar .container { padding: 0 12px; }
  .logo { font-size: 18px; }
  .nav-links a { margin-left: 12px; font-size: 13px; }
  
  .hero { padding: 30px 0 20px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  
  .grid-3 { grid-template-columns: 1fr; gap: 16px; }
  .generate-wrap { grid-template-columns: 1fr; padding: 16px 0; gap: 20px; }
  
  .download-grid { grid-template-columns: 1fr; }
  .recharge-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  
  .user-layout { flex-direction: column; padding: 20px 0; }
  .user-sidebar { width: 100%; }
  
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { 
    max-width: 100%; width: 100%; border-radius: 16px 16px 0 0; 
    padding: 24px 20px 32px; max-height: 90vh; overflow-y: auto;
  }
  .modal-close { top: 8px; right: 12px; }
  
  .preview-area { min-height: 300px; }
  .preview-area img { max-height: 50vh; }
  
  .batch-area textarea { min-height: 100px; }
  .urgent-card { padding: 16px; }
  
  .first-order-banner h4 { font-size: 15px; }
  .first-order-banner p { font-size: 12px; }
  
  .festival-bar { font-size: 13px; padding: 10px 0; }
  
  .orientation-group > div { gap: 8px !important; }
  .orientation-group label { padding: 8px !important; }
  
  .print-btn { bottom: 16px; right: 16px; padding: 12px 20px; font-size: 14px; }
}