/* Header search (hs-) and mini cart (hc-) */
:root {
    --hdr-primary: var(--primary-color, #753d9d);
    --hdr-primary-dark: #5e2f80;
    --hdr-primary-soft: #f4eef9;
    --hdr-text: #1f2333;
    --hdr-muted: #7a7f8f;
    --hdr-border: #e8e9ef;
    --hdr-surface: #f5f6f9;
    --hdr-danger: #e5484d;
    --hdr-radius: 14px;
    --hdr-shadow: 0 18px 50px -12px rgba(31, 35, 51, .22), 0 4px 12px -4px rgba(31, 35, 51, .08);
}

/* ---------- Search ---------- */
.hs {
    position: relative;
    width: 100%;
    z-index: 1030;
}

.hs-form {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 48px;
    padding: 0 6px 0 4px;
    background: var(--hdr-surface);
    border: 1.5px solid transparent;
    border-radius: var(--hdr-radius);
    transition: background-color .2s, border-color .2s, box-shadow .2s;
}

.hs-form:hover {
    border-color: var(--hdr-border);
}

.hs.is-open .hs-form,
.hs-form:focus-within {
    background: #fff;
    border-color: var(--hdr-primary);
    box-shadow: 0 0 0 4px rgba(117, 61, 157, .12);
}

.hs-icon {
    display: inline-flex;
    flex: 0 0 auto;
    padding-right: 8px;
    color: var(--hdr-muted);
    transition: color .2s;
}

.hs-form:focus-within .hs-icon {
    color: var(--hdr-primary);
}

.hs-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    padding: 0 4px;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--hdr-text);
    font-family: inherit;
    font-size: 14px;
}

.hs-input::placeholder {
    color: #9da1ae;
}

/* hide the browser's own clear button, there is one in the box */
.hs-input::-webkit-search-cancel-button,
.hs-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.hs-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e9eaf0;
    color: var(--hdr-muted);
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

.hs-clear:hover {
    background: #dfe0e8;
    color: var(--hdr-text);
}

.hs-spinner {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(117, 61, 157, .2);
    border-top-color: var(--hdr-primary);
    border-radius: 50%;
    animation: hdr-spin .7s linear infinite;
}

.hs-submit {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: var(--hdr-primary);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s, transform .1s;
}

.hs-submit:hover {
    background: var(--hdr-primary-dark);
}

.hs-submit:active {
    transform: scale(.97);
}

.hs-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    display: none;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--hdr-border);
    border-radius: 18px;
    box-shadow: var(--hdr-shadow);
    animation: hdr-pop .18s ease-out;
}

.hs.is-open .hs-panel {
    display: block;
}

.hs-panel-body {
    display: flex;
    max-height: min(460px, 65vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.hs-books {
    flex: 1 1 60%;
    min-width: 0;
    padding: 14px 10px;
}

.hs-people {
    flex: 1 1 40%;
    min-width: 0;
    padding: 14px;
    background: #fafafc;
    border-right: 1px solid var(--hdr-border);
}

.hs-section-title {
    margin: 0 6px 8px;
    color: var(--hdr-muted);
    font-size: 12px;
    font-weight: 700;
}

.hs-book-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.hs-book {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    color: var(--hdr-text) !important;
    text-decoration: none;
    transition: background-color .15s;
}

.hs-book:hover,
.hs-book:focus-visible {
    background: var(--hdr-primary-soft);
    outline: 0;
}

.hs-book-thumb {
    flex: 0 0 40px;
    width: 40px;
    height: 56px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--hdr-surface);
    box-shadow: 0 2px 6px rgba(31, 35, 51, .12);
}

.hs-book-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hs-book-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.hs-book-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.6;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hs-book-meta {
    overflow: hidden;
    color: var(--hdr-muted);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hs-dot {
    margin: 0 3px;
    color: #c4c6cf;
}

.hs mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(117, 61, 157, .14);
    color: var(--hdr-primary);
}

.hs-badge {
    flex: 0 0 auto;
    margin-right: auto;
    padding: 2px 8px;
    border-radius: 20px;
    background: #fdecec;
    color: var(--hdr-danger);
    font-size: 11px;
    font-weight: 700;
}

.hs-group + .hs-group {
    margin-top: 14px;
}

.hs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hs-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 12px;
    border: 1px solid var(--hdr-border);
    border-radius: 30px;
    background: #fff;
    color: var(--hdr-text) !important;
    font-size: 12.5px;
    text-decoration: none;
    transition: border-color .15s, color .15s, background-color .15s;
}

.hs-chip svg {
    flex: 0 0 auto;
    color: var(--hdr-muted);
}

.hs-chip span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hs-chip:hover {
    border-color: var(--hdr-primary);
    background: var(--hdr-primary-soft);
    color: var(--hdr-primary) !important;
}

.hs-chip:hover svg {
    color: var(--hdr-primary);
}

.hs-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px;
    border-top: 1px solid var(--hdr-border);
    color: var(--hdr-primary) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s;
}

.hs-all:hover {
    background: var(--hdr-primary-soft);
}

.hs-empty {
    padding: 34px 20px;
    color: var(--hdr-muted);
    text-align: center;
}

.hs-empty svg {
    color: #c4c6cf;
}

.hs-empty-title {
    margin-top: 10px;
    color: var(--hdr-text);
    font-size: 14px;
    font-weight: 700;
}

.hs-empty-text {
    margin-top: 4px;
    font-size: 12.5px;
}

.hs-hint {
    padding: 14px 18px;
    color: var(--hdr-muted);
    font-size: 13px;
}

/* mobile header search */
.hs--mobile .hs-form {
    height: 44px;
}

