/* ============================================================
   Qsarco Storefront — Cart page (pixel-perfect UniFi Shopping Cart)
   ============================================================ */

@layer components {

  /* Reset ciblé : text-transform / letter-spacing seulement sur les éléments où le thème les écrase */
  .qsf-cart-page .qsf-cart-h1,
  .qsf-cart-page .qsf-cart-items th,
  .qsf-cart-page .qsf-cart-items td,
  .qsf-cart-page .qsf-sidebar-title,
  .qsf-cart-page .qsf-sidebar-count,
  .qsf-cart-page .qsf-gift-toggle,
  .qsf-cart-page .qsf-cart-back,
  .qsf-cart-page .qsf-item-name,
  .qsf-cart-page .qsf-item-sku,
  .qsf-cart-page .qsf-checkout-btn,
  .qsf-cart-page .qsf-cart-banner-cta,
  .qsf-cart-page .qsf-cart-banner-default h3 {
    text-transform: none !important;
    letter-spacing: normal !important;
  }
  .qsf-cart-page .qsf-cart-h1 { letter-spacing: -0.01em !important; }

  body.woocommerce-cart .qsf-cart-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 64px;
    background: #ffffff;
    font-family: var(--qsf-font-sans);
    color: #0f172a;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) body.woocommerce-cart .qsf-cart-page {
      background: #0b0f17;
      color: #f1f5f9;
    }
  }

  /* Continue Shopping en top */
  .qsf-cart-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 18px 0 16px;
    color: #0f172a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    border-bottom: 1px solid #e6e8eb;
    transition: color 0.15s;
  }
  .qsf-cart-back:hover { color: #006fff; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-back {
      color: #e7e9ec;
      border-color: #2a2e36;
    }
  }

  /* Layout split : main + Order Details sidebar */
  .qsf-cart-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: flex-start;
    margin-top: 28px;
  }
  @media (max-width: 980px) {
    .qsf-cart-layout { grid-template-columns: 1fr; }
  }

  .qsf-cart-main { min-width: 0; }

  /* Titre "Shopping Cart" */
  .qsf-cart-h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
    color: #0f172a;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-h1 { color: #f1f5f9; }
  }

  /* Card englobant le tableau */
  .qsf-cart-card {
    background: #ffffff;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    overflow: hidden;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-card {
      background: #16191f;
      border-color: #2a2e36;
    }
  }

  /* Table */
  table.qsf-cart-items {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    margin: 0;
    font-size: 13px;
  }
  .qsf-cart-items thead th {
    text-align: left !important;
    padding: 14px 20px 12px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #6b7280 !important;
    background: transparent !important;
    border-bottom: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-items thead th { color: #9ca3af; }
  }
  .qsf-cart-items thead th.qsf-col-actions {
    text-align: right;
    width: 48px;
    padding-right: 20px;
  }

  .qsf-cart-items tbody td {
    padding: 20px 20px;
    border-top: 1px solid #f0f2f4;
    border-bottom: none;
    vertical-align: middle;
    color: #0f172a;
    background: transparent;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-items tbody td {
      color: #e7e9ec;
      border-color: #2a2e36;
    }
  }
  .qsf-cart-items tbody tr:hover td { background: rgba(0,111,255,0.02); }

  /* Cell item : thumb + nom + SKU */
  .qsf-item-cell {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .qsf-item-thumb {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .qsf-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }
  .qsf-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .qsf-item-name,
  .qsf-item-name a {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #006fff !important;
    text-decoration: none !important;
    transition: color 0.15s !important;
  }
  .qsf-item-name a:hover { color: #0058cc !important; }
  .qsf-item-sku {
    font-size: 12px;
    color: #6b7280;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-item-sku { color: #9ca3af; }
  }

  /* Price / Subtotal cells */
  .qsf-col-price,
  .qsf-col-subtotal {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    white-space: nowrap;
    font-weight: 400;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-col-price,
    :root:not([data-qsf-theme="light"]) .qsf-col-subtotal { color: #e7e9ec; }
  }

  /* Quantity selector pill */
  .qsf-qty {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
    height: 30px;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-qty { background: #1c2027; }
  }
  .qsf-qty-btn {
    width: 28px;
    height: 30px;
    border: none;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s, transform 0.08s;
  }
  .qsf-qty-btn:hover {
    color: #0f172a;
    background: rgba(0,0,0,0.04);
  }
  .qsf-qty-btn:active { transform: scale(0.9); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-qty-btn { color: #9ca3af; }
    :root:not([data-qsf-theme="light"]) .qsf-qty-btn:hover { color: #f1f5f9; background: rgba(255,255,255,0.04); }
  }
  .qsf-qty-input {
    width: 32px;
    height: 30px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 13px;
    color: #0f172a;
    font-weight: 500;
    -moz-appearance: textfield;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-qty-input { color: #f1f5f9; }
  }
  .qsf-qty-input::-webkit-inner-spin-button,
  .qsf-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .qsf-qty-input:focus { outline: none; }

  /* Trash icon button */
  .qsf-col-actions { text-align: right; padding-right: 20px !important; }
  .qsf-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s, transform 0.08s;
  }
  .qsf-remove-btn:hover {
    color: #dc2626;
    background: #fee2e2;
  }
  .qsf-remove-btn:active { transform: scale(0.92); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-remove-btn { color: #6b7280; }
    :root:not([data-qsf-theme="light"]) .qsf-remove-btn:hover { background: rgba(220,38,38,0.15); color: #fecaca; }
  }

  /* Footer total row */
  .qsf-cart-items tfoot .qsf-cart-total-row td {
    padding: 14px 20px;
    border-top: 1px solid #f0f2f4;
    border-bottom: none;
    background: transparent;
    font-size: 13px;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-items tfoot .qsf-cart-total-row td { border-color: #2a2e36; }
  }
  .qsf-cart-total-label {
    text-align: left !important;
    color: #0f172a;
    font-weight: 500;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-total-label { color: #f1f5f9; }
  }
  .qsf-cart-total-amount {
    color: #0f172a;
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-total-amount { color: #f1f5f9; }
  }

  /* Header checkbox */
  .qsf-checkbox-bare input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #006fff;
    cursor: pointer;
    border-radius: 3px;
  }

  /* =========== Sidebar Order Details =========== */
  .qsf-cart-sidebar { position: sticky; top: 24px; }
  .qsf-cart-sidebar .qsf-sidebar-card {
    background: #f7f8fa;
    border: none;
    border-radius: 8px;
    padding: 24px 24px 20px;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-cart-sidebar .qsf-sidebar-card { background: #1c2027; }
  }

  .qsf-sidebar-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
  }
  .qsf-sidebar-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-sidebar-title { color: #f1f5f9; }
  }
  .qsf-sidebar-count {
    font-size: 13px;
    color: #6b7280;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-sidebar-count { color: #9ca3af; }
  }

  .qsf-sidebar-body { margin-bottom: 0; }
  .qsf-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: #4b5563;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-total-row { color: #9ca3af; }
  }
  .qsf-total-row span:last-child {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-total-row span:last-child { color: #f1f5f9; }
  }
  .qsf-total-final {
    border-top: none;
    margin-top: 4px;
    padding-top: 12px;
    padding-bottom: 16px;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
  }
  .qsf-total-final span:first-child { font-weight: 700; }
  .qsf-total-final span:last-child {
    font-size: 17px;
    color: #0f172a;
    font-weight: 700;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-qsf-theme="light"]) .qsf-total-final,
    :root:not([data-qsf-theme="light"]) .qsf-total-final span:last-child { color: #f1f5f9; }
  }

  /* Check Out button bleu vif pleine largeur */
  .qsf-cart-sidebar .qsf-checkout-btn {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 14px 20px !important;
    border-radius: 6px !important;
    background: #006fff !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s !important;
    box-shadow: none !important;
    margin-top: 0 !important;
  }
  .qsf-cart-sidebar .qsf-checkout-btn::after {
    content: " →";
    display: inline;
    margin-left: 4px;
    font-weight: 400;
  }
  .qsf-cart-sidebar .qsf-checkout-btn:hover { background: #0058cc !important; }
  .qsf-cart-sidebar .qsf-checkout-btn:active { transform: scale(0.98); }

  /* Gift Code link */
  .qsf-gift-toggle {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    background: transparent !important;
    border: none !important;
    color: #006fff !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    padding: 12px 0 0 !important;
    cursor: pointer !important;
    margin-top: 0 !important;
    transition: color 0.15s !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
  }
  .qsf-gift-toggle:hover { color: #0058cc !important; text-decoration: underline !important; text-underline-offset: 2px; }

  .qsf-coupon-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.06);
  }
  .qsf-coupon-form[hidden] { display: none; }
  .qsf-coupon-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e6e8eb;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
    color: #0f172a;
  }
  .qsf-coupon-input:focus {
    outline: none;
    border-color: #006fff;
    box-shadow: 0 0 0 3px rgba(0,111,255,0.15);
  }
  .qsf-coupon-apply {
    padding: 10px 16px;
    background: #006fff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s;
  }
  .qsf-coupon-apply:hover { background: #0058cc; }
  .qsf-coupon-apply:active { transform: scale(0.97); }
  .qsf-coupon-msg {
    width: 100%;
    flex: 1 0 100%;
    font-size: 12px;
    margin: 6px 0 0;
  }
  .qsf-coupon-msg.is-error { color: #dc2626; }
  .qsf-coupon-msg.is-success { color: #16a34a; }

  .qsf-remove-coupon {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 14px;
    margin-left: 4px;
    line-height: 1;
  }
  .qsf-remove-coupon:hover { background: #fee2e2; color: #dc2626; }
  .qsf-coupon-row { color: #16a34a; }

  /* ============= Banner UniFi Ultra Thin Cables ============= */
  .qsf-cart-banner-wrap { margin-top: 24px; }
  .qsf-cart-banner-default {
    background: #0a0e1a;
    border-radius: 8px;
    padding: 32px 36px;
    margin-top: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    align-items: center;
  }
  .qsf-cart-banner-default::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 55%;
    pointer-events: none;
    background-image:
      radial-gradient(circle at 80% 50%, rgba(0,111,255,0.20), transparent 65%),
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 200" preserveAspectRatio="xMaxYMid slice"><defs><filter id="g"><feGaussianBlur stdDeviation="0.3"/></filter></defs><g stroke="%23006fff" stroke-width="1" fill="none" opacity="0.85" filter="url(%23g)"><path d="M0 60 C 150 60, 300 100, 600 80"/><path d="M0 90 C 150 90, 300 130, 600 110"/><path d="M0 120 C 150 120, 300 160, 600 140"/></g><g stroke="%2300a3ff" stroke-width="0.6" fill="none" opacity="0.5"><path d="M0 65 C 150 65, 300 105, 600 85"/><path d="M0 95 C 150 95, 300 135, 600 115"/></g></svg>');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: cover;
  }
  .qsf-cart-banner-text { position: relative; z-index: 1; max-width: 50%; }
  .qsf-cart-banner-default h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
  }
  .qsf-cart-banner-default p {
    margin: 0 0 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    line-height: 1.5;
  }
  .qsf-cart-banner-cta {
    display: inline-block;
    padding: 8px 18px;
    color: #4d9aff;
    background: transparent;
    border: 1px solid rgba(77,154,255,0.4);
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .qsf-cart-banner-cta:hover {
    background: rgba(77,154,255,0.10);
    border-color: #4d9aff;
    color: #6aacff;
  }

  /* Mobile */
  @media (max-width: 720px) {
    .qsf-cart-items thead { display: none; }
    .qsf-cart-items, .qsf-cart-items tbody, .qsf-cart-items tr, .qsf-cart-items td {
      display: block;
      width: 100%;
    }
    .qsf-cart-items tr {
      padding: 16px 12px;
      border-bottom: 1px solid #f0f2f4;
    }
    .qsf-cart-items tbody td {
      padding: 4px 0;
      border: none;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .qsf-cart-items tbody td.qsf-col-item {
      display: block;
      margin-bottom: 10px;
    }
    .qsf-cart-items tbody td::before {
      content: attr(data-label);
      font-size: 11px;
      color: #6b7280;
      text-transform: uppercase;
      font-weight: 500;
      letter-spacing: 0.04em;
    }
    .qsf-cart-items tbody td.qsf-col-item::before { display: none; }
    .qsf-cart-banner-text { max-width: 100%; }
    .qsf-cart-banner-default::after { width: 30%; opacity: 0.5; }
  }
}
