/* ============================================================
   Capocart Smart Bundles - Frontend CSS v1.0.9
   ============================================================ */

/* ===== BUNDLE LIST / ARCHIVE PAGE ===== */
.csb-bundles-list {
    display: grid;
    grid-template-columns: repeat(var(--csb-columns, 3), 1fr);
    gap: 24px;
    margin: 30px 0;
}
@media (max-width: 900px)  { .csb-bundles-list { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px)  { .csb-bundles-list { grid-template-columns: 1fr; } }

.csb-bundle-card {
    position: relative; border: 1px solid #e5e5e5;
    border-radius: 12px; overflow: hidden;
    transition: transform .2s, box-shadow .2s; background: #fff;
}
.csb-bundle-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.csb-bundle-badge { position: absolute; top: 12px; left: 12px; background: #e53935; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; z-index: 2; text-transform: uppercase; }
.csb-bundle-card-link { text-decoration: none; color: inherit; display: block; }
.csb-bundle-card-image { width: 100%; height: 200px; overflow: hidden; background: #f5f5f5; display: flex; align-items: center; justify-content: center; }
.csb-bundle-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.csb-bundle-card:hover .csb-bundle-card-image img { transform: scale(1.05); }
.csb-bundle-no-image { font-size: 48px; }
.csb-bundle-card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.csb-bundle-card-title { font-size: 16px; font-weight: 700; margin: 0; color: #1a1a1a; }
.csb-bundle-card-model { font-size: 13px; color: #555; }
.csb-bundle-card-count { font-size: 12px; color: #888; }
.csb-bundle-card-cta { display: inline-block; margin-top: 8px; color: #e53935; font-weight: 600; font-size: 13px; }

/* ===== BUNDLE DETAIL PAGE ===== */
.csb-bundle-detail, .csb-bundle-detail * { box-sizing: border-box; }
.csb-bundle-detail { width: 100%; max-width: 100%; overflow-x: hidden; }

/* --- Two-column layout --- */
.csb-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 24px !important;
    align-items: flex-start !important;
    width: 100% !important;
}

/* --- LEFT panel --- */
.csb-layout-left {
    width: 300px !important;
    min-width: 260px !important;
    max-width: 300px !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 90px !important;
    align-self: flex-start !important;
}
.csb-sticky-box { background: #f8f8f8; border: 1px solid #e0e0e0; border-radius: 14px; overflow: hidden; width: 100%; }
.csb-featured-img { width: 100% !important; height: 240px !important; object-fit: cover !important; display: block !important; }
.csb-no-img-placeholder { width: 100%; height: 240px; display: flex; align-items: center; justify-content: center; font-size: 52px; background: #efefef; }
.csb-vtag { background: #1a1a1a; color: #fff; font-size: 11px; font-weight: 700; padding: 8px 14px; text-align: center; letter-spacing: 1.5px; text-transform: uppercase; }
.csb-left-summary { padding: 14px 16px; border-top: 1px solid #e0e0e0; display: flex; flex-direction: column; gap: 8px; }
.csb-sum-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666; }
.csb-sum-row strong { color: #1a1a1a; font-size: 14px; }
.csb-sum-total strong { color: #e53935 !important; font-size: 20px !important; font-weight: 800 !important; }
.csb-left-btns { padding: 14px 16px; border-top: 1px solid #e0e0e0; display: flex; flex-direction: column; gap: 10px; }
.csb-btn-main { display: block !important; width: 100% !important; padding: 12px !important; border: none !important; border-radius: 8px !important; font-size: 14px !important; font-weight: 700 !important; cursor: pointer !important; text-align: center !important; transition: background .2s !important; }
.csb-btn-black { background: #1a1a1a !important; color: #fff !important; }
.csb-btn-black:hover { background: #333 !important; }
.csb-btn-red { background: #e53935 !important; color: #fff !important; }
.csb-btn-red:hover { background: #c62828 !important; }
.csb-btn-main:disabled { opacity: .5 !important; cursor: not-allowed !important; }
.csb-msg-box { margin: 0 14px 14px; padding: 10px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.csb-msg-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.csb-msg-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* --- RIGHT panel --- */
.csb-layout-right { flex: 1 !important; min-width: 0 !important; overflow: hidden; }

/* --- Filters --- */
.csb-filters {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: flex-end !important;
    padding: 12px !important;
    background: #f8f8f8 !important;
    border-radius: 10px !important;
    margin-bottom: 12px !important;
}
.csb-fg { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px; }
.csb-fg label { font-size: 10px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .5px; }
.csb-fsel { padding: 9px 10px; border: 1px solid #ddd; border-radius: 7px; font-size: 13px; background: #fff; appearance: none; cursor: pointer; width: 100%; }
.csb-fsel:focus { outline: none; border-color: #e53935; }
.csb-fg-reset { flex: 0 0 auto !important; min-width: auto !important; display: flex !important; align-items: flex-end !important; }
.csb-btn-reset { padding: 9px 16px; border: 1px solid #ddd; border-radius: 7px; background: transparent; font-size: 13px; color: #666; cursor: pointer; white-space: nowrap; height: 38px; }
.csb-btn-reset:hover { border-color: #999; color: #333; }
.csb-meta { font-size: 12px; color: #666; margin-bottom: 10px; }

/* --- Desktop Table --- */
.csb-tbl-wrap { border: 1px solid #e5e5e5; border-radius: 10px; overflow: visible; position: relative; }
.csb-tbl { width: 100%; border-collapse: collapse; }
.csb-tbl thead th { background: #f5f5f5; padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #555; border-bottom: 1px solid #e5e5e5; white-space: nowrap; }
.csb-tbl tbody tr { border-bottom: 1px solid #f0f0f0; transition: background .15s; position: relative; }
.csb-tbl tbody tr:last-child { border-bottom: none; }
.csb-tbl tbody tr:hover { background: #fafafa; }
.csb-tbl td { padding: 10px 12px; vertical-align: middle; }

/* Image + zoom (desktop hover only) */
.csb-tc-img { width: 64px; overflow: visible !important; position: relative; }
.csb-img-wrap { position: relative; display: inline-block; width: 52px; height: 52px; }
.csb-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid #eee; display: block; cursor: zoom-in; }
.csb-zoom { display: none; position: absolute; left: 62px; top: 50%; transform: translateY(-50%); width: 170px; height: 170px; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,.22); border: 2px solid #fff; z-index: 9999; background: #fff; pointer-events: none; }
.csb-zoom img { width: 100%; height: 100%; object-fit: cover; display: block; }
.csb-tbl tbody tr:hover .csb-zoom { display: block; }

/* Disable zoom on touch devices */
@media (hover: none), (pointer: coarse) {
    .csb-zoom { display: none !important; }
}

.csb-tc-name { min-width: 150px; }
.csb-pname { font-weight: 600; font-size: 13px; color: #1a1a1a; text-decoration: none; line-height: 1.4; display: block; transition: color .15s; }
.csb-tbl tbody tr:hover .csb-pname { color: #e53935; text-decoration: underline; }
.csb-tc-price { width: 120px; white-space: nowrap; font-size: 13px; }
.csb-tc-qty { width: 130px; }
.csb-tc-sub { width: 100px; font-weight: 600; color: #1a1a1a; font-size: 13px; white-space: nowrap; }

/* Qty controls */
.csb-qty-wrap { display: inline-flex !important; align-items: center !important; border: 2px solid #ccc !important; border-radius: 8px !important; overflow: hidden !important; background: #fff !important; height: 34px !important; }
.csb-qbtn { width: 30px !important; height: 34px !important; border: none !important; background: #f0f0f0 !important; cursor: pointer !important; font-size: 18px !important; font-weight: 300 !important; color: #333 !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 0 !important; margin: 0 !important; flex-shrink: 0 !important; line-height: 1 !important; }
.csb-qbtn:hover { background: #ddd !important; }
.csb-qinput { width: 38px !important; height: 34px !important; border: none !important; border-left: 1px solid #ddd !important; border-right: 1px solid #ddd !important; text-align: center !important; font-size: 14px !important; font-weight: 700 !important; color: #000 !important; -webkit-text-fill-color: #000 !important; background: #fff !important; display: inline-block !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; outline: none !important; line-height: 34px !important; }

.csb-row-zero { opacity: .45; }
.csb-no-results { padding: 30px; text-align: center; color: #888; font-size: 14px; display: none; }

/* --- Mobile Card View --- */
.csb-cards { display: none; }
.csb-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px; border-bottom: 1px solid #f0f0f0; background: #fff; }
.csb-card:last-child { border-bottom: none; }
.csb-card-img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; flex-shrink: 0; }
.csb-card-body { flex: 1; min-width: 0; }
.csb-card-name { font-weight: 600; font-size: 13px; color: #1a1a1a; text-decoration: none; line-height: 1.4; display: block; margin-bottom: 4px; word-break: break-word; }
.csb-card-price { font-size: 12px; color: #555; margin-bottom: 8px; }
.csb-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.csb-card-subtotal { font-size: 13px; font-weight: 700; color: #e53935; }

/* Mobile qty */
.csb-qty-wrap-mob { display: inline-flex !important; align-items: center !important; border: 2px solid #ccc !important; border-radius: 8px !important; overflow: hidden !important; background: #fff !important; height: 38px !important; }
.csb-qbtn-mob { width: 36px !important; height: 38px !important; border: none !important; background: #f0f0f0 !important; cursor: pointer !important; font-size: 20px !important; font-weight: 300 !important; color: #333 !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 0 !important; margin: 0 !important; flex-shrink: 0 !important; -webkit-tap-highlight-color: transparent; }
.csb-qbtn-mob:active { background: #ddd !important; }
.csb-qinput-mob { width: 44px !important; height: 38px !important; border: none !important; border-left: 1px solid #ddd !important; border-right: 1px solid #ddd !important; text-align: center !important; font-size: 16px !important; font-weight: 700 !important; color: #000 !important; -webkit-text-fill-color: #000 !important; background: #fff !important; display: inline-block !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; outline: none !important; line-height: 38px !important; }

/* Mobile sticky bottom bar */
.csb-mobile-bar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 2px solid #e5e5e5; padding: 10px 16px env(safe-area-inset-bottom, 10px); z-index: 9999; box-shadow: 0 -4px 16px rgba(0,0,0,.1); }
.csb-mobile-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; color: #555; }
.csb-mobile-bar-top strong { color: #e53935; font-size: 18px; }
.csb-mobile-bar-btns { display: flex; gap: 10px; }

/* ===== MOBILE OVERRIDES ===== */
@media screen and (max-width: 767px) {
    .csb-layout { flex-direction: column !important; gap: 0 !important; }
    .csb-layout-left { width: 100% !important; min-width: unset !important; max-width: 100% !important; position: relative !important; top: 0 !important; margin-bottom: 16px; }
    .csb-sticky-box { border-radius: 10px; }
    .csb-featured-img { height: 200px !important; }
    /* Hide desktop summary/buttons — shown in bottom bar */
    .csb-left-summary, .csb-left-btns { display: none !important; }
    /* Show mobile bottom bar */
    .csb-mobile-bar { display: block !important; }
    /* Padding to avoid content behind bottom bar */
    .csb-layout-right { padding-bottom: 110px !important; }

    /* ---- Filters: all in ONE LINE on mobile ---- */
    .csb-filters {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        padding: 10px !important;
        align-items: flex-end !important;
    }
    .csb-fg {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
    }
    .csb-fg label {
        font-size: 9px !important;
        margin-bottom: 3px !important;
    }
    .csb-fsel {
        font-size: 12px !important;
        padding: 7px 6px !important;
        width: 100% !important;
    }
    .csb-fg-reset {
        flex: 0 0 auto !important;
        width: auto !important;
    }
    .csb-btn-reset {
        width: auto !important;
        padding: 7px 10px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        height: 36px !important;
    }

    /* Show cards, hide table */
    .csb-tbl-wrap { display: none !important; }
    .csb-cards { display: block !important; border: 1px solid #e5e5e5; border-radius: 10px; overflow: hidden; background: #fff; }
}
