/* Global Overrides */
:root {
    --bs-body-font-family: 'IBM Plex Sans', sans-serif;
    --bs-heading-font-family: 'Cormorant Garamond', serif;
    --bs-primary: #6487AF;
    --bs-primary-rgb: 100, 135, 175;

    /* Custom Palette */
    --primary: #6487AF;
    --primary-dark: #3A5778;
    --primary-light: #E6EFF9;
    --accent: #AABEDC;
    --text-main: #333333;
    --text-sub: #666666;
    --bg-body: #FFFFFF;
    --bg-neutral: #F5F5F5;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--bs-body-font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--bs-heading-font-family);
    font-weight: 600;
}

/* Navbar Customization */
.navbar-brand {
    font-family: var(--bs-heading-font-family);
    font-size: 1.5rem;
    color: var(--primary-dark) !important;
}

/* Hero Section */
.hero-section {
    background: radial-gradient(circle at 50% 40%, #2c5a85 0%, #12243d 100%);
    position: relative;
    padding: 50px 0;
    color: white;
    overflow: hidden;
}

/* Background Pattern (Black Dots) */
.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Subtle black dots */
    background-image: radial-gradient(rgba(0, 0, 0, 0.25) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 1;
    pointer-events: none;
}

/* Ensure content is above the dots */
.hero-section>.container {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    font-family: var(--bs-heading-font-family);
    color: #fff;
    text-align: left;
}

.latest-tag {
    color: #AABEDC;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-description {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
    max-width: 500px;
}

.hero-tags .badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 400;
    padding: 8px 12px;
    margin-right: 8px;
    margin-bottom: 8px;
    backdrop-filter: blur(4px);
}

.hero-image-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Filter Section */
.filter-bar {
    padding: 30px 0 20px;
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 8px 24px;
    color: #556b82;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 20px;
}

.filter-btn:hover {
    color: var(--primary-dark);
    background-color: rgba(100, 135, 175, 0.1);
}

.filter-btn.active {
    color: var(--primary-dark);
    background-color: #E6EFF9;
    font-weight: 700;
}

.search-input {
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    padding-left: 40px;
    background-color: #f9f9f9;
}

