/**
 * Shop Page Styles
 * 
 * Author: GoneClear Development Team
 * Description: Comprehensive styling for the e-commerce shop page including
 *              product grids, cart sidebar, filters, and responsive design
 * Features: Grid/List view toggle, sliding cart, price filters, mobile responsive
 * Last Updated: October 2025
 * 
 * NOTE: Detail page styles have been moved to detail.css
 */

/* ========================================
   FONT IMPORTS & BASE STYLES
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

body {
    margin: 0;
    font-family: 'Open Sans', sans-serif;
}

/* ========================================
   SHOP PAGE LAYOUT
   ======================================== */

.shop-main {
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.shop-header {
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.title-view-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.container {
    width: 900px;
    max-width: 90vw;
    margin: auto;
    text-align: center;
    padding-top: 10px;
    transition: transform 0.5s;
}  

/* ========================================
   GLOBAL ELEMENT STYLES
   ======================================== */

a{
    text-decoration: none;
    color: black;
}

button{
    cursor: pointer;
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.title {
    font-size: 2rem;
    font-weight: bold;
    color: #122b46;
    margin: 0;
} 

/* ========================================
   VIEW TOGGLE CONTROLS
   ======================================== */

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn i {
    font-size: 1.5rem;
    color: #555;
}

.view-btn:hover {
    background: rgba(95, 121, 160, 0.1);
}

.view-btn.active {
    background: rgb(95, 121, 160);
    border-color: rgb(95, 121, 160);
}

.view-btn.active i {
    color: white;
}

/* ========================================
   SHOPPING CART SIDEBAR
   ======================================== */

.cartBar {
    background-color: #19427f;
    color: white;
    width: 400px;
    max-width: 100%;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-rows: 70px 1fr 70px;
    filter: drop-shadow(0 3px 10px rgba(35, 34, 34, 0.437));
}

.cartBar h1 {
    padding: 20px;
    margin: 0;
    font-weight: 300;
}

.cartBar .btn {
    padding: 0.75rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.cartBar .btn button {
    background-color: rgb(87, 145, 232);
    border: none;
    font-family: 'Open Sans';
    font-weight: 500;
    color: white;
}

.cartBar .btn button:hover{
    background-color: rgba(38, 86, 159, 0.8); 
}

.cartBar .btn button.close {
    color: black;
    background-color: rgba(242, 236, 236, 0.941);
}

.cartBar .btn button.close:hover{
    background-color: rgba(214, 216, 235, 0.941);
}

.cartBar .listCart {
    overflow: auto;
}

.cartBar .listCart::-webkit-scrollbar{
    width: 0;
}

.cartBar{
    right: -400px;
    transition: 0.5s;
}

body.activeBarcart .cartBar{
    right: 0;
}

body.activeBarcart .container,
body.activeBarcart .filter-panel {
    transform: translateX(-250px);
}

/* ========================================
   MAIN SHOP CONTAINER
   ======================================== */

.shop-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ========================================
   IMAGE LOADING & ERROR STATES
   ======================================== */

.image-container {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #666;
    font-size: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 14px;
    background-color: #f0f0f0;
    border: 2px dashed #ddd;
}


/* Loading indicator for infinite scroll */
.loading-more {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.scroll-sentinel {
    height: 20px;
    visibility: hidden;
}

/* Skeleton loading for images */
.image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}


.product-image.loaded {
    opacity: 1;
}

.loading-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   IMAGE LINK STYLES
   ======================================== */

.image-link {
    display: block;
    width: 100%;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.image-link:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.image-link .image-container {
    width: 100%;
}

.list-item-image .image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.listProduct .item h2 {
    cursor: pointer;
    transition: color 0.2s ease;
}

.listProduct .item h2:hover {
    color: #122b46;
}

.cart-item .product-image,
.listCart .item img {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.cart-item .product-image:hover,
.listCart .item img:hover {
    opacity: 0.8;
}

.cart-item .item-name,
.listCart .item .name {
    cursor: pointer;
    transition: color 0.2s ease;
}

.cart-item .item-name:hover,
.listCart .item .name:hover {
    color: #122b46;
    text-decoration: underline;
}

/* ========================================
   PRODUCT GRID LAYOUT
   ======================================== */

.listProduct {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 0;
    margin: 0;
}

.listProduct .item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    text-align: center;
    border-width: 2px;
    border-style: groove;
    border-color: #36333316;
}

.listProduct .item:hover {
     transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.listProduct .item img{
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 1rem;
    background-color: #fff;
    transition: transform 0.2s ease;
}

.listProduct .item h2 {
    font-weight: 500;
    font-size: 1.1rem;
    margin: 0.5rem 0;
    color: #333;
}

.listProduct .item .price {
    letter-spacing: 2px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #122b46;
    margin: 0.5rem 0;
}

.listProduct .item button {
    background-color: #122b46;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    width: 100%;
    border: none;
    margin-top: 10px;
}

.listProduct .item button:hover {
    background: #0f1f35;
}

/* ========================================
   LIST VIEW STYLING
   ======================================== */

.listProduct.list-view-active {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.listProduct.list-view-active .item {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    text-align: left;
}

.list-item-content {
    display: grid;
    grid-template-columns: 150px 1fr 120px;
    gap: 20px;
    align-items: center;
}

.list-item-image img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.list-item-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.list-item-details h2 {
    margin: 0;
    font-size: 18px;
}

.list-item-description {
    color: #666;
    font-size: 14px;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-item-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.list-item-action .addCart {
    width: auto;
    padding: 0.5rem 1rem;
}

/* ========================================
   CART ITEM STYLING
   ======================================== */

.listCart .item img {
    width: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.listCart .item {
    display: grid;
    grid-template-columns: 70px 1fr 80px 100px;
    gap: 10px;
    text-align: left;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(198, 190, 190, 0.3);
}

.price-delete-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-icon {
    color: #777;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s ease;
}

.delete-icon:hover {
    color: #e74c3c;
}

.listCart .item .product-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.listCart .item .name {
    font-weight: 500;
    margin-bottom: 4px;
}

.listCart .item .original-price {
    font-size: 0.9em;
    color: #dad5d5;
}

.listCart .item .totalPrice {
    font-weight: 600;
    color: #dfdddd;
}

/* ========================================
   QUANTITY CONTROLS
   ======================================== */

.listCart .item .quantity{
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 2px 5px;
    width: 90px;
}

.listCart .item .quantity span {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   width: 24px;
   height: 24px;
   background-color: transparent;
   color: #333;
   cursor: pointer;
   padding: 0 5px;
   user-select: none;
   font-weight: bold;
}

.listCart .item .quantity span:nth-child(2){
    background-color: transparent;
    color: white;
}

.listCart .item .quantity span.minus,
.listCart .item .quantity span.plus {
    font-weight: bold;
}

.listCart .item .quantity span.minus:hover,
.listCart .item .quantity span.plus:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

.listCart .item .quantity input {
    border: none;
    background: transparent;
    outline: none;
    width: 40px;
    text-align: center;
}

.quantity input::-webkit-outer-spin-button,
.quantity input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.listCart .item:nth-child(even){
    background-color: rgba(198, 190, 190, 0.08);
}

/* ========================================
   FILTER PANEL
   ======================================== */

.shop-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    position: relative;
    width: 100%;
}

.filter-panel {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 280px;
    margin: 0;
    padding: 20px;
    padding-top: 50px;
    border-radius: 0 10px 10px 0;
    z-index: 1001;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    background-color: #ffffff;
}

.filter-panel.active {
    left: 0;
}

.filter-tab {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: #667acb;
    color: white;
    padding: 10px 15px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.674);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 100px;
}

.filter-tab span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    z-index: 1002;
}

.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.filter-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section h3 {
    margin-bottom: 15px;
    color: #122b46;
    font-size: 18px;
}

.price-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.price-inputs input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

#applyFilter, #resetFilter {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

#applyFilter {
    background-color: #122b46;
    color: white;
}

#resetFilter {
    background-color: #6c757d;
    color: white;
}

#applyFilter:hover {
    background-color: #0f1f35;
}

#resetFilter:hover {
    background-color: #5a6268;
}

.price-ranges {
    margin-top: 20px;
}

.price-ranges h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.range-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.range-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.listProduct {
    flex: 1;
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

/* ========================================
   NOTIFICATIONS & CONFIRMATIONS
   ======================================== */

.add-confirmation {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgb(95, 121, 160);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-family: 'Open Sans', sans-serif;
    animation: slideIn 0.3s ease-out;
    transition: opacity 0.3s;
}

.add-confirmation.fadeOut {
    opacity: 0;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   LIST VIEW SPECIFIC STYLING
   ======================================== */

.list-item-image .image-container {
    width: 150px;
    height: 150px;
    margin-bottom: 0;
}

.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 12px;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
}

.image-error::before {
    content: "📷";
    font-size: 2em;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* ========================================
   RESPONSIVE DESIGN - TABLET & DESKTOP
   ======================================== */

@media screen and (max-width: 992px){
    .listProduct{
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
   ======================================== */

@media screen and (max-width: 768px){
    .shop-header {
        padding: 1rem;
    }
    
    .title-view-container {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .shop-container {
        padding: 0 1rem;
    }
    
    .listProduct{
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .filter-panel {
        width: 100vw;
        right: -100vw;
        left: auto;
    }
    
    .list-item-content {
        flex-direction: column;
        text-align: center;
        grid-template-columns: 1fr;
    }
    
    .list-item-image {
        display: flex;
        justify-content: center;
    }
    
    .list-item-details {
        text-align: center;
    }
    
    .list-item-action {
        align-items: center;
    }
    
    .list-item-image img {
        width: 150px;
        height: 150px;
    }
    
    .image-container {
        height: 150px;
    }
    
    .list-item-image .image-container {
        width: 100px;
        height: 100px;
    }
}