/* ============ iBlue Smart — Shop Pages (products / detail / cart / admin) ============ */

/* ---------- page hero ---------- */
.page-hero { background: linear-gradient(135deg, #081f38 0%, #0b3a6b 60%, #0f4c81 100%); color: #fff; padding: 56px 0 44px; }
.page-hero h1 { font-size: clamp(26px, 3.4vw, 40px); margin: 8px 0 10px; }
.page-hero p { color: rgba(255,255,255,.82); max-width: 760px; }
.breadcrumb { font-size: 13.5px; color: rgba(255,255,255,.75); }
.breadcrumb a { color: #fff; opacity: .9; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- toolbar / filters ---------- */
.shop-toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 26px 0 8px; }
.shop-toolbar .cats { margin: 0; }
.search-box { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.search-box input { border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px; font-size: 14px; width: 220px; outline: none; font-family: inherit; }
.search-box input:focus { border-color: var(--blue-bright); }
.search-box button { border: 0; border-radius: 999px; padding: 9px 18px; background: var(--blue); color: #fff; cursor: pointer; font-size: 14px; font-family: inherit; }
.search-box button:hover { background: var(--blue-bright); }
.cats { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.cat-btn { border: 1.5px solid var(--line); background: #fff; color: var(--ink); padding: 9px 20px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 500; font-family: inherit; transition: all .2s; }
.cat-btn:hover { border-color: var(--blue-bright); color: var(--blue-bright); }
.cat-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.result-count { color: var(--muted); font-size: 14px; margin: 6px 0 18px; }

/* ---------- product grid / card ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.product-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .25s, box-shadow .25s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.p-img { position: relative; aspect-ratio: 1 / 1; background: #f6f8fa; overflow: hidden; display: block; }
.p-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .4s; }
.product-card:hover .p-img img { transform: scale(1.05); }
.p-tag { position: absolute; top: 10px; left: 10px; background: var(--blue-bright); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .5px; }
.p-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.p-body h3 { font-size: 15.5px; line-height: 1.4; color: var(--ink); }
.p-body h3 a:hover { color: var(--blue-bright); }
.p-spec { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.p-price { font-size: 16px; font-weight: 700; color: var(--blue); }
.p-price small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }
.p-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.p-actions { display: flex; gap: 8px; margin-top: 4px; }
.p-actions .btn { flex: 1; justify-content: center; }
.more-wrap { text-align: center; margin-top: 34px; }

/* ---------- detail page ---------- */
.pd-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 44px; margin-top: 34px; }
.pd-gallery-main { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; }
.pd-gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 12px; }
.pd-thumbs button { border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; cursor: pointer; aspect-ratio: 1/1; }
.pd-thumbs button.active { border-color: var(--blue-bright); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pd-info h1 { font-size: clamp(22px, 2.6vw, 32px); line-height: 1.3; margin: 10px 0 12px; }
.pd-price { font-size: 28px; font-weight: 800; color: var(--blue); margin: 6px 0 4px; }
.pd-price small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.pd-moq { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.pd-short { color: var(--muted); font-size: 15px; line-height: 1.7; border-top: 1px solid var(--line); padding-top: 14px; }
.pd-buy { display: flex; gap: 12px; align-items: center; margin: 18px 0 8px; flex-wrap: wrap; }
.qty-input { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty-input button { width: 38px; height: 42px; border: 0; background: var(--bg-soft); cursor: pointer; font-size: 18px; color: var(--blue); }
.qty-input input { width: 64px; text-align: center; border: 0; font-size: 15px; font-family: inherit; outline: none; }
.pd-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.pd-section { margin-top: 42px; }
.pd-section h2 { font-size: 20px; color: var(--blue-deep); margin-bottom: 14px; }
.pd-desc { color: var(--ink); font-size: 15.5px; line-height: 1.85; max-width: 860px; }
.feature-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; margin-top: 6px; }
.feature-list li { position: relative; padding-left: 26px; color: var(--ink); font-size: 14.5px; line-height: 1.6; }
.feature-list li::before { content: ""; position: absolute; left: 0; top: 7px; width: 14px; height: 14px; border-radius: 50%; background: var(--blue-bright); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat; }
.spec-table { width: 100%; max-width: 860px; border-collapse: collapse; }
.spec-table th, .spec-table td { border: 1px solid var(--line); padding: 10px 16px; font-size: 14px; text-align: left; }
.spec-table th { background: var(--bg-soft); color: var(--blue-deep); width: 220px; font-weight: 600; }
.pd-desc-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.pd-desc-imgs img { border: 1px solid var(--line); border-radius: 12px; aspect-ratio: 1/1; object-fit: cover; width: 100%; }

/* ---------- cart ---------- */
.cart-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 34px; margin-top: 34px; align-items: start; }
.cart-list { display: flex; flex-direction: column; gap: 14px; }
.cart-item { display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.cart-item img { width: 96px; height: 96px; object-fit: contain; background: #f6f8fa; border-radius: 10px; }
.ci-name { font-weight: 600; font-size: 15px; }
.ci-name a:hover { color: var(--blue-bright); }
.ci-price { color: var(--blue); font-weight: 700; margin: 4px 0 8px; }
.ci-right { text-align: right; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.ci-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; }
.ci-remove:hover { color: #c0392b; }
.cart-empty { text-align: center; padding: 60px 0; color: var(--muted); }
.cart-summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; position: sticky; top: 92px; }
.cart-summary .row { display: flex; justify-content: space-between; font-size: 14.5px; padding: 6px 0; color: var(--muted); }
.cart-summary .row.total { font-size: 19px; font-weight: 800; color: var(--ink); border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; }
.order-form { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.form-field label i { color: #c0392b; font-style: normal; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; font-family: inherit; outline: none; background: #fff; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--blue-bright); }
.pay-options { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.pay-option { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 14px; }
.pay-option:has(input:checked) { border-color: var(--blue-bright); background: #f2f9fd; }
.pay-option input { margin-top: 3px; }
.pay-option .pay-sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pay-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.result-card { max-width: 640px; margin: 40px auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; background: #fff; text-align: center; }
.result-card h1 { color: var(--blue-deep); margin-bottom: 10px; }
.result-card .oid { font-size: 20px; font-weight: 800; letter-spacing: 1px; color: var(--blue); margin: 8px 0 14px; }
.result-card pre { text-align: left; background: var(--bg-soft); border-radius: 12px; padding: 18px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; font-family: var(--font); }
.form-tip { font-size: 14px; margin-top: 10px; min-height: 20px; }
.form-tip.ok { color: #1c8a4c; }
.form-tip.err { color: #c0392b; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 1080px; margin: 34px auto; }
.admin-login { max-width: 420px; margin: 60px auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; background: #fff; }
.admin-login h1 { font-size: 22px; color: var(--blue-deep); margin-bottom: 18px; }
.admin-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-top h1 { font-size: 22px; color: var(--blue-deep); margin-right: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; text-align: left; vertical-align: middle; }
.admin-table th { background: var(--bg-soft); color: var(--blue-deep); }
.admin-table img { width: 46px; height: 46px; object-fit: contain; background: #f6f8fa; border-radius: 8px; }
.admin-table .row-actions { display: flex; gap: 6px; }
.modal { position: fixed; inset: 0; background: rgba(8, 31, 56, .55); display: none; align-items: flex-start; justify-content: center; z-index: 200; padding: 40px 16px; overflow: auto; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); max-width: 760px; width: 100%; padding: 28px; }
.modal-box h2 { font-size: 19px; color: var(--blue-deep); margin-bottom: 16px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-grid .full { grid-column: 1 / -1; }
.img-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.img-picker .ip { position: relative; width: 74px; height: 74px; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.img-picker .ip img { width: 100%; height: 100%; object-fit: contain; }
.img-picker .ip button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; cursor: pointer; line-height: 1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.upl { display: inline-flex; align-items: center; gap: 8px; border: 1.5px dashed var(--blue-bright); color: var(--blue); border-radius: 10px; padding: 10px 16px; cursor: pointer; font-size: 13.5px; }
.upl input { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .pd-wrap, .cart-layout { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  .pd-desc-imgs { grid-template-columns: repeat(2, 1fr); }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { flex: 1; width: auto; }
}
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 72px 1fr; }
  .cart-item img { width: 72px; height: 72px; }
  .ci-right { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .modal-grid { grid-template-columns: 1fr; }
}

/* ---------- main gallery (Taobao style) ---------- */
.pd-media { min-width: 0; }
.pd-main { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; }
.pd-main img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumbs button { transition: border-color .15s; }
.pd-thumbs button:hover { border-color: var(--blue-bright); }

/* ---------- stacked detail images ---------- */
.pd-detail-imgs { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.pd-detail-imgs img { width: 100%; max-width: 860px; border: 1px solid var(--line); border-radius: 12px; object-fit: cover; background: #fff; display: block; }

/* ---------- stock labels ---------- */
.p-stock, .pd-stock, .ci-stock { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }
.p-stock b, .pd-stock b { color: var(--ink); }
.p-stock.is-out, .pd-stock.is-out, .ci-stock.is-out { color: #c0392b; font-weight: 600; }
.p-stock.is-out b, .pd-stock.is-out b { color: #c0392b; }

/* ---------- product card actions ---------- */
.p-actions { align-items: center; }
.p-actions .qty-input { flex: 0 0 auto; }
.p-actions .qty-input input { width: 48px; font-size: 14px; }
.p-actions .qty-input button { width: 30px; height: 36px; font-size: 15px; }
.p-detail-link { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--blue); text-decoration: none; }
.p-detail-link:hover { text-decoration: underline; }
.add-to-cart[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- toast ---------- */
#ibToast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 12px);
  background: rgba(11,58,107,.95); color: #fff; font-size: 14px;
  padding: 12px 20px; border-radius: 999px; box-shadow: 0 10px 30px rgba(11,58,107,.28);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 9999;
}
#ibToast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .pd-thumbs { grid-template-columns: repeat(4, 1fr); }
  .p-actions { flex-direction: column; align-items: stretch; }
  .p-actions .qty-input { align-self: flex-start; }
}