@media (max-width: 768px) {
    .filter-bar .row {
        gap: 15px;
    }

    .filter-bar .col-md-auto,
    .filter-bar .col-md {
        width: 100%;
        display: flex;
        justify-content: flex-start !important;
    }

    /* Filters scrollable container */
    .filter-bar .col-md.d-flex.justify-content-center {
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Search Bar full width */
    .filter-bar .search-input {
        width: 100%;
    }

    .filter-bar .position-relative {
        width: 100%;
    }
}

/* Video Cards */
.video-card {
    background: #F4F6F9;
    border: none;
    border-radius: 20px;
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.card-header-text {
    margin-bottom: 20px;
}

.card-title {
    font-family: var(--bs-body-font-family);
    font-weight: 800;
    font-size: 1.1rem;
    color: #1a2e45;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
    margin: 0;
}

.card-image-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.card-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

.card-footer-action {
    margin-top: auto;
}

.watch-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1a2e45;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.watch-link:hover {
    opacity: 0.8;
    color: var(--primary);
}

/* Play Icon Style */
.watch-link i {
    fill: #1a2e45;
    color: white;
}

/* Pagination */
.pagination .page-link {
    border: none;
    color: var(--text-main);
    font-weight: 500;
    padding: 10px 16px;
    margin: 0 4px;
}

.pagination .page-item.active .page-link {
    background-color: transparent;
    color: black;
    font-weight: 700;
}

.pagination .page-link:hover {
    background-color: #f0f0f0;
    border-radius: 8px;
}

/* Footer */
footer {
    padding: 60px 0;
    font-size: 0.9rem;
}

footer h5 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

footer ul {
    list-style: none;
    padding: 0;
}

footer li {
    margin-bottom: 10px;
}

footer a {
    color: var(--text-sub);
    text-decoration: none;
}

footer a:hover {
    color: var(--primary);
}

/* View Toggle Active State */
.filter-bar .btn.active {
    background-color: var(--primary-light, #E6EFF9);
    color: var(--primary, #6487AF);
}

/* Base Card Styles (Grid View Default) */
.video-card {
    display: flex;
    flex-direction: column;
    padding: 30px;
    background: #F4F6F9;
    border-radius: 20px;
}

/* Grid View: Hide the "Visual Box" header aesthetics and just show content */
.card-visual-box {
    display: contents;
}

/* Hide specific visual-only elements in Grid */
.visual-header,
.play-overlay {
    display: none;
}

/* Hide summary in Grid View */
.video-summary {
    display: none;
}

/* In Grid: Re-order elements using Flexbox order */
/* New Grid Order: 
   1. Title/Desc (details-main) 
   2. Image (visual-image)
   3. Details/Tags (details-meta)
   4. Watch Link (visual-footer) 
*/

.video-card .card-details-box {
    display: contents;
}

.video-card .details-main {
    order: -2;
    /* Top */
    margin-bottom: 20px;
}

.video-card .card-visual-box .visual-image {
    order: 0;
    /* Middle */
    margin-bottom: 20px;
    width: 100%;
}

.video-card .card-visual-box .visual-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Show Details Meta in Grid */
.video-card .details-meta {
    display: flex;
    flex-direction: column;
    order: 1;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #e1e4e8;
}

.video-card .details-meta .duration-text {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 10px;
}

.video-card .details-meta .meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.video-card .card-visual-box .visual-footer {
    order: 2;
    margin-top: 15px;
}

/* List View Styles (Detailed) */
#video-grid.list-view .col-lg-4,
#video-grid.list-view .col-md-6,
#video-grid.list-view .col-12 {
    width: 100%;
}

#video-grid.list-view .col-12 {
    width: 100% !important;
    flex: 0 0 100%;
}

#video-grid.list-view .video-card {
    display: flex;
    flex-direction: row;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#video-grid.list-view .video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

/* Visual Box (Left Side) */
#video-grid.list-view .card-visual-box {
    width: 65%;
    min-height: 350px;
    background: linear-gradient(135deg, #f0f2f5 0%, #e6e9ed 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#video-grid.list-view .visual-header,
#video-grid.list-view .visual-footer {
    display: none;
}

#video-grid.list-view .visual-image {
    width: 100%;
    max-width: 550px;
    height: auto;
    object-fit: contain;
}

/* Details Box (Right Side) */
#video-grid.list-view .card-details-box {
    width: 65%;
    padding: 40px 40px 20px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#video-grid.list-view .details-main .card-title {
    font-size: 1.8rem;
    color: #1a2e45;
    margin-bottom: 15px;
}

#video-grid.list-view .details-main .card-desc {
    font-size: 1.1rem;
    color: #556b82;
    margin-bottom: 20px;
}

#video-grid.list-view .video-summary {
    display: block;
    margin-bottom: 20px;
    max-width: 90%;
}

#video-grid.list-view .details-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
    /* Reduced from auto to close gap */
}

#video-grid.list-view .duration-text {
    font-weight: 600;
    color: #4a5a6a;
    display: flex;
    align-items: center;
    gap: 5px;
}

#video-grid.list-view .duration-text::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a5a6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
}

#video-grid.list-view .details-meta .badge {
    background-color: #eef4fc !important;
    color: #2c5a85;
    font-weight: 600;
    padding: 8px 16px;
    font-size: 0.85rem;
    border: 1px solid rgba(44, 90, 133, 0.1);
}

/* Placeholder Thumbnail Styling */
.placeholder-thumbnail {
    width: 100%;
    min-height: 225px;
    background-color: #4a90e2;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.placeholder-thumbnail::before {
    display: none;
}

