/**
 * CG Smart Cart Upsells - Frontend Styles
 * Clean, premium styling matching Chronic Guru branding
 */

/* Container */
.cg-scu-container {
    margin: 30px 0;
    padding: 25px;
    background: #fafafa;
    border-radius: 8px;
}

/* Title */
.cg-scu-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 20px 0;
    padding: 0;
    text-transform: none;
    letter-spacing: -0.02em;
}

/* Wrapper for carousel navigation */
.cg-scu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Products container */
.cg-scu-products {
    display: flex;
    gap: 15px;
    flex: 1;
    overflow: hidden;
}

/* Carousel layout */
.cg-scu-carousel {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Grid layout */
.cg-scu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    overflow: visible;
}

/* Navigation buttons */
.cg-scu-nav {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #1a1a1a;
}

.cg-scu-nav:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.cg-scu-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.cg-scu-nav svg {
    width: 16px;
    height: 16px;
}

/* Product tile */
.cg-scu-product {
    flex: 0 0 calc(25% - 12px);
    min-width: 180px;
    max-width: 240px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.cg-scu-product:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Product link wrapper */
.cg-scu-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.cg-scu-product-link:hover {
    text-decoration: none;
    color: inherit;
}

/* Product image */
.cg-scu-product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f5f5f5;
    overflow: hidden;
}

.cg-scu-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cg-scu-product:hover .cg-scu-product-image img {
    transform: scale(1.05);
}

/* Sale badge */
.cg-scu-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 3px;
}

.cg-scu-badge-sale {
    background: #1a1a1a;
    color: #fff;
}

