@import "./style.css";

:root {
    --primary-color: var(--royal-violet);
    --secondary-color: var(--pearl-aqua);
    --accent-color: var(--turquoise);
    --text-color: #333;
    --heading-color: var(--indigo-bloom);
    --white-color: var(--white);
    --border-color: var(--muted);
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

body.shop-page {
    font-family: var(--font-family-body);
    background-color: var(--white-color);
    color: var(--text-color);
    line-height: 1.6;
}

.shop-container {
    max-width: 1100px;
    margin: 110px auto 40px;
    padding: 0 20px;
}

/* Spool Section */
.spool-section {
    display: flex;
    flex-direction: row;
    /* Desktop horizontal style */
    align-items: flex-start;
    text-align: left;
    gap: 60px;
    margin-bottom: 80px;
}

.product-image {
    flex: 1;
    max-width: 500px;
}

.product-image img {
    width: 100%;
    height: auto;
    border-radius: 20px;
    background-color: #f0f2f5;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.product-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 15px;
}

.product-description {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: var(--muted);
}

.product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Left align for desktop */
}

.title-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Left align for desktop */
    gap: 15px;
    width: 100%;
    margin-bottom: 5px;
}

.product-specs {
    display: flex;
    flex-wrap: wrap;
    /* Prevent horizontal push */
    gap: 15px 20px;
    margin-bottom: 25px;
    font-weight: 600;
    color: var(--muted);
}

.product-specs span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 30px;
}

/* Printed objects styling override (do not affect spool) */
.product-card.printed .card-image img {
    background: #ffffff;
    /* neutral white instead of celeste */
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.product-card.printed .card-content {
    background: transparent;
}

.product-card.printed .btn-primary {
    /* replace light cyan buttons with warmer/violet accent for printed objects */
    background: linear-gradient(90deg, var(--royal-violet), var(--indigo-bloom));
    color: var(--white-color);
    border: none;
}

.product-card.printed .btn-secondary {
    background: #f5f5f7;
    color: var(--muted);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Spool section: change the earlier 'celeste' outline to a cleaner framed look */
.spool-section .product-image img {
    background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(250, 250, 252, 1));
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.08), 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Aggiungi button - new nicer color combo following existing purple/indigo scheme */
.btn.add-to-cart,
.btn.add-to-cart:focus {
    outline: none;
}

.btn.add-to-cart,
.btn.btn-secondary.add-to-cart {
    background: linear-gradient(90deg, var(--slate-indigo), var(--royal-violet));
    color: #fff;
    border: none;
    box-shadow: 0 8px 20px rgba(115, 72, 229, 0.12);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.btn.btn-secondary.add-to-cart:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(115, 72, 229, 0.14);
}

.btn {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-primary:hover {
    background-color: var(--indigo-bloom);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--strong-cyan);
}


/* Divider */
.divider {
    text-align: center;
    margin: 60px 0 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
}

.divider h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--heading-color);
}

.divider p {
    color: var(--muted);
    max-width: 500px;
    margin: 0 auto;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--secondary-color);
}

.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.card-footer .btn {
    flex: 0 0 auto;
}

.card-footer .card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .card-footer .btn {
        width: 100%;
    }

    .card-footer .card-price {
        text-align: left;
        margin-bottom: 8px;
    }
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--heading-color);
}

.card-description {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 15px;
    flex-grow: 1;
}

.card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}


/* Side Cart */
.side-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.12);
    transform: translateX(110%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10005;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.side-cart.open {
    transform: translateX(0);
}

.side-cart-close {
    background: none;
    border: none;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.3s ease, transform 0.3s ease;
}

.side-cart-close:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.side-cart-items {
    padding: 25px;
    flex-grow: 1;
    overflow-y: auto;
}

.side-item {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.side-item {
    position: relative;
}

.side-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.18s ease, transform 0.12s ease;
}

.side-item-remove:hover {
    color: var(--primary-color);
    transform: rotate(20deg);
}

.side-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.side-item img {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    object-fit: cover;
}

.side-item-details strong {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--heading-color);
}

