/* Amazon-Style Book Card Styles for Search Results */

/* Page-level helpers */
.es-result-show {
    margin-bottom: 10px;
}

.category-style {
    padding: 7px !important;
}

/* Book count display - positioned above cards, right aligned */
.book-count-text {
    text-align: right;
    font-size: 13px;
    color: #565959;
}

/* ========================================
   DESKTOP STYLES (Default)
   ======================================== */

/* Main card container */
.amz-book-card {
    padding: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid #e3e3e3;
    gap: 20px;
    font-family: "Amazon Ember", Arial, sans-serif;
}

/* Book cover image section */
.amz-book-image {
    flex-shrink: 0;
    width: 160px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.amz-book-image a {
    display: block;
}

.amz-book-image img {
    width: 160px;
    height: 200px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.amz-book-image:hover img {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Free tag overlay */
.res-image-height {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 4px;
    position: relative;
}

.free_tag_line {
    width: 80px !important;
    height: 25px !important;
    display: block;
    align-self: flex-start;
    z-index: 3;
    border: none !important;
}

/* Hide old free tag classes */
.amz-free-tag,
.free-tag-container {
    display: none;
}

/* Book info section */
.amz-book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Book title */
.amz-book-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
}

.amz-book-title a {
    color: black;
    text-decoration: none;
}

.amz-book-title a:hover {
    color: #007185;
}

/* Author line */
.amz-book-author {
    margin-bottom: 1px;
    font-size: 14px;
    color: #565959;
}

.amz-book-author a {
    font-size: 12px;
    color: #007185;
    text-decoration: none;
}

.amz-book-author a:hover {
    color: #0c3353;
}

/* Edition text */
.amz-book-edition {
    margin-bottom: 1px;
    font-size: 14px;
    color: #565959;
}

/* ISBN display */
.amz-book-isbn {
    font-size: 13px;
    color: #565959;
}

/* Book format/condition badge */
.amz-book-format {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: #565959;
}

.amz-book-format a {
    color: #007185;
    text-decoration: none;
}

.amz-book-format a:hover {
    color: #0c3353;
}

/* Price section */
.amz-book-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-top: 8px;
}

.amz-price-symbol {
    font-size: 13px;
    color: #0f1111;
    position: relative;
    top: -8px;
}

.amz-price-whole {
    font-size: 28px;
    font-weight: 400;
    color: #0f1111;
    line-height: 1;
}

.amz-price-cents {
    font-size: 13px;
    color: #0f1111;
    position: relative;
    top: -8px;
}

.amz-price-original {
    font-size: 14px;
    color: #565959;
    text-decoration: line-through;
}

.amz-price-label {
    margin-left: 10px;
    font-size: 12px;
    color: #565959;
}

/* Star Rating Styles */
.amz-book-rating {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 4px;
}

.amz-rating-number {
    font-size: 14px;
    color: #0F1111;
    font-weight: 400;
    margin-right: 4px;
}

.amz-star {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin: 0 -1px;
}

.amz-star-filled {
    fill: #FFA41C;
}

.amz-star-empty {
    fill: #E0E0E0;
}

.amz-star-half path {
    stroke: none;
}

.amz-rating-count {
    font-size: 14px;
    color: #007185;
    text-decoration: none;
    margin-left: 4px;
}

.amz-rating-count:hover {
    color: #C7511F;
    text-decoration: underline;
}

/* Delivery info */
.amz-book-delivery {
    font-size: 13px;
    color: #565959;
    margin-top: 2px;
}

/* Add to Cart button */
.amz-add-to-cart {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    width: 100px;
    text-align: center;
    background: #ffbc00;
    border: 1px solid #D5D9D9;
    border-radius: 20px;
    color: #0F1111;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.amz-add-to-cart:hover {
    background: #F7CA00;
}

.amz-add-to-cart:active {
    background: #F2C200;
    border-color: #CCCCCC;
}

/* No results found */
.amz-no-results {
    text-align: center;
    padding: 60px 20px;
}

.amz-no-results img {
    width: 150px;
    margin-bottom: 20px;
}

.amz-no-results-text {
    font-size: 18px;
    color: #565959;
    font-weight: 500;
}

/* ========================================
   TABLET STYLES (768px) - Middle Ground
   ======================================== */
@media (max-width: 768px) {
    .amz-book-title a {
        color: #0b5f93;
    }

    .amz-book-card {
        padding: 12px 8px;
        gap: 12px;
        align-items: center;
    }

    .amz-book-image {
        width: 140px;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
    }

    .amz-book-image img {
        width: 130px;
        height: 170px;
    }

    .amz-book-info {
        flex: 1;
        gap: 3px;
    }

    .amz-book-title {
        font-size: 16px;
        line-height: 1.25;
        max-height: 60px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    .amz-book-author {
        font-size: 12px;
        color: #565959;
    }

    .amz-book-author a {
        font-size: 12px;
        color: #565959;
    }

    .amz-book-edition,
    .amz-book-isbn {
        font-size: 12px;
        color: #565959;
    }

    .amz-book-rating {
        margin-top: 3px;
    }

    .amz-rating-number,
    .amz-rating-count {
        font-size: 12px;
    }

    .amz-star {
        width: 13px;
        height: 13px;
    }

    .amz-book-format {
        font-size: 12px;
        margin-top: 3px;
        color: #0f1111;
        font-weight: 700;
    }

    .amz-book-format a {
        color: #0f1111;
    }

    .amz-book-price {
        margin-top: 6px;
    }

    .amz-price-whole {
        font-size: 24px;
        color: #0f1111;
    }

    .amz-price-symbol,
    .amz-price-cents {
        font-size: 12px;
        top: -7px;
        color: #0f1111;
    }

    .amz-book-delivery {
        margin-top: 4px;
        font-size: 12px;
        color: #0f1111;
    }

    .amz-add-to-cart {
        width: 100%;
        padding: 8px 12px;
        margin-top: 8px;
        margin-bottom: 8px;
        border-radius: 100px;
    }
}

/* ========================================
   MOBILE STYLES (480px)
   ======================================== */
@media (max-width: 480px) {
    .amz-book-title a {
        color: #0b5f93;
    }

    .amz-book-card {
        padding: 8px 0;
        margin: 8px 0;
        gap: 0;
        align-items: center;
        cursor: pointer;
    }

    /* Image column: ~35% width */
    .amz-book-image {
        width: 35%;
        max-width: 130px;
        padding-right: 0;
        box-sizing: border-box;
        align-items: center;
        justify-content: center;
    }

    .amz-book-image img {
        width: 90%;
        height: auto;
        max-height: 180px;
    }

    /* Info column: ~58% width */
    .amz-book-info {
        width: 58%;
        gap: 5px;
        box-sizing: border-box;
    }

    .amz-book-title {
        font-size: 15px;
        line-height: 1.25;
        max-height: 60px;
        margin-bottom: 2px;
        -webkit-line-clamp: 3;
    }

    .amz-book-author {
        font-size: 11px;
        color: #565959;
        margin-bottom: 3px;
    }

    .amz-book-author a {
        font-size: 11px;
        color: #565959;
    }

    .amz-book-edition,
    .amz-book-isbn {
        font-size: 12px !important;
        color: #565959 !important;
        margin-bottom: 3px;
    }

    /* Divider line */
    .amz-book-info>div[style*="border-top"] {
        margin: 4px 0 !important;
        width: 100px !important;
    }

    .amz-book-rating {
        margin-top: 2px !important;
        margin-bottom: 2px;
    }

    .amz-rating-number {
        font-size: 11px;
    }

    .amz-star {
        width: 12px;
        height: 12px;
    }

    .amz-rating-count {
        font-size: 10px;
    }

    .amz-book-format {
        font-size: 12px;
        margin-top: 4px;
        color: #0f1111;
        font-weight: 700;
    }

    .amz-book-format a {
        font-weight: 500;
        color: #0f1111;
    }

    .amz-book-price {
        margin-top: 4px;
        gap: 2px;
    }

    .amz-price-symbol {
        font-size: 11px;
        top: -6px;
    }

    .amz-price-whole {
        font-size: 22px;
        color: #0f1111;
    }

    .amz-price-cents {
        font-size: 11px;
        top: -6px;
    }

    .amz-price-label {
        font-size: 10px;
        margin-left: 6px;
    }

    .amz-price-original {
        font-size: 11px;
    }

    .amz-book-delivery {
        margin-top: 0;
        font-size: 11px;
        color: #0f1111;
    }

    .amz-add-to-cart {
        display: block;
        width: 100%;
        margin-top: 8px;
        padding: 10px 16px;
        font-size: 13px;
        font-weight: 600;
        border-radius: 100px;
        box-sizing: border-box;
    }
}

/* ========================================
   MOBILE SEARCH PAGE FIXES
   Fixes for sponsored ad and float clearing
   ======================================== */

/* Sponsored Ad - Mobile Responsive Fix */
@media (max-width: 768px) {
    .sponsered-ad-image {
        max-width: 100%;
        height: auto;
        display: block;
    }

    .margin-20-top .margin-bottom-20,
    .margin-20-top .no-padding {
        overflow: hidden;
    }

    .margin-20-top .no-padding picture,
    .margin-20-top .no-padding picture img,
    .margin-20-top .no-padding a picture,
    .margin-20-top .no-padding a picture img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    #content_body .margin-20-top,
    #content_body .no-padding {
        overflow: hidden;
        box-sizing: border-box;
    }

    /* Fix desktop layout overflowing on mobile */
    #search-result #center-search-section {
        min-width: unset !important;
        width: 100% !important;
    }

    .on-searching-section {
        width: 100% !important;
        min-width: unset !important;
    }

    .solutioninn-on-searching-list li {
        min-width: unset !important;
    }

    #content_body {
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    #content_body>div {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .col-lg-12,
    .col-md-12,
    .col-sm-12,
    .col-xs-12 {
        max-width: 100% !important;
    }

    .book-count-text {
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    /* Fix float clearing issue - Sponsored ad uses col-* with float:left */
    #content_body .margin-20-top {
        float: none !important;
        clear: both !important;
    }

    /* Ensure book cards clear the float and display properly */
    .amz-book-card {
        clear: both !important;
        width: 100% !important;
        min-width: 100% !important;
        float: none !important;
    }

    /* Clear float after the sponsored ad container */
    #content_body .margin-20-top+* {
        clear: both !important;
    }

    /* Force all col-* classes to not float on mobile */
    #content_body [class*="col-"] {
        float: none !important;
    }
}