.placeholder-inner {
    background: white;
    width: 100%;
    height: 100%;
    min-height: 140px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.placeholder-thumbnail .placeholder-title {
    font-family: var(--bs-heading-font-family);
    font-size: 1.35rem;
    font-weight: 800;
    color: #4a90e2;
    margin: 0;
    line-height: 1.3;
}

.placeholder-icon {
    display: none;
}

#video-grid.list-view .placeholder-thumbnail {
    min-height: 300px;
    max-width: 60%;
    margin: 0 auto;
    background: transparent;
}

#video-grid.list-view .placeholder-inner {
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Skeleton Loading State */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    height: 100%;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.skeleton-shimmer {
    background: #f6f7f8;
    background-image: linear-gradient(to right,
            #f6f7f8 0%,
            #edeef1 20%,
            #f6f7f8 40%,
            #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 200% 100%;
    animation-duration: 1.5s;
    animation-fill-mode: forwards;
    animation-iteration-count: infinite;
    animation-name: shimmer;
    animation-timing-function: linear;
}

.skeleton-title {
    height: 24px;
    width: 70%;
    border-radius: 4px;
    margin-bottom: 15px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.skeleton-text {
    height: 16px;
    width: 90%;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-footer {
    margin-top: auto;
    height: 40px;
    width: 100%;
    border-top: 1px solid #eee;
    padding-top: 15px;
    display: flex;
    gap: 10px;
}

.skeleton-tag {
    height: 20px;
    width: 60px;
    border-radius: 10px;
}

#video-grid.list-view .skeleton-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 400px;
}

#video-grid.list-view .skeleton-image {
    width: 45%;
    height: 250px;
    margin-right: 0;
    margin-bottom: 0;
    order: 2;
}

#video-grid.list-view .skeleton-details {
    width: 50%;
    order: 1;
}

#video-grid.list-view .skeleton-tags {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* Video Detail View Styles */
#video-detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: radial-gradient(circle at 50% 40%, rgba(44, 90, 133, 0.95) 0%, rgba(18, 36, 61, 0.98) 100%);
    backdrop-filter: blur(10px);
    z-index: 9999;
    overflow-y: auto;
    padding-top: 40px;
}

#video-detail-view .container {
    padding-top: 20px;
}

#back-to-videos {
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

#back-to-videos:hover {
    opacity: 0.8;
}

.video-player-container {
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.detail-title {
    color: white;
    font-size: 2rem;
    font-family: var(--bs-heading-font-family);
}

.detail-description {
    font-size: 1.1rem;
    line-height: 1.6;
}

.detail-tags .badge {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 400;
    padding: 8px 16px;
}

/* Sidebar Styling */
.sidebar-container {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    height: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: sticky;
    top: 40px;
}

/* Accordion Customization to match design */
.accordion-button {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-dark);
    background: #f0f2f5;
    border-radius: 8px !important;
    margin-bottom: 10px;
}

.accordion-button:not(.collapsed) {
    background: #e6e9ed;
    color: var(--primary-dark);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
}

.accordion-item {
    background: transparent;
    border: none;
}

.accordion-body {
    padding: 0;
    background: white;
}

.sidebar-video-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    color: var(--text-main);
}

.sidebar-video-item:hover {
    background: #f8f9fa;
}

.sidebar-video-item.active {
    background: #eef4fc;
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-video-time {
    font-size: 0.85rem;
    color: var(--text-sub);
}

/* Responsive Adjustments for List View */
@media (max-width: 991px) {
    #video-grid.list-view .video-card {
        flex-direction: column;
        padding-bottom: 20px;
    }

    #video-grid.list-view .card-visual-box,
    #video-grid.list-view .card-details-box {
        width: 100%;
        padding: 20px;
        min-height: auto;
    }

    #video-grid.list-view .card-visual-box {
        min-height: 250px;
    }

    #video-grid.list-view .visual-image {
        max-width: 100%;
    }

    #video-grid.list-view .details-main .card-title {
        font-size: 1.4rem;
        margin-top: 15px;
    }

    #video-grid.list-view .details-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}