/* [AG-ADDED] Phase 1 Custom CSS */

/* Fix Social Icons (TikTok vs FontAwesome) */
.social-icon-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

/* Mobile Responsiveness Fixes */
@media (max-width: 767px) {

    /* [AG-MOBILE-FIX] Adjust hero slider social icons on mobile */
    .hero-slide-social-media {
        display: flex;
        justify-content: center;
        width: 100%;
        bottom: 10px;
        right: 0;
    }

    .hero-slide-social-media a {
        margin: 0 10px;
        font-size: 20px;
        line-height: normal;
    }

    /* [AG-MOBILE-FIX] Adjust category filter grid layout */
    .product-category-item {
        padding: 15px 10px;
    }

    .product-category-item .icon {
        width: 50px;
        height: 50px;
        margin-bottom: 10px;
    }

    .product-category-item .title {
        font-size: 14px;
    }

    /* [AG-MOBILE-FIX] Restrict logo size on mobile */
    .logo-main {
        max-width: 120px !important;
        height: auto !important;
    }

    /* [AG-MOBILE-FIX] Reduce footer block spacing */
    .widget-item {
        margin-bottom: 20px;
    }

    /* [AG-MOBILE-FIX] Forms & Inputs */
    .form-control,
    .form-select {
        font-size: 14px !important;
        padding: 10px 15px !important;
        height: auto !important;
    }

    .btn {
        font-size: 14px !important;
        padding: 10px 20px !important;
    }
}

/* Utility classes for JS logic */
.ag-hidden {
    display: none !important;
}

/* [AG-FIX] Toast Notifications */
.ag-toast-container {
    position: fixed;
    z-index: 9999;
    top: 20px;
    right: 20px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ag-toast {
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease-in-out;
    pointer-events: auto;

    /* [AG-UI-FIX] Prevent text overflow and ensure flex icon layout */
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ag-toast i {
    font-size: 16px;
}

.ag-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ag-toast.success {
    background: #4caf50;
}

.ag-toast.error {
    background: #f44336;
}

/* [AG-UI-FIX] Custom Wishlist Toast Theme */
.ag-toast.wishlist {
    background: #e91e63;
}

/* Mobile Toast adjustments */
@media (max-width: 767px) {
    .ag-toast-container {
        right: 50%;
        transform: translateX(50%);
        width: 90%;
        max-width: 320px;
        align-items: center;
    }

    .ag-toast {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* [AG-UI-FIX] Equal Height Product Cards */
.product-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-item .product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Push the pricing and action bounds to the bottom so cards align */
.product-item .product-info .prices {
    margin-top: auto;
}

/* Line clamp product titles so they don't break flex layouts */
.product-name .title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
    /* [AG-FIX] Standard property definition fallback */
}

/* [AG-FIX] Refined Cart Quantity Controls */
.ag-qty-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    color: #333;
    font-size: 16px;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ag-qty-btn:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.ag-qty-btn:active {
    background-color: #dde0e3;
}

/* [AG-FIX] Cart Table Layout Stability */
.shopping-cart-table table {
    table-layout: fixed;
    width: 100%;
}

.shopping-cart-table th.product-price,
.shopping-cart-table td.product-price {
    width: 15%;
}

.shopping-cart-table th.product-quantity,
.shopping-cart-table td.product-quantity {
    width: 20%;
}

.shopping-cart-table th.product-subtotal,
.shopping-cart-table td.product-subtotal {
    width: 15%;
}

/* On very small mobile layouts, allow controlled scroll if the fixed widths crunch everything */
@media (max-width: 575px) {
    .shopping-cart-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .shopping-cart-table table {
        min-width: 500px;
        /* Forces scrolling rather than crushing columns */
    }
}

/* [AG-FIX] Product Action Misalignment Fix */
/* Product Actions hover inside the thumb wrapper. Need to anchor it properly. */
.product-item .product-thumb {
    position: relative;
    overflow: hidden;
}

.product-item .product-action {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    /* Override any erratic margins */
    opacity: 0;
    transition: all 0.3s;
}

.product-item:hover .product-action {
    opacity: 1;
}

/* [AG-MOBILE-FIX] Hide redundant overlay actions entirely on Mobile */
@media (max-width: 767px) {
    .product-item .product-action {
        display: none !important;
    }
}

/* [AG-MOBILE-FIX] Quick View Responsive Layout Constraints */
@media (max-width: 767px) {
    #action-QuickViewModal .modal-content {
        max-height: 90vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    #action-QuickViewModal .modal-body {
        overflow-y: auto;
        padding-bottom: 70px;
        /* Space for the sticky action bar */
    }

    #action-QuickViewModal .product-single-thumb img {
        max-height: 30vh;
        width: auto;
        object-fit: contain;
        margin: 0 auto;
        display: block;
    }

    /* Make the action area sticky at the bottom for easy tapping */
    #action-QuickViewModal .product-details-action {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 15px;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 10;
        margin: 0;
    }

    #action-QuickViewModal .product-details-action .price {
        margin: 0;
        font-size: 18px;
    }
}