/**
 * Modern Product Card Design
 * Dark theme, clean and modern
 */

.product-card-wrapper {
    width: 100%;
    height: 100%;
}

.product-card {
    width: 350px;
    height: 450px;
    background: #1b1b1d;
    border-radius: 14px;
    padding: 0;
    color: #fff;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transition: 0.25s ease;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    padding: 10px 16px 8px 16px;
    position: relative;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    margin-left: 10px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.username {
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    font-size: 13px;
}

.handle {
    font-size: 11px;
    opacity: 0.6;
    display: block;
    color: #fff;
    line-height: 1.2;
}

.badge {
    position: absolute;
    left: -4px;
    top: -4px;
    background: #ff7b00;
    padding: 4px;
    border-radius: 6px;
    color: #000;
    font-size: 10px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.card-image {
    position: relative;
    margin-bottom: 0;
    width: 350px;
    height: 300px;
    margin-left: 0;
    margin-right: 0;
    background: #050505;
}

.card-image img {
    width: 350px;
    height: 300px;
    border-radius: 0;
    object-fit: cover;
    background: #050505;
    display: block;
}

.dots {
    text-align: center;
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #555;
    border-radius: 50%;
}

.dots span:first-child {
    background: #fff;
}

.card-body {
    flex: 1;
    margin-top: 0;
    padding: 16px;
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 0;
    margin-top: 0;
    color: #fff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.category {
    font-size: 13px;
    opacity: 0.5;
    color: #fff;
}

.card-footer,
.card-stats,
.stat-button {
    display: none;
}

.stat-button.favorite-btn.active {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.stat-button.favorite-btn.active i {
    color: #ef4444;
}

.stat-button.like-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.stat-button.like-btn.active i {
    color: #3b82f6;
}

.stat-button.favorite-btn.active i {
    color: #ef4444;
}

.stat-button .count {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Price badge */
.price-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
}

.price-badge.free {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.price-badge.paid {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
}

/* Avatar placeholder */
.avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* STL Viewer */
.stl-viewer-container {
    width: 350px;
    height: 300px;
    position: relative;
    border-radius: 0;
    overflow: hidden;
    background: #2a2a2c;
}

.model-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    z-index: 10;
}

.card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 350px;
    height: 300px;
    font-size: 72px;
    color: rgba(255, 255, 255, 0.3);
    background: #050505;
    border-radius: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .product-card {
        padding: 16px;
    }
    
    .card-header {
        margin-bottom: 0;
        padding: 8px 12px 6px 12px;
    }
    
    .avatar,
    .avatar-placeholder {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .user-info {
        margin-left: 8px;
        font-size: 12px;
    }
    
    .username {
        font-size: 12px;
    }
    
    .handle {
        font-size: 10px;
    }
    
    .card-image {
        width: 100%;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
        background: #050505;
    }
    
    .card-image img,
    .stl-viewer-container,
    .card-placeholder {
        min-height: 200px;
        background: #050505;
    }
    
    .title {
        font-size: 16px;
    }
    
    .category {
        font-size: 12px;
    }
    
    .card-footer {
        margin-top: 16px;
        padding-top: 16px;
    }
    
    .stat {
        font-size: 13px;
    }
    
    .stat i {
        font-size: 15px;
    }
}

/* Animated Favorite Button */
.favorite-button-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 40px;
}

.favorite-checkbox {
    display: none;
}

.favorite-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.favorite-count {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.product-card .favorite-count {
    display: none;
}

.favourite {
    border-radius: 50px;
    width: 30px;
    height: 30px;
    overflow: visible;
    cursor: pointer;
    position: relative;
    padding: 4px;
    box-shadow: none;
    color: white;
    transition: transform 0.2s ease;
    animation: pop 0.6s;
    background: transparent;
}

.favorite-label:hover .favourite {
    transform: scale(1.2);
}

.favourite.active {
    width: 30px;
}

.favourite.active .favourite_text {
    top: 6px;
    opacity: 0;
    transition: top 0.3s, opacity 0.3s;
    transition-delay: 0s;
}

.favourite_text {
    display: none;
}

.favourite_text span {
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.6px;
}

.favourite_heart {
    position: absolute;
    top: 6px;
    left: 7px;
    width: 16px;
    height: 16px;
    z-index: 10;
}

.favourite_heart__left {
    background: #ef4444;
    width: 10px;
    height: 16px;
    transform: rotate(-45deg);
    position: absolute;
    left: 0;
    top: 0;
    border-top-right-radius: 30px;
    border-top-left-radius: 30px;
    transition: transform 0.1s, width 0.2s, height 0.2s, left 0.2s, top 0.2s, margin-top 0.2s;
    transition-delay: 0s;
    z-index: 11;
}

.favourite_heart__right {
    background: #ef4444;
    width: 10px;
    height: 16px;
    transform: rotate(45deg);
    position: absolute;
    left: 5px;
    top: 0;
    border-top-right-radius: 30px;
    border-top-left-radius: 30px;
    transition: transform 0.1s, width 0.2s, height 0.2s, left 0.2s, margin-top 0.2s;
    transition-delay: 0s;
    z-index: 11;
}

.favourite:hover .favourite_heart__left {
    transform: scale(1.1) rotate(-45deg);
}

.favourite:hover .favourite_heart__right {
    transform: scale(1.1) rotate(45deg);
}

.favourite-checkbox:checked + .favorite-label .favourite.active .favourite_heart__left,
.favourite.active .favourite_heart__left {
    width: 5px;
    height: 8px;
    left: 1px;
    top: 1px;
    margin-top: 4px;
    transition-delay: 1.2s;
}

.favourite-checkbox:checked + .favorite-label .favourite.active .favourite_heart__right,
.favourite.active .favourite_heart__right {
    width: 5px;
    height: 10px;
    left: 7px;
    margin-top: 3px;
    transition-delay: 1.2s;
}

.spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.spinner_part {
    width: 2px;
    height: 2px;
    opacity: 0;
    background: #ef4444;
    position: absolute;
    top: 24px;
    left: 16px;
    transform-origin: 6px -18px;
    border-radius: 50%;
}

.favourite-checkbox:checked + .favorite-label .favourite .spinner_part {
    opacity: 1;
    transition: opacity 0.1s;
}

.favourite-checkbox:not(:checked) + .favorite-label .favourite .spinner_part {
    opacity: 0;
    transition: opacity 0.1s;
}

/* Spinner parts will be styled dynamically via JavaScript */

@keyframes pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Homepage Grid Layouts - 4 columns max - Same as featured-models */
.categories-section .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

#homepage-filaments-grid,
#homepage-printers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 0 auto 2rem auto;
    justify-items: center;
    justify-content: center;
    max-width: 100%;
}

/* Responsive - Same as .product-grid */
@media (max-width: 1400px) {
    #homepage-filaments-grid,
    #homepage-printers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    #homepage-filaments-grid,
    #homepage-printers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #homepage-filaments-grid,
    #homepage-printers-grid {
        grid-template-columns: 1fr;
    }
}