/* ═══════════════════════════════════════════════════════════════════════
   🎮 GAME CLUB POS — CARDS.CSS v3 — VIZITKA STAMP EDITION
   ═══════════════════════════════════════════════════════════════════════

   CONCEPT:
   ─────────────────────────────────────────────────────────────────────
   Product image has NO background (transparent PNG).
   Card itself is also barely visible (subtle outline only).

   ON HOVER:
   ┌──────────────────────────────────────────────────────────────┐
   │  1. Product image scales up (1.3x) + lifts forward          │
   │  2. A "VIZITKA" (business card) flies in from the right     │
   │  3. Vizitka has PRICE + STOCK info                          │
   │  4. It "stamps" onto the product's belly with rotation      │
   │  5. Slight bounce on impact                                  │
   └──────────────────────────────────────────────────────────────┘

   ON MOUSE LEAVE:
   ┌──────────────────────────────────────────────────────────────┐
   │  Vizitka flies back to its hidden position                  │
   │  Product image scales back to original                      │
   │  Smooth, satisfying return                                   │
   └──────────────────────────────────────────────────────────────┘

   ═══════════════════════════════════════════════════════════════════════ */


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   CARD WRAPPER — NO BACKGROUND, MINIMAL                          ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.product-card {
    height: var(--card-h, 230px);
    position: relative;
    cursor: pointer;
    user-select: none;
    overflow: visible !important;
    z-index: 1;

    /* NO background — let products breathe */
    background: transparent;

    /* Subtle outline only */
    border: 1px solid transparent;
    border-radius: var(--r-lg);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 10px 0;

    transition:
        z-index 0s 0.5s,
        background 0.35s var(--smooth),
        border-color 0.35s var(--smooth);
}

/* On hover, lift z-index immediately */
.product-card:hover {
    z-index: 50;
    transition: z-index 0s 0s,
                background 0.25s var(--smooth),
                border-color 0.25s var(--smooth);
    background: rgba(28, 28, 30, 0.4);
    border-color: rgba(0, 122, 255, 0.15);
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   ENTRANCE ANIMATION — Cards drop in like falling                ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

@keyframes cardDropIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.85);
    }
    60% {
        opacity: 1;
        transform: translateY(6px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.product-card:nth-child(1)  { animation: cardDropIn 0.5s 0.02s var(--spring) backwards; }
.product-card:nth-child(2)  { animation: cardDropIn 0.5s 0.05s var(--spring) backwards; }
.product-card:nth-child(3)  { animation: cardDropIn 0.5s 0.08s var(--spring) backwards; }
.product-card:nth-child(4)  { animation: cardDropIn 0.5s 0.11s var(--spring) backwards; }
.product-card:nth-child(5)  { animation: cardDropIn 0.5s 0.14s var(--spring) backwards; }
.product-card:nth-child(6)  { animation: cardDropIn 0.5s 0.17s var(--spring) backwards; }
.product-card:nth-child(7)  { animation: cardDropIn 0.5s 0.20s var(--spring) backwards; }
.product-card:nth-child(8)  { animation: cardDropIn 0.5s 0.23s var(--spring) backwards; }
.product-card:nth-child(9)  { animation: cardDropIn 0.5s 0.26s var(--spring) backwards; }
.product-card:nth-child(10) { animation: cardDropIn 0.5s 0.29s var(--spring) backwards; }
.product-card:nth-child(11) { animation: cardDropIn 0.5s 0.32s var(--spring) backwards; }
.product-card:nth-child(12) { animation: cardDropIn 0.5s 0.35s var(--spring) backwards; }
.product-card:nth-child(n+13) { animation: cardDropIn 0.5s 0.38s var(--spring) backwards; }


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   PRODUCT IMAGE — TRANSPARENT, FLOATING                          ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.card-image {
    width: 100%;
    height: 160px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8px;
    background: transparent;
}

/* The actual product image */
.card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;

    /* filter yo'q — GPU compositing ishlashi uchun (float animation + filter = CPU repaint) */
    transition: transform 0.5s var(--spring);
    will-change: transform;
}

/* Emoji fallback (when no image) */
.fallback-emoji {
    font-size: 70px;
    line-height: 1;
    transition: transform 0.5s var(--spring);
    will-change: transform;
}

/* ═══ ON HOVER: image lifts and scales ═══ */
.product-card:hover .card-image img,
.product-card:hover .fallback-emoji {
    transform: translateY(-12px) scale(1.18);
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   PRODUCT NAME (below image)                                     ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.card-name {
    width: 100%;
    padding: 8px 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    transition: color 0.3s, transform 0.3s;
    flex-shrink: 0;
}
.product-card:hover .card-name {
    color: var(--text-primary);
    transform: translateY(2px);
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   ★★★ VIZITKA — Business card that flies in & stamps ★★★       ║
   ║                                                                   ║
   ║   This is THE main effect of the new design.                     ║
   ║   Hidden by default — slides in from right on hover.             ║
   ║   Has price + stock info, rotated like a stamp.                  ║
   ║                                                                   ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.vizitka {
    /* Position: middle-lower of the card (the "belly") */
    position: absolute;
    bottom: 38%;
    left: 50%;

    /* Size — like a real business card */
    width: 92px;
    height: 56px;

    /* Card design */
    background: linear-gradient(135deg,
        #FFFFFF 0%,
        #F5F5F7 50%,
        #E8E8ED 100%);
    border-radius: 8px;

    /* Realistic shadow */
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.45),
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);

    /* Layout for content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;

    /* HIDDEN STATE — off to the right, rotated, invisible */
    transform: translate(120px, 0) rotate(45deg) scale(0.4);
    opacity: 0;
    pointer-events: none;

    /* z-index higher than image so it sits ON TOP */
    z-index: 20;

    /* Multi-stage transition for "fly + stamp" feel */
    transition:
        transform 0.45s cubic-bezier(0.34, 1.65, 0.5, 1),
        opacity 0.3s ease-out;

    will-change: transform, opacity;
}

/* Top color stripe — like a real business card */
.vizitka::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--grad-blue);
    border-radius: 8px 8px 0 0;
}