.hs--mobile .hs-panel-body {
    flex-direction: column;
    max-height: 70vh;
}

.hs--mobile .hs-people {
    border-top: 1px solid var(--hdr-border);
    border-right: 0;
}

@media (max-width: 1199.98px) {
    .hs:not(.hs--mobile) .hs-submit {
        padding: 0 12px;
    }
}

/* ---------- Mini cart ---------- */
.hc {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.hc-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 16px;
    border: 1.5px solid var(--hdr-border);
    border-radius: var(--hdr-radius);
    background: #fff;
    color: var(--hdr-text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s, color .2s, box-shadow .2s;
}

.hc-toggle::after {
    display: none !important;
}

.hc-toggle:hover,
.hc-toggle[aria-expanded="true"] {
    border-color: var(--hdr-primary);
    color: var(--hdr-primary);
    box-shadow: 0 6px 18px -8px rgba(117, 61, 157, .45);
}

.hc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--hdr-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.hc-badge.is-empty {
    background: #e9eaf0;
    color: var(--hdr-muted);
}

.hc-menu.dropdown-menu {
    width: 370px;
    max-width: calc(100vw - 24px);
    margin-top: 10px !important;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--hdr-border);
    border-radius: 18px;
    box-shadow: var(--hdr-shadow);
    text-align: right;
}

.hc-menu.dropdown-menu.show {
    animation: hdr-pop .18s ease-out;
}

.hc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
}

.hc-title {
    color: var(--hdr-text);
    font-size: 15px;
    font-weight: 800;
}

.hc-count {
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--hdr-primary-soft);
    color: var(--hdr-primary);
    font-size: 12px;
    font-weight: 700;
}

.hc-items {
    max-height: 330px;
    margin: 0;
    padding: 0 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.hc-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 12px;
    transition: background-color .15s;
}

.hc-item + .hc-item {
    border-top: 1px dashed var(--hdr-border);
}

.hc-item:hover {
    background: #fafafc;
}

.hc-thumb {
    flex: 0 0 52px;
    width: 52px;
    height: 72px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--hdr-surface);
    box-shadow: 0 3px 8px rgba(31, 35, 51, .14);
}

.hc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hc-info {
    flex: 1 1 auto;
    min-width: 0;
}

.hc-name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--hdr-text) !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.65;
    text-decoration: none;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hc-name:hover {
    color: var(--hdr-primary) !important;
}

.hc-author {
    margin-top: 2px;
    overflow: hidden;
    color: var(--hdr-muted);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.hc-qty {
    padding: 2px 9px;
    border-radius: 8px;
    background: var(--hdr-surface);
    color: var(--hdr-muted);
    font-size: 12px;
}

.hc-price {
    color: var(--hdr-text);
    font-size: 13.5px;
    font-weight: 800;
}

.hc-price small,
.hc-total small {
    color: var(--hdr-muted);
    font-size: 11px;
    font-weight: 400;
}

.hc-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #a3a7b4;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.hc-remove:hover {
    background: #fdecec;
    color: var(--hdr-danger);
}

.hc-remove:disabled {
    opacity: .5;
    cursor: wait;
}

.hc-foot {
    margin-top: 6px;
    padding: 14px 18px 18px;
    background: #fafafc;
    border-top: 1px solid var(--hdr-border);
}

.hc-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--hdr-muted);
    font-size: 13px;
}

.hc-total strong {
    color: var(--hdr-text);
    font-size: 17px;
    font-weight: 800;
}

.hc-actions {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 8px;
    margin-top: 14px;
}

.hc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s, border-color .2s, color .2s, transform .1s;
}

.hc-btn:active {
    transform: scale(.98);
}

.hc-btn--primary {
    border: 1.5px solid var(--hdr-primary);
    background: var(--hdr-primary);
    color: #fff !important;
}

.hc-btn--primary:hover {
    border-color: var(--hdr-primary-dark);
    background: var(--hdr-primary-dark);
}

.hc-btn--ghost {
    border: 1.5px solid var(--hdr-border);
    background: #fff;
    color: var(--hdr-text) !important;
}

.hc-btn--ghost:hover {
    border-color: var(--hdr-primary);
    color: var(--hdr-primary) !important;
}

.hc-empty {
    padding: 18px 24px 26px;
    text-align: center;
}

.hc-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--hdr-primary-soft);
    color: var(--hdr-primary);
}

.hc-empty-title {
    margin-top: 14px;
    color: var(--hdr-text);
    font-size: 15px;
    font-weight: 800;
}

.hc-empty-text {
    margin: 6px 0 18px;
    color: var(--hdr-muted);
    font-size: 12.5px;
}

.hc-empty .hc-btn {
    width: 100%;
}

/* mobile header cart icon */
.hc-mobile {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-right: 6px;
    border: 1.5px solid var(--hdr-border);
    border-radius: 12px;
    background: #fff;
    color: var(--hdr-text) !important;
    vertical-align: middle;
}

.hc-mobile .hc-badge {
    position: absolute;
    top: -7px;
    left: -7px;
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    box-shadow: 0 0 0 2px #fff;
}

@media (max-width: 1199.98px) {
    .hc-toggle-text {
        display: none;
    }

    .hc-toggle {
        padding: 0 12px;
    }
}

@keyframes hdr-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes hdr-pop {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hs-panel,
    .hc-menu.dropdown-menu.show,
    .hs-spinner {
        animation: none;
    }
}

/* the old template gives every span in the toolbar a margin */
.right-toolbar .hc span {
    margin-right: 0;
}

.right-toolbar > .hc {
    margin-right: 12px;
}
