/* --- Global & Theme Variables --- */
:root {
    --bg-black: #050505;
    --bg-matte: #111111;
    --border-color: rgba(255, 255, 255, 0.08);
    --royal-blue: #1d4ed8;
    --blue-glow: rgba(29, 78, 216, 0.4);
    --text-dim: #94a3b8;
    --sidebar-width: 260px;
    --navbar-height: 80px;
    --bezier: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Layout --- */
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-black);
    font-family: 'Inter', sans-serif;
    color: white;
    overflow-x: hidden;
}

/* Background Canvas - Background එකක් විදිහට පවතී */
#binaryCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Main Content Area - Sidebar එකට සහ Navbar එකට ඉඩ තබයි */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    padding-left: 30px;
    padding-right: 30px;
    padding-bottom: 50px;
    min-height: 100vh;
    box-sizing: border-box;
    display: block;
    position: relative;
    z-index: 1;
}

/* Card Grid - Cards පේළියට තබා ගැනීම */
.card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-items: flex-start;
}

/* --- Dynamic Card Styling --- */
.dynamic-card {
    background: var(--bg-matte);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    width: 260px; /* Compact size */
    transition: all 0.3s var(--bezier);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.dynamic-card:hover {
    border-color: var(--royal-blue);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

/* Meta Info (Channel Name & Date) */
.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.date-text {
    color: var(--text-dim);
    font-size: 11px;
}

/* Thumbnail Section */
.media-thumb {
    position: relative;
    width: 100%;
    height: 145px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 15px;
    background: #000;
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.dynamic-card:hover .media-thumb img {
    transform: scale(1.08);
}

/* Play Overlay */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: 0.3s;
}

.dynamic-card:hover .play-overlay {
    opacity: 1;
    background: var(--royal-blue);
    box-shadow: 0 0 15px var(--blue-glow);
}

/* Typography (Title & Description) */
.dynamic-card h3 {
    color: #ffffff;
    font-size: 14px;
    margin: 0 0 10px 0;
    line-height: 1.4;
    font-weight: 600;
    /* Title එක පේළි 2කට සීමා කිරීම */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.placeholder-meta {
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.5;
    margin: 0 0 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Description එක පේළි 3කට සීමා කිරීම */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.see-more-btn {
    color: var(--royal-blue);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
    align-self: flex-start;
}

.see-more-btn:hover {
    text-shadow: 0 0 10px var(--blue-glow);
    letter-spacing: 0.5px;
}

/* Mobile Devices (පෝන් එකෙන් බලන අයට) */
@media (max-width: 800px) {
    .main-content {
        margin-left: 0 !important;
        padding-top: 100px; /* Navbar එකට යට නොවෙන්න */
        padding-left: 10px;
        padding-right: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .card-grid {
        display: flex;
        flex-direction: column; 
        align-items: center;    
        gap: 20px;
        width: 100%;
    }

    .dynamic-card {
        width: 95% !important;
        max-width: 400px;
        margin: 0 auto;
        padding: 12px !important;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
    }

    /* --- Thumbnail එක මෙතනින් හරිගස්සමු --- */
    .media-thumb {
        width: 100% !important;
        height: auto !important; /* Fixed height එක අයින් කළා */
        aspect-ratio: 16 / 9;    /* YouTube ratio එකටම හැදුවා */
        margin-bottom: 12px;
        border-radius: 10px;
        overflow: hidden;
        background: #000;
    }

    .media-thumb img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important; /* 'cover' වෙනුවට 'contain' දැම්මොත් මුළු රූපයම පෙනේවි */
        display: block;
    }
}

.main-content {
    margin-left: 260px;  /* Sidebar එකේ පළල අනුව මේක වෙනස් කරන්න */
    padding-top: 100px;  /* මෙන්න මේකෙන් තමයි Card ටික උඩට ගන්නේ */
    display: block;
    position: relative;
}