/* Video System Styles */

/* Videos listing grid */
.videos-grid-container {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Large desktop */
@media (max-width: 1920px) {
    .videos-grid-container {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }
}

/* Desktop */
@media (max-width: 1600px) {
    .videos-grid-container {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

/* Laptop */
@media (max-width: 1400px) {
    .videos-grid-container {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* Tablet */
@media (max-width: 992px) {
    .videos-grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .videos-grid-container {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
}

.video-grid-item {
    display: flex;
}

.videos-grid-container .video-grid-item.text-center {
    grid-column: 1 / -1;
}

.video-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0,0,0,0.05);
}

.video-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.18);
}

.video-thumbnail-link {
    display: block;
    position: relative;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 ratio */
    overflow: hidden;
    background: #111;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.08);
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.65);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    transition: background 0.3s ease, transform 0.3s ease;
}

.video-card:hover .video-play-button {
    background: rgba(0,0,0,0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-details {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.video-details h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.video-details h3 a {
    color: inherit;
    text-decoration: none;
}

.video-details h3 a:hover {
    color: var(--primary-color, #8B7AA8);
}

.video-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

.video-stats {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: #666;
}

/* Video Player Section */
.video-player-section {
    background-color: #f8f9fa;
    min-height: 600px;
}

.video-player-container {
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

/* Video Info */
.video-info h1 {
    color: #333;
    font-weight: 600;
}

.video-meta {
    font-size: 0.9rem;
}

.video-meta .badge {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.video-description {
    color: #555;
    line-height: 1.7;
}

/* Related Videos */
.related-videos {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.related-video-item {
    transition: transform 0.2s ease;
}

.related-video-item:hover {
    transform: translateX(5px);
}

.related-video-link {
    text-decoration: none;
    color: inherit;
}

.related-video-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

.related-video-thumbnail img {
    width: 100%;
    height: auto;
    object-fit: cover;
    background-color: #f0f0f0;
    min-height: 80px;
}

/* Error handling for broken images */
.related-video-thumbnail img[src=""],
.related-video-thumbnail img:not([src]) {
    position: relative;
    background-color: #ddd;
}

.related-video-thumbnail img::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.7);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.related-video-info h4 {
    color: #333;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Video Categories */
.video-categories {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.video-categories .list-group-item {
    border: 1px solid #e0e0e0;
    margin-bottom: -1px;
}

.video-categories .list-group-item:hover {
    background-color: #f8f9fa;
}

.video-categories .list-group-item.active {
    background-color: var(--primary-color, #8B7AA8);
    border-color: var(--primary-color, #8B7AA8);
}

/* Share Modal */
.share-modal .modal-body {
    padding: 2rem;
}

.share-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.share-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    transition: transform 0.2s ease;
}

.share-option:hover {
    transform: scale(1.1);
    color: #fff;
}

.share-option.facebook {
    background-color: #1877f2;
}

.share-option.twitter {
    background-color: #1da1f2;
}

.share-option.line {
    background-color: #00c300;
}

.share-option.copy-link {
    background-color: #6c757d;
}

.share-link-input {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    padding: 1rem;
    border-radius: 8px;
}

/* Page Header */
.page-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #6c757d;
}

/* Responsive */
@media (max-width: 991px) {
    .related-videos,
    .video-categories {
        margin-top: 2rem;
    }
}

@media (max-width: 767px) {
    .video-info h1 {
        font-size: 1.5rem;
    }
    
    .video-meta {
        flex-direction: column;
        align-items: flex-start!important;
    }
    
    .share-buttons {
        margin-left: 0!important;
        margin-top: 0.5rem;
    }
}