/* ============================================================
   IPSKU — Global stylesheet
   Loaded by includes/header.php on every front-end page.
   Shared base + components used across pages live here;
   page-specific styles stay in each page's inline <style> block.
   ============================================================ */

/* ---- Base reset & typography ---- */
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: #172033; background: #fff; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
.container { width: 1200px; margin: auto; }
/* 窗口小于容器时兜底为全宽，避免横向溢出 */
@media (max-width: 1216px) { .container { width: 100%; padding: 0 16px; box-sizing: border-box; } }

/* ---- Site header / nav ---- */
.site-header { height: 76px; border-bottom: 1px solid #e7eaf0; background: #fff; position: sticky; top: 0; z-index: 10; }
.nav-wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.logo span { color: #2563eb; }
nav { display: flex; gap: 30px; font-size: 14px; font-weight: 600; }
nav a:hover { color: #2563eb; }

/* ---- Hero (home) ---- */
.hero { padding: 105px 0 95px; background: #f5f8fc; }
.hero h1 { font-size: 58px; line-height: 1.05; max-width: 800px; margin: 0 0 22px; letter-spacing: -2px; }
.hero p { font-size: 19px; color: #596579; max-width: 700px; }

/* ---- Buttons ---- */
.btn { display: inline-block; padding: 13px 22px; border-radius: 7px; background: #172033; color: #fff; border: 0; cursor: pointer; font-weight: 700; }
.btn.primary { background: #2563eb; }
.btn.light { background: #eef3fa; color: #172033; }

/* ---- Sections ---- */
.section { padding: 75px 0; }
.section h2 { font-size: 34px; margin: 0 0 12px; }
.muted { color: #6b7280; }

/* ---- Cards (generic) ---- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card { border: 1px solid #e5e8ee; border-radius: 12px; background: #fff; overflow: hidden; }
.card-body { padding: 22px; }
.badge { display: inline-block; background: #edf4ff; color: #2563eb; padding: 4px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.price { font-size: 22px; font-weight: 800; margin: 10px 0; }

/* ---- Form controls (generic) ---- */
.input, .select, textarea { width: 100%; padding: 12px 13px; border: 1px solid #d8dde6; border-radius: 7px; background: #fff; font: inherit; }

/* ---- Listings grid ---- */
.listing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

/* ---- Detail page (legacy layout) ---- */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 55px; padding: 65px 0; }
.detail-image { min-height: 420px; border: 1px solid #e5e8ee; border-radius: 12px; background: #f7f8fa; display: flex; align-items: center; justify-content: center; }
.detail-image img { max-width: 100%; max-height: 420px; object-fit: contain; }

/* ---- Footer ---- */
.footer { background: #111827; color: #d9dee8; padding: 55px 0 20px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.copyright { border-top: 1px solid #303846; margin-top: 35px; padding-top: 18px; font-size: 13px; color: #9ca3af; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 8px; margin-top: 30px; }
.pagination a { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; }

/* ---- Nav cart ---- */
.nav-cart { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; transition: color .15s ease; }
.nav-cart:hover { color: #2563eb; }
.nav-cart svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav-cart .nav-cart-badge { position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px; background: #f97316; color: #fff; font-size: 10px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

/* ---- Toast (global, driven by includes/header.php) ---- */
.tm-toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.96); background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; line-height: 1.5; max-width: min(88vw, 480px); text-align: center; z-index: 999; opacity: 0; pointer-events: none; box-shadow: 0 8px 30px rgba(15,23,42,.22), 0 2px 6px rgba(15,23,42,.08); border: 1px solid rgba(255,255,255,.09); transition: transform .25s ease, opacity .25s ease; }
.tm-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.tm-toast.success { background: #16a34a; }
.tm-toast.error { background: #dc2626; }

/* ---- Wishlist heart (global) ---- */
.tm-head { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; margin-bottom: 8px; }
.tm-wish { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); z-index: 3; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #94a3b8; padding: 0; background: none; border: none; transition: color .15s ease, transform .15s ease; }
.tm-wish svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.tm-wish:hover { color: #ef4444; transform: translateY(-50%) scale(1.1); }
.tm-wish.on { color: #ef4444; }
.tm-wish.on svg { fill: #ef4444; }

/* ---- Articles: shared layout + sidebar (articles.php / article.php) ---- */
.art-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; padding: 32px 0 70px; }
.art-main { min-width: 0; }
.art-aside { min-width: 0; position: sticky; top: 120px; align-self: start; }
.aside-box { background: #fff; border-radius: 6px; padding: 20px; box-shadow: 0 1px 3px rgba(15,23,42,.07); margin-bottom: 20px; }
.aside-box h4 { margin: 0 0 14px; font-size: 16px; letter-spacing: .3px; text-transform: uppercase; }
.aside-box h4 span { color: #2563eb; }
.aside-search { display: flex; gap: 6px; }
.aside-search input { flex: 1; padding: 9px 10px; border: 1px solid #d8dde6; border-radius: 4px; font: inherit; font-size: 15px; }
.aside-search button { padding: 9px 14px; background: #2563eb; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-weight: 700; }
.aside-cats { list-style: none; margin: 0; padding: 0; }
.aside-cats li { margin-bottom: 4px; }
.aside-cats a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; font-size: 15px; color: #374151; }
.aside-cats a:hover { background: #f1f5f9; color: #2563eb; }
.aside-cats a.active { background: #edf4ff; color: #2563eb; font-weight: 700; border-radius: 4px; }
.aside-cats a em { font-style: normal; color: #94a3b8; font-size: 15px; }
.aside-popular { list-style: none; margin: 0; padding: 0; }
.aside-popular li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #e5e8ee; }
.aside-popular li:last-child { border-bottom: 0; }
.aside-popular .idx { flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; background: #eef2f7; color: #64748b; font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.aside-popular li:nth-child(1) .idx { background: #2563eb; color: #fff; }
.aside-popular li:nth-child(2) .idx { background: #3b82f6; color: #fff; }
.aside-popular li:nth-child(3) .idx { background: #60a5fa; color: #fff; }
.aside-popular a { font-size: 15px; line-height: 1.45; color: #374151; }
.aside-popular a:hover { color: #2563eb; }

/* ---- Shared inquiry form (trademark.php / cart.php / contact.php) ---- */
.inq-form { padding: 18px 22px 22px; }
.inq-form .row:last-child { margin-bottom: 0; }
.inq-form label { display: block; font-size: 14px; color: #334155; font-weight: 600; margin-bottom: 5px; }
.inq-form label .req { color: #dc2626; }
.inq-form input, .inq-form textarea {
  width: 100%; box-sizing: border-box; padding: 10px 13px;
  border: 1px solid #c9d4e2; border-radius: 0;
  font-size: 16px; background: #fff; font-family: inherit; transition: all .15s;
}
.inq-form textarea { resize: vertical; }
.inq-form input:focus, .inq-form textarea:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.inq-form .btn {
  width: 100%; padding: 12px; border-radius: 4px; font-size: 14px; font-weight: 700;
  background: #2563eb; color: #fff; border: 0; cursor: pointer; transition: background .15s;
}
.inq-form .btn:hover { background: #1d4ed8; }
.inq-form .btn:disabled { opacity: .6; cursor: wait; }
.inq-form .btn.btn-send {
  width: auto; flex: 0 1 auto; min-width: 0; white-space: nowrap;
  height: 40px; padding: 0 15px; font-size: 14px; line-height: 1;
}
.captcha { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.inq-form .captcha-input {
  box-sizing: border-box; width: 40px; height: 40px; padding: 0 6px;
  border: 1px solid #c2cee0; border-radius: 4px; background: #fff; color: #1d4ed8;
  font-weight: 800; font-size: 16px; letter-spacing: 0; text-align: center;
  font-family: 'Courier New', monospace;
}
.captcha-code {
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; height: 40px; min-width: 56px; padding: 0 8px;
  border: 1px solid #c2cee0; border-radius: 4px; background: #f1f5f9;
  font-weight: 800; font-size: 15px; letter-spacing: 0; color: #1d4ed8;
  font-family: 'Courier New', monospace; user-select: none;
}
.captcha-refresh {
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; width: 40px; height: 40px;
  border: 1px solid #c9d4e2; border-radius: 4px; background: #fff;
  color: #475569; font-size: 16px; text-decoration: none; cursor: pointer; transition: all .15s;
}
.captcha-refresh:hover { background: #eef4ff; color: #1d4ed8; border-color: #c7d6f5; }
.inq-privacy { font-size: 12.5px; color: #94a3b8; margin: 10px 0 0; }
.inq-privacy a { color: #2563eb; text-decoration: none; }
.inq-privacy a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---- Admin: password visibility toggle ---- */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { width: 100%; box-sizing: border-box; padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 4px; margin: 0; cursor: pointer;
  line-height: 0; color: #94a3b8; transition: color .15s;
}
.pw-toggle:hover { color: #2563eb; }

/* ---- Admin layout (shared by all backend pages) ---- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1e293b; color: #fff; padding: 20px 0; flex-shrink: 0; }
.admin-logo { font-size: 18px; font-weight: 700; padding: 0 20px 20px; border-bottom: 1px solid #334155; margin-bottom: 20px; }
.nav-section { margin-bottom: 20px; }
.nav-title { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 1px; padding: 0 20px; margin-bottom: 8px; }
.nav-item { display: block; padding: 8px 20px; color: #cbd5e1; text-decoration: none; font-size: 14px; }
.nav-item:hover { background: #334155; color: #fff; }
.nav-item.active { background: #2563eb; color: #fff; }
.admin-layout .main-content { flex: 1; padding: 0 30px 30px; background: #f1f5f9; }
.page-title { font-size: 24px; font-weight: 700; margin: 0 0 10px; }
.admin-sidebar .badge { background: #ef4444; color: #fff; padding: 2px 6px; border-radius: 10px; font-size: 11px; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .art-layout { grid-template-columns: 1fr; }
  .art-aside { position: static; top: auto; align-self: auto; }
}
@media (max-width: 800px) {
  nav { display: none; }
  .hero h1 { font-size: 40px; }
  .cards, .listing-grid, .detail, .footer-grid { grid-template-columns: 1fr; }
  .detail { gap: 25px; }
  .site-header { height: 65px; }
}