/* Discount badge - special upsell pricing */
.cg-scu-badge-discount {
    background: linear-gradient(135deg, #c62828, #e53935);
    color: #fff;
}

/* Discounted product - subtle highlight only */
.cg-scu-has-discount {
    position: relative;
}

/* Product info */
.cg-scu-product-info {
    padding: 12px;
}

/* Product name */
.cg-scu-product-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product attributes */
.cg-scu-product-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.cg-scu-attr {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 500;
    background: #f0f0f0;
    color: #666;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cg-scu-attr-potency {
    background: #e8f5e9;
    color: #2e7d32;
}

.cg-scu-attr-cannabinoid {
    background: #e3f2fd;
    color: #1565c0;
}

/* Weight attribute - important for price justification */
.cg-scu-attr-weight {
    background: #fff3e0;
    color: #e65100;
    font-weight: 600;
}

/* Product price */
.cg-scu-product-price {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.cg-scu-product-price del {
    color: #999;
    font-weight: 400;
    font-size: 0.85em;
    margin-right: 6px;
}

.cg-scu-product-price ins {
    text-decoration: none;
    color: #c62828;
}

/* Microline */
.cg-scu-microline {
    font-size: 0.75rem;
    color: #666;
    margin: 0;
    font-style: italic;
}

/* Product actions */
.cg-scu-product-actions {
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
}

/* Add to cart button */
.cg-scu-add-to-cart {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cg-scu-add-to-cart:hover {
    background: #333;
}

.cg-scu-add-to-cart:active {
    transform: scale(0.98);
}

.cg-scu-add-to-cart.loading {
    opacity: 0.7;
    cursor: wait;
}

.cg-scu-add-to-cart.added {
    background: #2e7d32;
}

/* View options button */
.cg-scu-view-options {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cg-scu-view-options:hover {
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
}

/* Remove link */
.cg-scu-remove-link {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    text-decoration: none;
    padding: 4px 0;
}

.cg-scu-remove-link:hover {
    color: #c62828;
    text-decoration: underline;
}

/* Toast notification */
.cg-scu-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 9999;
    animation: cg-scu-toast-in 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cg-scu-toast.hiding {
    animation: cg-scu-toast-out 0.3s ease forwards;
}

@keyframes cg-scu-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cg-scu-toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Debug info */
.cg-scu-debug {
    padding: 8px 12px;
    background: #fff3cd;
    border-top: 1px solid #ffc107;
    font-size: 0.7rem;
    color: #856404;
}

/* Responsive: Tablet */
@media (max-width: 991px) {
    .cg-scu-product {
        flex: 0 0 calc(33.333% - 10px);
        min-width: 160px;
    }
    
    .cg-scu-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive: Mobile */
@media (max-width: 767px) {
    .cg-scu-container {
        padding: 20px 15px;
        margin: 20px 0;
    }
    
    .cg-scu-title {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .cg-scu-wrapper {
        flex-direction: column;
    }
    
    .cg-scu-nav {
        display: none;
    }
    
    .cg-scu-products {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    
    .cg-scu-product {
        flex: 0 0 calc(50% - 8px);
        min-width: 150px;
        max-width: none;
        scroll-snap-align: start;
    }
    
    .cg-scu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .cg-scu-product-info {
        padding: 10px;
    }
    
    .cg-scu-product-name {
        font-size: 0.85rem;
    }
    
    .cg-scu-product-price {
        font-size: 0.95rem;
    }
    
    .cg-scu-attr {
        font-size: 0.65rem;
        padding: 2px 4px;
    }
    
    .cg-scu-microline {
        font-size: 0.7rem;
    }
    
    .cg-scu-product-actions {
        padding: 0 10px 10px;
    }
    
    .cg-scu-add-to-cart,
    .cg-scu-view-options {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .cg-scu-toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* Responsive: Small mobile */
@media (max-width: 480px) {
    .cg-scu-product {
        flex: 0 0 calc(50% - 8px);
        min-width: 140px;
        max-width: none;
    }
    
    .cg-scu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .cg-scu-product-name {
        font-size: 0.8rem;
    }
    
    .cg-scu-attr {
        font-size: 0.6rem;
        padding: 2px 3px;
    }
}

/* Responsive: Very small screens only */
@media (max-width: 320px) {
    .cg-scu-product {
        flex: 0 0 calc(100% - 10px);
    }
    
    .cg-scu-grid {
        grid-template-columns: 1fr;
    }
}

/* Hide on empty */
.cg-scu-container:empty {
    display: none;
}

/* ==========================================
   PRODUCT PAGE DEAL BANNER
   ========================================== */

.cg-scu-deal-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff5f5, #fff0f0);
    border: 1px solid #ffcdd2;
    border-left: 4px solid #c62828;
    border-radius: 6px;
    margin-bottom: 15px;
}

.cg-scu-deal-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #c62828, #e53935);
    color: #fff;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cg-scu-deal-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
}

/* Discounted price styling on product page */
.cg-scu-deal-banner + .price del,
.single-product .cg-scu-deal-active del {
    color: #999;
    font-weight: 400;
}

.cg-scu-deal-banner + .price ins,
.single-product .cg-scu-deal-active ins {
    text-decoration: none;
    color: #c62828;
    font-weight: 700;
}

@media (max-width: 767px) {
    .cg-scu-deal-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }
    
    .cg-scu-deal-text {
        font-size: 0.85rem;
    }
}

/* Accessibility: Focus states */
.cg-scu-add-to-cart:focus,
.cg-scu-view-options:focus,
.cg-scu-nav:focus {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

.cg-scu-product-link:focus {
    outline: none;
}

.cg-scu-product-link:focus .cg-scu-product-image {
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.3);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cg-scu-product-image img,
    .cg-scu-add-to-cart,
    .cg-scu-nav,
    .cg-scu-toast {
        transition: none;
        animation: none;
    }
    
    .cg-scu-carousel {
        scroll-behavior: auto;
    }
}

/* ==========================================
   MINI CART / SLIDE-OUT CART STYLES
   ========================================== */

.cg-scu-mini-cart-container {
    padding: 15px 0 0;
    margin-top: 15px;
    border-top: 1px solid #eee;
}

.cg-scu-container.cg-scu-mini {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.cg-scu-mini .cg-scu-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
    padding: 0;
}

.cg-scu-mini-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Mini cart product tile - horizontal layout */
.cg-scu-mini-product {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    position: relative;
}

.cg-scu-mini-product.cg-scu-has-discount {
    background: #fff5f5;
}

.cg-scu-mini-product-image {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    position: relative;
    flex-shrink: 0;
}

.cg-scu-mini-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cg-scu-mini-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    padding: 2px 4px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #c62828;
    color: #fff;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 2;
}

.cg-scu-mini-product-info {
    min-width: 0;
    overflow: hidden;
}

.cg-scu-mini-product-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cg-scu-mini-product-price {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.cg-scu-mini-product-price del {
    color: #999;
    font-weight: 400;
    margin-right: 4px;
}

.cg-scu-mini-product-price ins {
    text-decoration: none;
    color: #c62828;
    font-weight: 600;
}

/* Mini cart add button */
.cg-scu-mini-add.cg-scu-add-to-cart {
    padding: 8px 16px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #1a1a1a !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.cg-scu-mini-add.cg-scu-add-to-cart:hover {
    background: #333 !important;
}

.cg-scu-mini-add.loading {
    opacity: 0.7;
    cursor: wait;
}

.cg-scu-mini-add.added {
    background: #2e7d32 !important;
}

/* CommerceKit/Shoptimizer specific adjustments */
.commercekit-cart-content .cg-scu-mini-cart-container {
    padding: 15px 20px;
    margin: 0 -20px;
    background: #fafafa;
}

/* Ensure proper stacking in slide-out */
.cart-drawer .cg-scu-mini-cart-container,
.mini-cart-wrapper .cg-scu-mini-cart-container {
    position: relative;
    z-index: 1;
}
