/* =========================================================
   Pariyatti eBook Shelf - Shopify-safe stylesheet
   Scoped to #shelf so it does not reset or alter the Shopify
   theme's global typography, buttons, forms, sections, etc.
   ========================================================= */

/* Shelf container */
#shelf {
    width: 100%;
    margin: 20px 0;
    box-sizing: border-box;
}

#shelf *,
#shelf *::before,
#shelf *::after {
    box-sizing: border-box;
}

/* Language selector */
#shelf #lang-select {
    display: block;
    width: 230px;
    max-width: 100%;
    min-height: 40px;
    margin: 10px auto 25px;
    padding: 7px 35px 7px 10px;
    font-size: 16px;
    line-height: 1.4;
    text-transform: capitalize;
    box-sizing: border-box;
}

/* Bookshelf grid */
#shelf #bookshelf {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    margin: 0;
    padding: 0;
}

/* Individual book */
#shelf .book {
    width: 280px;
    max-width: 100%;
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: 1px solid #000;
    border-radius: 3px;
    box-shadow: 1px 1px 0 #000;
    background: #fff;
    overflow: hidden;
}

/* Top section */
#shelf .book-top-info {
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #000;
}

/* Language label */
#shelf .book-top-info > span {
    display: block;
    width: 100%;
    margin: 0;
    padding: 5px 3px;
    text-align: center;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
    text-transform: capitalize;
    background: #D0A45A;
    color: #fff;
}

/* Book image container */
#shelf .bkcont {
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: center;
}

/* Book cover */
#shelf .bkcover {
    display: inline-block;
    width: auto;
    max-width: calc(100% - 20px);
    height: 150px;
    max-height: 150px;
    margin: 10px;
    padding: 0;
    border: 0;
    box-shadow: 0 0 3px #888;
    object-fit: contain;
    vertical-align: middle;
}

/* Book title */
#shelf .book figcaption {
    display: block;
    width: 100%;
    min-height: 36px;
    height: auto;
    margin: 0;
    padding: 0 10px 18px;
    text-align: center;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 700;
    color: inherit;
}

/* If a title contains a span */
#shelf .book figcaption span {
    font-weight: 400;
    font-style: italic;
    text-transform: capitalize;
}

/* VIP tag */
#shelf .book-top-info .vip-tag {
    display: inline-block;
    width: auto;
    max-width: 80%;
    margin: 0 0 10px;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 1px 0 1px #888;
    background: #4682b4;
    color: #fff;
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
}

/* Bottom links area */
#shelf .book-bottom-links {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    margin: 0;
    padding: 0;
}

/* Each link column */
#shelf .available-at {
    width: 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    text-align: center;
}

/* Pariyatti column */
#shelf .from-pariyatti {
    min-height: 200px;
    height: 200px;
}

/* Other vendor column */
#shelf .other-vendors {
    min-height: 200px;
    height: 200px;
    border-left: 1px solid #000;
}

/* Headers */
#shelf .available-at header {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: center;
}

#shelf .available-at header h5 {
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 0 3px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 700;
    text-align: center;
}

/* Individual buy/vendor options */
#shelf .buy-options-cont {
    width: 100%;
    margin: 0;
    padding: 0 5px 10px;
    text-align: center;
    line-height: 1.3;
}

#shelf .buy-options-cont a {
    display: inline-block;
    margin: 0;
    padding: 0;
    text-align: center;
    text-decoration: none;
}

#shelf .buy-options-cont img {
    display: inline-block;
    width: auto;
    max-width: 40px;
    height: auto;
    max-height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: middle;
}

/* Original vendor logo class */
#shelf .vender-logo {
    width: 100px;
    max-width: 100%;
    height: auto;
    margin: 10px 0 0;
}

/* Orange Pariyatti button */
#shelf .p-book-btn {
    display: inline-block;
    width: 100px;
    min-height: 0;
    margin: .8em 0 0;
    padding: 9px 14px;
    border: none;
    border-radius: 0;
    background: #BA5626;
    color: #f3f1ea;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 1px 1px 1px #000;
    transition: .3s all;
}

#shelf .p-book-btn:hover {
    background-color: #D0A45A;
    color: #000;
}

#shelf .p-book-btn:active {
    box-shadow: inset 0 0 1px #000;
}

/* The JS currently creates a .btn button for the Pariyatti link.
   Keep it isolated from Shopify's global button styling. */
#shelf .buy-options-cont .btn {
    display: inline-block;
    width: auto;
    min-width: 100px;
    max-width: 100%;
    margin: 0;
    padding: 9px 10px;
    border: 0;
    border-radius: 0;
    background: #BA5626;
    color: #f3f1ea;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 1px 1px 1px #000;
}

#shelf .buy-options-cont .btn:hover {
    background: #D0A45A;
    color: #000;
}

/* Hide class used by the original script */
#shelf .hide {
    display: none !important;
}

/* Old selector retained for compatibility */
#shelf #search-section {
    width: 100%;
    text-align: center;
}

/* =========================================================
   Responsive layout
   ========================================================= */

@media screen and (max-width: 600px) {

    #shelf {
        margin: 15px 0;
    }

    #shelf #bookshelf {
        gap: 15px;
    }

    #shelf .book {
        width: 280px;
        flex-basis: 280px;
    }
}

@media screen and (max-width: 330px) {

    #shelf #bookshelf {
        gap: 10px;
    }

    #shelf .book {
        width: 100%;
        flex-basis: 100%;
    }
}
