/* Collection Screen Styles - Enhanced for New Card Layout */

/* Card grid layout for collections */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 16px;
    max-width: 100%;
}

/* Card sets grouping */
.card-set-group {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.card-set-heading {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 10px 0;
    color: var(--accent-color, #e94564);
    text-shadow: 0 0 5px rgba(233, 69, 100, 0.5);
}

/* Legacy rectangular card styling for backward compatibility */
.collection-card-legacy {
    width: 160px;
    height: 224px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    background: 
        linear-gradient(145deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 50%, rgba(0, 0, 0, 0.1) 100%);
    border: 2px solid rgba(74, 144, 226, 0.35);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(74, 144, 226, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Enhanced collection card styling that complements premium card design */
.collection-card {
    margin: 0 auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Collection-specific enhancements for unified cards */
.unified-card--collection {
    /* Enhanced grid positioning and hover effects for collection context */
    cursor: pointer;
}

/* Card back scaling for collection context */
.collection-card .card-back {
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.collection-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #4a90e2, #9046e2, #e24a90, #90e246);
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.collection-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

/* Enhanced hover effects for collection cards */
.collection-card:hover,
.unified-card--collection:hover {
    transform: translateY(-8px) scale(1.02);
    filter: brightness(1.1) drop-shadow(0 10px 20px rgba(74, 144, 226, 0.3));
}

/* Legacy hover styling */
.collection-card-legacy:hover {
    transform: translateY(-12px) scale(1.03);
    border-color: rgba(74, 144, 226, 0.7);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5), 
        0 0 40px rgba(74, 144, 226, 0.4),
        0 0 80px rgba(74, 144, 226, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: cardGlow 2s ease-in-out infinite alternate;
}

.collection-card:hover::before {
    opacity: 1;
    animation: borderGlow 2s ease-in-out infinite alternate;
}

.collection-card:hover::after {
    left: 100%;
}

@keyframes cardGlow {
    0% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.5), 
            0 0 40px rgba(74, 144, 226, 0.4),
            0 0 80px rgba(74, 144, 226, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    100% {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.5), 
            0 0 50px rgba(74, 144, 226, 0.6),
            0 0 100px rgba(74, 144, 226, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes borderGlow {
    0% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

/* Responsive collection card sizing for premium cards */
.card-list.view-grid.grid-small .collection-card,
.card-list.view-grid.grid-small .unified-card--collection {
    max-width: 120px;
    font-size: 0.85em;
}

.card-list.view-grid.grid-small .collection-card:hover,
.card-list.view-grid.grid-small .unified-card--collection:hover {
    transform: translateY(-6px) scale(1.01);
}

.card-list.view-grid.grid-medium .collection-card,
.card-list.view-grid.grid-medium .unified-card--collection {
    max-width: 160px;
    font-size: 1em;
}

.card-list.view-grid.grid-large .collection-card,
.card-list.view-grid.grid-large .unified-card--collection {
    max-width: 200px;
    font-size: 1.1em;
}

.card-list.view-grid.grid-large .collection-card:hover,
.card-list.view-grid.grid-large .unified-card--collection:hover {
    transform: translateY(-10px) scale(1.03);
}

/* Legacy responsive sizing */
.card-list.view-grid.grid-small .collection-card-legacy {
    width: 120px;
    height: 168px;
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 
        0 6px 24px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(74, 144, 226, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-list.view-grid.grid-medium .collection-card-legacy {
    width: 160px;
    height: 224px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(74, 144, 226, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-list.view-grid.grid-large .collection-card-legacy {
    width: 200px;
    height: 280px;
    border-radius: 24px;
    backdrop-filter: blur(18px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(74, 144, 226, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* COLLECTION-SPECIFIC: Card artwork visibility fixes ONLY for collection screen */
#screen-collection .collection-card .card-artwork,
#screen-collection .card .card-artwork {
    height: 140px; /* Updated to match new premium card design */
    position: relative;
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #1e293b 100%);
    overflow: hidden;
    margin: 0;
    display: block;
}

#screen-collection .collection-card .card-image,
#screen-collection .card .card-artwork .card-image {
    width: 100%;
    height: 100%;
    position: relative;
    display: block;
}

#screen-collection .collection-card .card-image img,
#screen-collection .card .card-artwork .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    opacity: 1;
    visibility: visible;
}

/* Override lazy-load opacity ONLY in collection screen */
#screen-collection .card .card-artwork .card-image img.lazy-load,
#screen-collection .card .card-artwork .card-image img {
    opacity: 1;
    transform: none;
    filter: none;
}

.collection-card-image.artwork-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.collection-card:hover .collection-card-image.artwork-image {
    transform: scale(1.05);
    filter: brightness(1.15) drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
    border-color: rgba(74, 144, 226, 0.5);
}

.collection-card:hover .collection-card-image.artwork-image::before {
    opacity: 1;
    animation: imageShimmer 1.5s ease-in-out;
}

@keyframes imageShimmer {
    0% {
        background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    }
    50% {
        background: linear-gradient(135deg, transparent 20%, rgba(255, 255, 255, 0.2) 50%, transparent 80%);
    }
    100% {
        background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    }
}

/* Image loading and error states */
.collection-card-image.artwork-image[src=""],
.collection-card-image.artwork-image:not([src]) {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    position: relative;
}

.collection-card-image.artwork-image[src=""]:before,
.collection-card-image.artwork-image:not([src]):before {
    content: "🎴";
    font-size: 2rem;
    opacity: 0.3;
}

/* Size-specific image enhancements - Shop-Enhanced */
.card-list.view-grid.grid-small .collection-card-image.artwork-image {
    border-radius: 12px 12px 0 0;
    border: 1px solid rgba(74, 144, 226, 0.25);
}

.card-list.view-grid.grid-small .collection-card-image.artwork-image:not([src]):before {
    font-size: 1.5rem;
}

.card-list.view-grid.grid-large .collection-card-image.artwork-image {
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(74, 144, 226, 0.4);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        0 0 12px rgba(74, 144, 226, 0.2);
}

.card-list.view-grid.grid-large .collection-card-image.artwork-image:not([src]):before {
    font-size: 2.5rem;
}

.card-list.view-grid.grid-large .collection-card:hover .collection-card-image.artwork-image {
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(74, 144, 226, 0.4);
}

/* Unowned card styles - enhanced for new layout */
.collection-card.unowned {
    opacity: 0.6;
    filter: grayscale(80%);
    position: relative;
}

.collection-card.unowned::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
    border-radius: 12px;
}

/* Card owned count display - Shop-Enhanced */
.card-owned-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: 
        linear-gradient(145deg, rgba(35, 15, 45, 0.95) 0%, rgba(25, 10, 35, 0.9) 100%);
    color: #e1bee7;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 12px;
    z-index: 5;
    border: 1px solid rgba(156, 39, 176, 0.5);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 8px rgba(156, 39, 176, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.collection-card:hover .card-owned-count {
    transform: scale(1.1);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.6),
        0 0 12px rgba(156, 39, 176, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(156, 39, 176, 0.7);
}

/* Size-specific owned count styling */
.card-list.view-grid.grid-small .card-owned-count {
    font-size: 0.75rem;
    padding: 3px 6px;
    bottom: 3px;
    right: 3px;
}

.card-list.view-grid.grid-large .card-owned-count {
    font-size: 0.9rem;
    padding: 5px 10px;
    bottom: 8px;
    right: 8px;
}

/* Highlight for cards with duplicates - Shop-Enhanced */
.card.has-duplicates .card-owned-count {
    background: 
        linear-gradient(145deg, rgba(255, 193, 7, 0.95) 0%, rgba(255, 152, 0, 0.9) 50%, rgba(255, 193, 7, 0.8) 100%);
    border: 2px solid rgba(255, 193, 7, 0.8);
    color: #ffffff;
    font-weight: bold;
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 4px rgba(255, 193, 7, 0.5);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.6),
        0 0 16px rgba(255, 193, 7, 0.6),
        0 0 32px rgba(255, 193, 7, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: duplicateGlow 2s ease-in-out infinite alternate;
}

@keyframes duplicateGlow {
    0% {
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.6),
            0 0 16px rgba(255, 193, 7, 0.6),
            0 0 32px rgba(255, 193, 7, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    100% {
        box-shadow: 
            0 4px 16px rgba(0, 0, 0, 0.6),
            0 0 20px rgba(255, 193, 7, 0.8),
            0 0 40px rgba(255, 193, 7, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
}

.card.unowned::after {
    content: "?";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    z-index: 2;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.card.unowned .card-image-area {
    filter: blur(3px);
}

.card.unowned .card-name,
.card.unowned .card-description,
.card.unowned .card-ability {
    filter: blur(2px);
}

/* Separator between card groups */
.set-separator {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5), transparent);
    margin: 30px 0 15px;
}