/* Responsive styles for website */

/* Desktop product card styling - to maintain original appearance */
@media (min-width: 992px) {
    .card-product {
        border-radius: 5px;
        box-shadow: none;
        margin: 0 auto;
        height: 100%;
        display: flex;
        flex-direction: column;
        border: 1px solid #e5e5e5;
        background-color: #fff;
        transition: all 0.3s ease;
    }
    
    .card-product:hover {
        /* Xóa transform và box-shadow tại đây */
    }
    
    .card-product .card-image {
        width: auto;
        max-width: 100%;
        height: auto;
        object-fit: contain;
        margin: 0 auto;
        display: block;
        border-radius: 0;
        aspect-ratio: auto;
        transition: transform 0.3s ease;
    }
    
    .card-product:hover .card-image {
        transform: scale(1.05);
    }
    
    .card-header {
        text-align: center;
        padding: 4px 4px 0;
        border-radius: 0;
        height: 250px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .book-info {
        padding-top: 10px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        height: 150px; /* Fixed height for all book info sections */
    }
    
    .card-content {
        flex-grow: 1;
    }
    
    .card-footer {
        margin-top: auto;
    }
    
    .product-buy {
        height: 38px;
    }
    
    .card-button {
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Medium devices (tablets, less than 992px) */
@media (max-width: 991.98px) {
    /* Product grid adjustments */
    .home-products {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-gap: 15px;
    }
    
    /* Smaller header elements */
    .header-middle-right-item span {
        font-size: 12px;
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: none;
    }
}

/* Small devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
    /* Header adjustments */
    .header-middle-center {
        display: none !important; /* Completely hide search bar */
    }
    
    /* Hide the regular filter button */
    .filter-btn {
        display: none !important;
    }
    
    .advanced-search {
        display: none !important; /* Hide the advanced search/filter dropdown */
    }
    
    /* Hide the main navigation menu */
    .header-bottom {
        display: none !important;
    }
    
    /* Make header more compact */
    .header-middle .container {
        padding: 0 10px;
        justify-content: space-between;
    }
    
    /* Hamburger menu styling */
    .mobile-menu-toggle {
        display: block !important;
        order: -1; /* Move to the left side */
    }
    
    /* Header icons alignment */
    .header-middle-right-list {
        display: flex;
        align-items: center;
    }
    
    /* Banner slider adjustments */
    .slide-banner__nav-button {
        display: none;
    }
    
    .slide-banner__title {
        font-size: 2.5rem;
    }
    
    /* Product grid - 2 columns */
    .home-products {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 10px;
    }
    
    /* Mobile menu */
    .menu-list {
        display: none;
    }
    
    /* Adjust slider for smaller screens */
    .slide-banner__item {
        background-size: cover !important;
        height: 300px !important;
    }
    
    /* Helper class to hide elements on mobile */
    .mobile-hide {
        display: none !important;
    }
    
    .card-button {
        width: 100%;
        border-radius: 5px;
        margin-top: 5px;
        padding: 8px 0;
        font-weight: 500;
        text-transform: uppercase;
        font-size: 13px;
        background-color: #B5292F;
        color: white;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 34px;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Fix horizontal scrolling issues */
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Hide text in header */
    .auth-container .text-dndk,
    .auth-container .text-tk,
    .header-middle-right-item span {
        display: none;
    }
    
    /* Center logo */
    .header-logo {
        margin: 0 auto;
        text-align: center;
    }
    
    .header-logo-img {
        max-width: 120px;
    }
    
    /* Header container layout */
    .header-middle .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        position: relative;
    }
    
    .header-middle-left {
        flex: 1;
        order: 2;
        display: flex;
        justify-content: center;
    }
    
    .header-middle-right {
        order: 3;
    }
    
    /* Mobile menu toggle on small screens */
    .mobile-menu-toggle {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* Banner improvements */
    .slide-banner {
        margin: 0;
        width: 100%;
    }
    
    .slide-banner__item {
        background-size: cover !important;
        background-position: center !important;
        background-repeat: no-repeat !important;
        height: 200px !important;
        position: relative;
    }
    
    /* Dark overlay for better text visibility */
    .slide-banner__item:after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
        z-index: 1;
    }
    
    .slide-banner__content {
        position: absolute;
        z-index: 2;
        color: #fff;
        text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
        width: 100%;
        padding: 0 20px;
        text-align: center;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
    }
    
    .slide-banner__title {
        font-size: 2rem !important;
        margin-bottom: 10px;
        font-weight: bold;
    }
    
    .slide-banner__button {
        display: inline-block;
        padding: 8px 20px;
        background-color: #B5292F;
        color: #fff;
        border-radius: 25px;
        text-decoration: none;
        margin-top: 15px;
        font-weight: bold;
        transition: background-color 0.2s;
        border: 2px solid white;
    }
    
    /* Product display as slider with proper width */
    .home-products {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        padding-bottom: 20px;
        margin: 0;
        position: relative;
        width: 100%;
        box-sizing: border-box;
        gap: 10px;
        padding: 0 5px;
    }
    
    /* Ensure col-product sizes are correct */
    .col-product {
        flex: 0 0 calc(50% - 5px);
        scroll-snap-align: start;
        min-width: calc(50% - 5px);
        box-sizing: border-box;
        max-width: calc(50% - 5px);
        margin-bottom: 10px;
    }
    
    /* Hide scrollbar but keep functionality */
    .home-products::-webkit-scrollbar {
        display: none;
    }
    
    .home-products {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    /* Mobile-specific product card improvements */
    .card-product {
        margin: 0 0 15px 0;
        border-radius: 10px;
        box-shadow: 0 3px 10px rgba(0,0,0,0.1);
        border: none;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background-color: white;
        transition: transform 0.2s, box-shadow 0.2s;
        touch-action: manipulation;
    }
    
    .card-product:active {
        transform: scale(0.98);
    }
    
    .card-header {
        width: 100%;
        padding: 0;
        margin: 0;
        border-radius: 10px 10px 0 0;
        overflow: hidden;
        position: relative;
    }
    
    .card-image-link {
        display: block;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .card-product .card-image {
        width: 100%;
        height: auto;
        border-radius: 10px 10px 0 0;
        aspect-ratio: 2/3;
        object-fit: cover;
        object-position: center;
        transition: transform 0.3s ease;
        display: block;
    }
    
    .card-product:hover .card-image {
        transform: scale(1.05);
    }
    
    .book-info {
        padding: 10px 12px;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        justify-content: space-between;
    }
    
    .card-title {
        margin-bottom: 10px;
        height: 40px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .card-title-link {
        font-size: 15px;
        font-weight: 500;
        color: #333;
        text-decoration: none;
        line-height: 1.4;
    }
    
    .product-price {
        font-weight: 700;
        color: #B5292F;
        margin-bottom: 8px;
    }
    
    .current-price {
        font-size: 16px;
        font-weight: 700;
        color: #B5292F;
    }
    
    .card-button {
        width: 100%;
        border-radius: 5px;
        margin-top: 5px;
        padding: 8px 0;
        font-weight: 500;
        text-transform: uppercase;
        font-size: 13px;
        background-color: #B5292F;
        color: white;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 34px;
    }
    
    .card-button i {
        margin-right: 5px;
    }
    
    /* Service section */
    .home-service {
        flex-direction: column;
        margin: 0;
        padding: 10px 0;
    }
    
    .home-service-item {
        width: 100%;
        margin-bottom: 15px;
        padding: 10px 5px;
        display: flex;
        align-items: center;
    }
    
    .home-service-item-icon {
        font-size: 24px;
        margin-right: 10px;
    }
    
    /* Home title spacing */
    .home-title-block {
        padding: 10px 0;
        margin: 10px 0;
    }
    
    .home-title {
        font-size: 1.5rem;
        margin: 0;
        padding: 0 10px;
        text-align: center;
    }
    
    /* Fix footer styling */
    .footer, 
    .footer .container,
    .widget-area,
    .widget-area .container,
    .copyright-wrap,
    .copyright-wrap .container {
        width: 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
        box-sizing: border-box;
        margin: 0;
    }
    
    /* Widget area fixes */
    .widget-area {
        padding: 30px 10px 10px;
    }
    
    .footer-top-content {
        flex-direction: column;
        align-items: center;
    }
    
    .footer-top-img {
        margin-bottom: 15px;
    }
    
    .footer-top-subbox {
        width: 100%;
    }
    
    /* Email subscription form fixes */
    .form-ground {
        display: flex;
        max-width: 100%;
        margin: 10px 0;
    }
    
    .form-ground-input {
        width: 65%;
        border-radius: 4px 0 0 4px;
        height: 40px;
        box-sizing: border-box;
        border: 1px solid #ddd;
        outline: none;
        padding: 0 10px;
    }
    
    .form-ground-btn {
        width: 35%;
        height: 40px;
        border-radius: 0 4px 4px 0;
        box-sizing: border-box;
        background-color: #B5292F;
        color: white;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
    }
    
    .form-ground-btn span {
        margin-right: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .widget-row {
        flex-direction: column;
    }
    
    .widget-row-col,
    .widget-row-col-1 {
        width: 100%;
        padding: 0;
        margin-bottom: 25px;
    }
    
    .widget-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .widget-contact-item {
        margin-bottom: 8px;
    }
    
    .widget-contact-item a {
        font-size: 14px;
    }
    
    .widget-social {
        display: flex;
        justify-content: flex-start;
        margin-top: 15px;
    }
    
    .widget-social-item {
        margin-right: 15px;
    }
    
    /* Copyright section */
    .copyright-wrap {
        padding: 15px 0;
    }
    
    .copyright-content {
        font-size: 12px;
        text-align: center;
    }
    
    /* Contact section fixes */
    .contact {
        width: 100%;
        max-width: 100%;
    }
    
    .contact-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 15px;
    }
    
    .contact-item-icon {
        min-width: 20px;
        margin-right: 10px;
    }
    
    .contact-content {
        word-break: break-word;
        font-size: 14px;
    }
    
    /* Fix back to top button position */
    .back-to-top {
        right: 10px;
        bottom: 10px;
    }
}

/* Ensure mobile search functionality works properly */
.header-middle-right-item.dnone.open {
    display: block;
}

.header-middle-right-item.close {
    display: none;
}

/* Mobile search overlay */
.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.98);
    z-index: 1002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mobile-search-overlay.active {
    display: flex;
}

.mobile-search-overlay .form-search {
    width: 100%;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 5px;
}

.mobile-search-overlay .form-search-input {
    height: 50px;
    padding-right: 40px;
}

.mobile-search-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
}

@media (max-width: 767.98px) {
    .header-middle-right-item.dnone.open {
        display: inline-block;
    }
    
    .header-middle-right-item.close.active {
        display: inline-block;
    }
}

/* Mobile menu panel */
.mobile-menu-toggle {
    display: none;
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin-right: 10px;
}

@media (max-width: 767.98px) {
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-menu-toggle .cart-icon-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
    }
    .cart-container {
        max-width: 300px;
    }
    .page-nav {
        margin-top: 0px;
        margin-bottom: 10px;
    }
}

.mobile-menu-panel {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: #fff;
    z-index: 1001;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    overflow-y: auto;
    padding-top: 10px;
}

.mobile-menu-panel.active {
    left: 0;
}

.mobile-menu-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #B5292F;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.mobile-menu-item {
    border-bottom: 1px solid #f5f5f5;
}

.mobile-menu-link {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
    background-color: #f5f5f5;
    color: #B5292F;
}

/* Overlay when mobile menu is active */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Make product cards more touch-friendly */
@media (max-width: 575.98px) {
    .card-product:active {
        transform: scale(0.98);
    }
}

/* Tablet product card styling - transitional styling */
@media (min-width: 576px) and (max-width: 991.98px) {
    .card-product {
        border-radius: 4px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
        margin: 0 auto 15px;
        height: 100%;
    }
    
    .card-product .card-image {
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: 220px;
        object-fit: contain;
        margin: 0 auto;
        display: block;
    }
    
    .card-header {
        text-align: center;
        padding: 10px 10px 0;
    }
} 