/* Bottom subtle pattern */
.vizitka::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 6px;
    right: 6px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(0, 122, 255, 0.2),
        transparent);
}

/* Vizitka content — PRICE */
.vizitka-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    color: #0F1419;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-top: 4px;
}

/* Vizitka content — STOCK */
.vizitka-stock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    color: #34C759;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: uppercase;
}

.vizitka-stock.low {
    color: var(--ios-orange);
}

.vizitka-stock.out {
    color: var(--ios-red);
}

/* ═════════════════════════════════════════════════════════
   ★ HOVER STATE — Vizitka flies in & stamps the product ★
   ═════════════════════════════════════════════════════════ */

.product-card:hover .vizitka {
    /* Final stamp position:
       - centered (translate(-50%, 0))
       - slight rotation for "stamp" feel (-8deg)
       - normal scale
    */
    transform: translate(-50%, 0) rotate(-8deg) scale(1);
    opacity: 1;
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   STAMP IMPACT — When vizitka "lands" with a thump                ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

@keyframes stampImpact {
    0% {
        transform: translate(-50%, 0) rotate(-8deg) scale(1);
    }
    40% {
        transform: translate(-50%, 0) rotate(-8deg) scale(0.92);
    }
    70% {
        transform: translate(-50%, 0) rotate(-8deg) scale(1.04);
    }
    100% {
        transform: translate(-50%, 0) rotate(-8deg) scale(1);
    }
}

/* Apply stamp bounce after the fly-in completes */
.product-card:hover .vizitka {
    animation: stampImpact 0.4s 0.35s var(--spring);
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   CATEGORY BADGE (small, top-left)                               ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    background: rgba(0, 0, 0, 0.70);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--r-full);
    padding: 3px 8px;
    font-size: 9px;
    color: var(--ios-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.product-card:hover .card-badge {
    opacity: 1;
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   FAVORITE STAR (top-right)                                      ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.fav-star {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.70);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    z-index: 5;
    opacity: 0.7;
    transition: all 0.3s var(--spring);
}

.product-card:hover .fav-star {
    opacity: 1;
}

.fav-star:hover {
    transform: scale(1.2) rotate(15deg);
    color: var(--ios-yellow);
    border-color: rgba(255, 204, 0, 0.4);
}

.fav-star.active {
    background: var(--ios-yellow);
    border-color: var(--ios-yellow);
    color: #000;
    opacity: 1;
    box-shadow: 0 0 14px rgba(255, 204, 0, 0.4);
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   FLOATING SHADOW UNDER PRODUCT (when lifted on hover)           ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

/* Ground shadow that grows when product lifts */
.product-card .card-image::after {
    content: '';
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 14px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.15) 50%,
        transparent 75%);
    border-radius: 50%;
    z-index: -1;
    transition: all 0.5s var(--spring);
    pointer-events: none;
    opacity: 0.6;
}

.product-card:hover .card-image::after {
    width: 85%;
    height: 18px;
    opacity: 0.85;
    transform: translateX(-50%) translateY(8px);
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   CLICK FEEDBACK — Product "presses down" when tapped            ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

@keyframes cardPunch {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.94); }
    70%  { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.product-card.just-added {
    animation: cardPunch 0.3s var(--spring);
}

.product-card.just-added .vizitka {
    /* Vizitka flashes green when added */
    background: linear-gradient(135deg, #D4F5DD, #C0F0CC) !important;
    box-shadow:
        0 12px 24px rgba(52, 199, 89, 0.4),
        0 0 30px rgba(52, 199, 89, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.product-card.just-added .vizitka::before {
    background: var(--grad-green) !important;
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   OUT OF STOCK STYLE                                             ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.product-card.out-of-stock-card {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.85);
}

.product-card.out-of-stock-card .vizitka {
    display: none;
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   GENTLE FLOATING (idle animation — products breathe)           ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

@keyframes productFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

.product-card:not(:hover):not(.out-of-stock-card) .card-image img,
.product-card:not(:hover):not(.out-of-stock-card) .fallback-emoji {
    animation: productFloat 4s ease-in-out infinite;
}

.product-card:nth-child(2n) .card-image img,
.product-card:nth-child(2n) .fallback-emoji {
    animation-delay: -2s;
}

.product-card:nth-child(3n) .card-image img,
.product-card:nth-child(3n) .fallback-emoji {
    animation-delay: -1.3s;
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║   RESPONSIVE                                                     ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

@media (max-width: 900px) {
    .vizitka {
        width: 80px;
        height: 50px;
        bottom: 35%;
    }
    .vizitka-price { font-size: 12px; }
    .vizitka-stock { font-size: 8px; }
}

@media (max-width: 600px) {
    .vizitka {
        width: 70px;
        height: 44px;
    }
    .vizitka-price { font-size: 11px; }
}