/* === Shop Layout === */
.shop-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.shop-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    /* Sticky offset accounts for the fixed topbar + breathing space. */
    top: 100px;
}

.shop-main {
    flex: 1;
    /* Prevent flex children from overflowing horizontally (important for long text). */
    min-width: 0;
}

/* Responsive: Stack on mobile */
@media (max-width: 900px) {
    .shop-layout {
        flex-direction: column;
    }

    .shop-sidebar {
        width: 100%;
        position: static;
    }
}

/* === Product Grid === */
.product-grid {
    /* Responsive grid without many breakpoints. */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    padding: 2rem;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Product Card */
.product-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 380px;
}

/* Spotlight Glow Effect on Hover */
.product-card::before {
    /* Gradient border overlay using mask-composite (keeps inner content unmodified). */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 50%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.3;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(99, 102, 241, 0.4);
}

.product-card:hover::before {
    opacity: 1;
    background: linear-gradient(135deg, var(--accent-primary), transparent 60%);
}

.product-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.product-card .card-content {
    padding: 1.5rem 0 0 0;
    /* Keep spacing consistent between image and text content. */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card:hover img {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Title: Fixed Height (2 lines) */
.product-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    /* Keep card heights consistent across the grid (2-line clamp). */
    height: 2.6em;
    /* 1.3 * 2 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card h3 a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.product-card:hover h3 a {
    color: var(--accent-primary);
}

/* Description: Fixed Height (3 lines) */
.product-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    /* Keep card heights consistent across the grid (3-line clamp). */
    height: 4.8em;
    /* 1.6 * 3 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex-grow: 0;
}

/* Handle empty description gracefully */
.product-card p:empty {
    display: block;
}

/* Version Badge */
.product-card .version {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-bottom: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

/* Price: No Border */
.product-card strong {
    display: block;
    font-size: 1.5rem;
    color: #fff;
    margin-top: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Button: Centered */
.product-card .btn {
    align-self: center;
    margin-top: 1rem;
}

/* Uniform Grid - all cards same size */
@media (min-width: 1200px) {
    .product-grid {
        /* Intent: cap at 3 columns for readability on large screens. */
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === Featured Card with Mystic Glow === */
@keyframes mysticGlow {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(99, 102, 241, 0.3),
            0 0 40px rgba(99, 102, 241, 0.1),
            inset 0 0 20px rgba(99, 102, 241, 0.05);
    }

    50% {
        box-shadow:
            0 0 30px rgba(139, 92, 246, 0.4),
            0 0 60px rgba(139, 92, 246, 0.2),
            inset 0 0 30px rgba(139, 92, 246, 0.1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

.product-card.featured {
    /* Featured products get an animated glow to stand out in the grid. */
    border-color: rgba(99, 102, 241, 0.4);
    animation: mysticGlow 3s ease-in-out infinite;
}

/* Featured Badge */
.product-card.featured::after {
    content: 'Featured';
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(139, 92, 246, 0.9));
    border-radius: 20px;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    background-size: 200% auto;
    background-image: linear-gradient(90deg, rgba(99, 102, 241, 0.9) 0%, rgba(168, 85, 247, 1) 50%, rgba(99, 102, 241, 0.9) 100%);
    animation: shimmer 3s linear infinite;
}

/* Button */
.btn {
    /* Local fallback styling (kept in sync with buttons.css).
       If you see conflicts, ensure buttons.css is loaded after page-specific CSS. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    width: auto;
    min-width: 120px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

.btn:active {
    transform: scale(0.98);
}

/* Product Detail Page */
.product-detail {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 4rem;
    border-radius: 32px;
    text-align: center;
    max-width: 1000px;
    margin: 0 auto;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.product-detail img {
    max-width: 500px;
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.product-detail h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}