/* Media Styles */

/* Styles for fullscreen mode */
video::-webkit-media-controls-fullscreen-button {
    display: none;
}

/* Ensure videos in fullscreen mode maintain aspect ratio */
video:fullscreen {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

video:-webkit-full-screen {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

video:-moz-full-screen {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

video:-ms-fullscreen {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* TikTok Container Styles */
#tiktok-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000; /* Pure black for better contrast */
    z-index: 40;
}

.tiktok-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none !important;
    max-width: 100vw;
    max-height: 100vh;
    z-index: 10;
    background-color: #000;
    opacity: 0;
    /* transition: opacity var(--transition-normal) ease; */ /* Removed transition */
}

video.tiktok-media {
    object-position: center;
    background-color: #000;
    object-fit: contain;
}

img.tiktok-media {
    object-fit: contain;
    background-color: #000;
}

.tiktok-media.active {
    display: block !important;
    z-index: 15;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
}

/* Media Info Overlay */
.media-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: var(--space-md);
    color: var(--text-primary);
    z-index: 20;
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
}

#tiktok-container:hover .media-info-overlay {
    opacity: 1;
}

.media-info-overlay .filename {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-info-overlay .metadata {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: var(--space-md);
}

/* Media Controls Styles */
.media-controls {
    position: fixed;
    bottom: var(--space-xl);
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    z-index: 30;
}

.media-controls button {
    background: var(--primary-color);
    color: var(--text-primary);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-circle);
    border: 2px solid rgba(255, 255, 255, 0.1);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast) ease;
    box-shadow: var(--shadow-md);
}

.media-controls button:hover {
    background: var(--primary-color-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.2);
}

.media-controls button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.media-controls button.primary {
    background: var(--accent-color);
    width: 64px;
    height: 64px;
}

.media-controls button.primary:hover {
    background: var(--accent-color-light);
}

/* Category List Styles */
.category-list {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-lg);
    padding: var(--space-sm);
    padding-bottom: 80px;
}

.category-item {
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all var(--transition-normal) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    height: 260px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transform: translateZ(0); /* Force GPU acceleration */
}

.category-item:hover {
    background: var(--card-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.15);
}

.category-item:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-lg);
    box-shadow: inset 0 0 30px rgba(var(--accent-color-rgb), 0.3);
    pointer-events: none;
    opacity: 0.6;
}

.category-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-color);
    z-index: 1;
    opacity: 0.8;
}

.thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background-color: #333;
    transition: transform var(--transition-normal) ease;
}

.category-item:hover .thumbnail {
    transform: scale(1.05);
}

/* Category Info Styles */
.category-info {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md) var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, var(--surface-color) 20%);
    padding-top: 30px;
}

.category-info::after {
    content: attr(data-path);
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 2px;
}

/* Media Count Badge */
.media-count-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(0,0,0,0.7);
    padding: 4px 8px;
    border-radius: var(--radius-md);
    z-index: 1;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-sm);
}

/* Media Type Icon */
.media-type-icon {
    position: absolute;
    bottom: var(--space-md);
    left: var(--space-md);
    font-size: 1.125rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-md);
    z-index: 1;
    line-height: 1;
    user-select: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-sm);
}

/* Lazy Loading Styles */
.lazy-load {
    opacity: 0;
    transition: opacity var(--transition-normal) ease-in;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Video Thumbnail Styles */
.video-thumbnail-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: #000;
    z-index: 10;
}

.video-thumbnail-container.active {
    display: flex !important;
    z-index: 15;
    opacity: 1;
}

.video-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 100vw;
    max-height: 100vh;
    transition: transform 0.2s ease;
}

.video-thumbnail-container:hover .video-thumbnail-image {
    transform: scale(1.02);
}

/* Play Icon Overlay */
.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.play-icon-overlay::before {
    content: '';
    width: 0;
    height: 0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    border-left: 30px solid white;
    margin-left: 8px; /* Offset slightly to center visually */
}

.video-thumbnail-container:hover .play-icon-overlay {
    background-color: rgba(0, 0, 0, 0.7);
    transform: translate(-50%, -50%) scale(1.1);
}
