/* Shoppable Videos Frontend Styles */

.shoppable-videos-grid {
    display: grid;
    gap: 16px;
    padding: 20px 0;
}

.shoppable-videos-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.shoppable-videos-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.shoppable-videos-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }
.shoppable-videos-grid[data-columns="5"] { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1200px) {
    .shoppable-videos-grid[data-columns="5"] { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 992px) {
    .shoppable-videos-grid[data-columns="4"],
    .shoppable-videos-grid[data-columns="5"] { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .shoppable-videos-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 480px) {
    .shoppable-videos-grid { grid-template-columns: 1fr; }
}

/* Video Card */
.sv-card {
    position: relative;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    aspect-ratio: 9/16;
}

.sv-card:hover {
    transform: scale(1.02);
}

/* Video Container */
.sv-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.sv-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sv-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

.sv-card.playing .sv-video {
    z-index: 2;
}

.sv-card.playing .sv-thumbnail {
    opacity: 0;
}

/* Sound Toggle Button */
.sv-sound-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease;
    padding: 0;
}

.sv-sound-toggle:hover {
    background: rgba(0, 0, 0, 0.7);
}

.sv-sound-toggle svg {
    width: 18px;
    height: 18px;
}

/* Product Preview (Bottom Bar) */
.sv-product-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
    border-radius: 0 0 12px 12px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.sv-product-preview:hover {
    background: rgba(255, 255, 255, 1);
}

.sv-product-preview img {
    display: none;
}

.sv-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sv-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sv-product-price {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.sv-expand-btn {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    color: #333;
}

.sv-expand-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.sv-expand-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
    stroke-width: 2.5;
}

.sv-card.expanded .sv-expand-btn svg {
    transform: rotate(180deg);
}

/* Hide expand button if only one product */
.sv-card[data-product-count="1"] .sv-expand-btn {
    display: none;
}

/* Show product count when multiple products */
.sv-card[data-product-count]:not([data-product-count="1"]):not([data-product-count="0"]) .sv-expand-btn::after {
    content: attr(data-count);
    position: absolute;
    top: -4px;
    right: -4px;
    background: #000;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Expanded Products List */
.sv-products-expanded {
    position: absolute;
    bottom: 70px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    max-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    z-index: 15;
    padding: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.sv-card.expanded .sv-products-expanded {
    max-height: 400px;
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sv-product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sv-product-item:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
}

.sv-product-item:last-child {
    margin-bottom: 0;
}

.sv-product-item img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.sv-product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sv-product-item .sv-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sv-product-item .sv-product-price {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

/* Custom Scrollbar */
.sv-products-expanded::-webkit-scrollbar {
    width: 6px;
}

.sv-products-expanded::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.sv-products-expanded::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.sv-products-expanded::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Discount Badge (if needed) */
.sv-discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ff3b30;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    z-index: 10;
}

/* Loading State */
.sv-card.loading .sv-video-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Animation for expansion */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sv-card.expanded .sv-product-item {
    animation: slideUp 0.3s ease forwards;
}

.sv-card.expanded .sv-product-item:nth-child(1) { animation-delay: 0.05s; }
.sv-card.expanded .sv-product-item:nth-child(2) { animation-delay: 0.1s; }
.sv-card.expanded .sv-product-item:nth-child(3) { animation-delay: 0.15s; }
.sv-card.expanded .sv-product-item:nth-child(4) { animation-delay: 0.2s; }
.sv-card.expanded .sv-product-item:nth-child(5) { animation-delay: 0.25s; }