.side-item-details span {
    font-size: 0.9rem;
    color: var(--muted);
}

.side-item-price {
    font-weight: 700;
    color: var(--primary-color);
}

.side-cart-footer {
    padding: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.side-cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--heading-color);
}

.ecological-impact {
    font-size: 0.95rem;
    color: var(--muted-dark);
    margin-bottom: 25px;
    text-align: center;
    background: rgba(var(--pearl-aqua-rgb), 0.3);
    padding: 10px;
    border-radius: 8px;
}

.checkout-btn {
    width: 100%;
    font-size: 1.1rem;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(var(--royal-violet-rgb), 0.2);
}



/* Responsive */
@media (max-width: 900px) {
    .spool-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }

    .product-details {
        align-items: center;
    }

    .title-wrap {
        justify-content: center;
    }

    .product-image img {
        margin: 0 auto;
        max-width: 100%;
        /* Ensure image doesn't overflow */
    }

    .product-specs {
        justify-content: center;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .product-title {
        font-size: 2rem;
    }

    .side-cart {
        width: 100%;
    }

    .side-cart.open {
        transform: translateX(0);
    }
}

@media (max-width: 580px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .shop-container {
        padding: 0 15px;
        margin-top: 100px;
        overflow-x: hidden;
        /* Safety measure */
    }

    .product-title {
        font-size: 1.8rem;
    }

    .product-specs span {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .shop-container {
        padding: 0 10px;
    }

    .product-image img {
        padding: 10px;
    }

    .product-price {
        font-size: 1.6rem;
    }
}

/* Prevent visible caret on non-editable elements (avoid accidental edit-like caret) */
body *:not(input):not(textarea):not([contenteditable="true"]) {
    caret-color: transparent !important;
}

/* Optionally disable text selection if desired (uncomment to enable) */
/* body *:not(input):not(textarea):not([contenteditable="true"]) { user-select: none; } */

/* Floating cart button (bottom-right) */
.cart-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, bottom 0.3s ease;
    /* Added bottom transition */
}

.cart-fab i {
    font-size: 18px;
}

.cart-fab span#cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff5252;
    color: #fff;
    font-size: 12px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

@media (max-width: 480px) {
    .cart-fab {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
        /* Explicitly right */
    }

    .cart-fab i {
        font-size: 16px;
    }
}


/* When side-cart is open, ensure the floating cart button is not clickable */
.side-cart.open~.cart-fab {
    pointer-events: none;
    opacity: 0.6;
}

/* Wishlist Button Styles */
.wishlist-btn {
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: #ccc;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.wishlist-btn:hover {
    transform: scale(1.1);
    color: var(--primary-color);
}

.wishlist-btn.active {
    color: var(--primary-color);
    background: #f0f0ff;
    /* Light violet bg */
    box-shadow: 0 4px 15px rgba(100, 50, 200, 0.3);
}

.wishlist-btn.active i {
    font-weight: 900;
    /* Force solid icon */
    animation: heartBeat 0.3s ease-in-out;
}

.wishlist-btn.absolute-top-right {
    position: absolute;
    top: 10px;
    right: 10px;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Cart Pulse Animation */
.cart-pulse {
    animation: cartPulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cartPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Floating +1 Badge */
.floating-badge {
    position: fixed;
    color: var(--royal-violet);
    font-weight: 700;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 10006;
    animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-40px);
    }
}

/* Skeleton Loader Improvements */
.skeleton {
    background: #f0f0f2;
    background: linear-gradient(90deg, #f0f0f2 25%, #e0e0e2 50%, #f0f0f2 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite linear;
    border-radius: 8px;
}

@keyframes skeletonShimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 10px;
    width: 80%;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 15px;
    width: 60%;
}

.skeleton-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100%;
}

.skeleton-card .skeleton-image {
    width: 100% !important;
    height: 200px !important;
    border-radius: 12px 12px 0 0;
}

.skeleton-card .card-content {
    padding: 20px !important;
    flex-grow: 1;
}