/**
 * MIN Livestream Feed Styles
 * TikTok-style vertical feed layout
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.min-livestream-feed {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.min-livestream-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(var(--columns, 1), 1fr);
    padding: 20px 0;
}

/* Livestream Card */
.min-livestream-card {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

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

.min-livestream-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.min-livestream-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, transparent 40%, transparent 60%, rgba(0,0,0,0.8) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.min-livestream-card:hover .min-livestream-overlay {
    opacity: 1;
}

/* Live Badge */
.min-live-badge-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
    animation: pulse 1s infinite;
}

.min-live-badge-header::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
    50% { box-shadow: 0 0 0 4px rgba(255, 0, 0, 0); }
}

/* Vendor Info */
.min-vendor-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.min-vendor-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid white;
    object-fit: cover;
}

.min-vendor-name {
    flex: 1;
}

.min-vendor-name strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.min-vendor-name small {
    font-size: 12px;
    opacity: 0.8;
}

/* Viewers Count */
.min-viewers-count {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    width: fit-content;
}

.min-viewers-count::before {
    content: '👁';
}

/* Product/Store Overlay */
.min-product-overlay {
    background: rgba(0, 0, 0, 0.9);
    padding: 12px;
    border-radius: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.min-product-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.min-product-item:hover {
    transform: translateX(5px);
}

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

.min-product-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

.min-product-details {
    flex: 1;
    font-size: 12px;
}

.min-product-name {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.min-product-price {
    color: #4CAF50;
    font-weight: 600;
}

.min-store-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #FFD700;
}

/* Loading Placeholder */
.min-loading-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.min-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Load More Button */
.min-livestream-footer {
    text-align: center;
    padding: 40px 20px;
}

.min-load-more-btn {
    background: #333;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.min-load-more-btn:hover {
    background: #555;
}

.min-load-more-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

/* No Livestreams Message */
.min-no-streams {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.min-no-streams p {
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .min-livestream-grid {
        gap: 12px;
        padding: 12px 0;
    }

    .min-livestream-card {
        border-radius: 8px;
    }

    .min-livestream-overlay {
        padding: 12px;
    }

    .min-vendor-info {
        font-size: 12px;
    }

    .min-vendor-avatar {
        width: 32px;
        height: 32px;
    }

    .min-product-image {
        width: 50px;
        height: 50px;
    }

    .min-product-details {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .min-livestream-grid {
        gap: 8px;
        grid-template-columns: repeat(var(--columns, 1), 1fr);
    }

    .min-livestream-card {
        aspect-ratio: 9 / 16;
    }

    .min-livestream-overlay {
        padding: 8px;
    }
}

/* Livestream Modal */
.min-livestream-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.min-livestream-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.min-livestream-modal-content {
    position: relative;
    z-index: 10000;
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: #000;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.min-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    font-size: 32px;
    padding: 5px 15px;
    cursor: pointer;
    border-radius: 4px;
}

.min-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.min-viewer-video {
    width: 100%;
    height: calc(100% - 100px);
    background: #1a1a1a;
    object-fit: contain;
}

.min-viewer-info {
    padding: 15px;
    background: #000;
    color: #fff;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.min-viewer-info h3 {
    margin-bottom: 5px;
    font-size: 16px;
}

.min-viewer-info p {
    font-size: 14px;
    color: #aaa;
}

@media (max-width: 768px) {
    .min-livestream-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .min-viewer-video {
        height: calc(100% - 80px);
    }

    .min-viewer-info {
        height: 80px;
    }
}
