/* Products & Cart Styling */

/* Browse Products Page */
.browse-products-page {
    min-height: 70vh;
}

.page-banner {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
}

.page-banner h1 {
    font-size: 42px;
    margin-bottom: 10px;
}

.page-banner p {
    font-size: 18px;
    opacity: 0.9;
}

.browse-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

/* Hide mobile filter toggle on desktop */
.mobile-filter-toggle {
    display: none;
}

/* Sidebar Filters */
.browse-sidebar {}

.filter-section {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin: 8px 0;
}

.category-list a {
    color: #666;
    text-decoration: none;
    padding: 8px 12px;
    display: block;
    border-radius: 4px;
    transition: all 0.3s;
}

.category-list a:hover,
.category-list a.active {
    background: #8B4513;
    color: white;
}

.sort-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Products Grid */
.products-grid-container {}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.products-header h2 {
    color: #333;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 300px;
}

.search-form button {
    padding: 10px 20px;
    background: #8B4513;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}

.product-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.product-image {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.sale-badge,
.featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
}

.sale-badge {
    background: #e74c3c;
    color: white;
}

.featured-badge {
    background: #f39c12;
    color: white;
    top: 45px;
}

.product-info {
    padding: 20px;
}

.product-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.product-info h3 a {
    color: #333;
    text-decoration: none;
}

.product-info h3 a:hover {
    color: #8B4513;
}

.product-category {
    color: #999;
    font-size: 13px;
    margin-bottom: 10px;
}

.product-price {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
}

.current-price {
    font-size: 20px;
    font-weight: 600;
    color: #8B4513;
}

.btn-add-to-cart,
.btn-out-of-stock {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add-to-cart {
    background: #8B4513;
    color: white;
}

.btn-add-to-cart:hover {
    background: #704010;
}

.btn-out-of-stock {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* Product Detail Page */
.product-detail-page {
    padding: 40px 20px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.product-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    width: 100%;
    box-sizing: border-box;
}

.product-gallery {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.main-image {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    width: 100%;
}

.main-image img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.thumbnail-images {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.thumbnail-images img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.3s;
    flex-shrink: 0;
}

.thumbnail-images img:hover {
    border-color: #8B4513;
}

.product-details {}

.breadcrumb {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #8B4513;
    text-decoration: none;
}

.product-details h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.product-price-section {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.discount-badge {
    background: #e74c3c;
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.product-stock {
    margin: 15px 0;
}

.in-stock {
    color: #27ae60;
    font-weight: 600;
}

.out-of-stock {
    color: #e74c3c;
    font-weight: 600;
}

.product-short-desc {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.add-to-cart-form {
    margin: 30px 0;
}

.quantity-selector {
    margin-bottom: 20px;
}

.quantity-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

.quantity-controls button {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 18px;
}

.quantity-controls input {
    width: 80px;
    text-align: center;
    border: 1px solid #ddd;
    padding: 10px;
}

.btn-add-to-cart-large {
    width: 100%;
    padding: 18px;
    background: #8B4513;
    color: white;
    border: 2px solid #8B4513;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-to-cart-large:hover:not(:disabled) {
    background: #704010;
    border-color: #704010;
}

.btn-add-to-cart-large:disabled {
    cursor: not-allowed;
    opacity: 0.9;
}

.btn-add-to-cart-large i {
    font-size: 16px;
}

.product-specifications {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.product-specifications h3 {
    margin-bottom: 15px;
}

.product-description-section,
.related-products-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.description-content {
    line-height: 1.8;
    color: #666;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Related product card image (direct <a><img> structure) */
.related-products-grid .product-card a {
    display: block;
    overflow: hidden;
}

.related-products-grid .product-card a img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.related-products-grid .product-card:hover a img {
    transform: scale(1.06);
}

.related-products-grid .product-card h3 {
    font-size: 14px;
    padding: 10px 12px 6px;
    margin: 0;
    line-height: 1.4;
}

.related-products-grid .product-card h3 a {
    text-decoration: none;
    color: inherit;
}

.related-products-grid .product-card .price {
    padding: 0 12px 12px;
    margin: 0;
    color: #8B4513;
    font-weight: 600;
    font-size: 15px;
}

/* Pagination Styling - Bootstrap 4 compatible */
.pagination-wrapper {
    margin-top: 50px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination .page-item {
    margin: 0 2px;
}

.pagination .page-link {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
}

.pagination .page-link:hover {
    background-color: #8B4513;
    color: #fff;
    border-color: #8B4513;
}

.pagination .page-item.active .page-link {
    background-color: #8B4513;
    color: #fff;
    border-color: #8B4513;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Fix for arrow size */
.pagination .page-link svg {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
}

.pagination .page-link i {
    font-size: 14px;
    max-width: 16px;
    max-height: 16px;
}

.pagination .page-link span {
    font-size: 14px;
}

@media (max-width: 768px) {
    /* Page Banner */
    .page-banner {
        padding: 35px 15px;
    }

    .page-banner h1 {
        font-size: 26px;
    }

    .page-banner p {
        font-size: 14px;
    }

    /* Browse layout: stack sidebar above products */
    .browse-container {
        grid-template-columns: 1fr !important;
        padding: 15px !important;
        gap: 12px !important;
    }

    /* Mobile filter toggle button */
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 10px 16px;
        background: #8B4513;
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        justify-content: center;
    }

    /* Sidebar: hidden by default on mobile, shown when .open */
    .browse-sidebar {
        display: none;
        flex-direction: column;
        gap: 12px;
        background: #f8f8f8;
        border-radius: 8px;
        padding: 15px;
    }

    .browse-sidebar.open {
        display: flex;
    }

    .filter-section {
        margin-bottom: 0;
        padding: 12px;
        background: white;
        border-radius: 6px;
    }

    .filter-section h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .category-list li {
        margin: 0;
    }

    .category-list a {
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 20px;
        border: 1px solid #ddd;
        display: inline-block;
    }

    .sort-select {
        font-size: 13px;
        padding: 8px;
        width: 100%;
    }

    /* Products header */
    .products-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 15px;
    }

    .products-header h2 {
        font-size: 15px;
    }

    .search-form {
        width: 100%;
        display: flex;
    }

    .search-form input {
        width: 100%;
        flex: 1;
        font-size: 14px;
    }

    .search-form button {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Products grid: 1 column on mobile */
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        margin-bottom: 20px;
    }

    /* Product card: vertical layout (image top, info bottom) */
    .product-card {
        display: block !important;
        flex-direction: unset !important;
    }

    .product-image {
        width: 100% !important;
        height: 220px !important;
        aspect-ratio: unset !important;
        border-radius: 8px 8px 0 0 !important;
        min-width: unset !important;
    }

    .product-info {
        padding: 12px;
    }

    .product-info h3 {
        font-size: 15px;
        line-height: 1.3;
        margin-bottom: 4px;
    }

    .product-category {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .product-price {
        margin: 8px 0;
        gap: 6px;
    }

    .current-price {
        font-size: 16px;
    }

    .old-price {
        font-size: 13px;
    }

    .btn-add-to-cart,
    .btn-out-of-stock {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Product detail */
    .product-container {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .product-detail-page {
        padding: 15px 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .product-details {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .product-gallery {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .main-image {
        width: 100%;
        overflow: hidden;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    .main-image img {
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
        object-fit: cover;
    }

    .thumbnail-images {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        padding-bottom: 8px;
        box-sizing: border-box;
        scrollbar-width: thin;
        scrollbar-color: #8B4513 #eee;
    }

    .thumbnail-images::-webkit-scrollbar {
        height: 4px;
    }

    .thumbnail-images::-webkit-scrollbar-track {
        background: #eee;
        border-radius: 10px;
    }

    .thumbnail-images::-webkit-scrollbar-thumb {
        background: #8B4513;
        border-radius: 10px;
    }

    .thumbnail-images img {
        width: 72px;
        height: 72px;
        min-width: 72px;
        max-width: 72px;
        flex-shrink: 0;
        object-fit: cover;
    }

    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .related-products-grid .product-card a img {
        height: 130px;
    }

    .related-products-grid .product-card h3 {
        font-size: 12px;
        padding: 8px 8px 4px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .related-products-grid .product-card .price {
        font-size: 13px;
        padding: 0 8px 8px;
    }

    /* Product detail - overflow fixes */
    .product-description-section,
    .related-products-section {
        width: 100%;
        max-width: 100vw;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .description-content {
        word-break: break-word;
        overflow-wrap: break-word;
        width: 100%;
        box-sizing: border-box;
    }

    .breadcrumb {
        word-break: break-word;
        white-space: normal;
        overflow-wrap: break-word;
        font-size: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .product-details h1 {
        font-size: 22px;
        word-break: break-word;
        overflow-wrap: break-word;
        width: 100%;
    }

    .product-price-section {
        flex-wrap: wrap;
        gap: 8px;
    }

    .product-short-desc {
        word-break: break-word;
        overflow-wrap: break-word;
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
    }

    .product-specifications p {
        word-break: break-word;
        overflow-wrap: break-word;
        width: 100%;
        box-sizing: border-box;
    }

    /* Pagination */
    .pagination-wrapper {
        margin-top: 25px;
    }

    .pagination {
        gap: 4px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-link {
        min-width: 34px;
        height: 34px;
        padding: 5px 9px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .page-banner h1 {
        font-size: 20px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .product-info {
        padding: 10px;
    }

    .product-info h3 {
        font-size: 14px;
    }

    .current-price {
        font-size: 15px;
    }

    .product-details h1 {
        font-size: 22px;
    }

    .btn-add-to-cart-large {
        font-size: 15px;
        padding: 14px;
    }

    .pagination .page-link {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 5px 8px;
    }
}
