@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

* {
    margin: 0;
    padding: 0;
    scrollbar-width: none;
}

body {
        font-family: Roboto, Arial, sans-serif;
}

/*NAVIGATION BAR*/
.navbar {
    position: fixed;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    width: 100vw;
    height: 56px;
    padding: 0 16px;
    z-index: 3;
}
.navbar .logo {
    display: flex;
    align-items: center;
    margin-left: 8px;
}
.logo img {
    width: 100px;
    margin-left: 10px;
}
.navbar .searchbar {
    display: flex;
}

.search {
    display: flex;
    border: 1px solid #cccccc;
    border-radius: 15px;
    width: 600px;
    margin-right: 5px;
}
.search input {
    border: none;
    width: 90%;
    padding-left: 10px;
    border-radius: 15px;
}
.search button {
    border: none;
    border-left: 1px solid #cccccc;
    width: 10%;
    border-radius: 0 40px 40px 0;
}
.search button i {
    margin: 0;
}
.searchbar img {
    background-color: rgb(242,242,242);
    margin-right: 10px;
    border-radius: 20px;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

/*My Custom Feature: on hover effect, The record spins*/
.searchbar img:hover {
    animation: spin 0.6s linear forwards;
}
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.material-icons {
    margin-right: 10px;
    border-radius: 20px;
    padding: 5px;

}
.navigation-icons {
    display: flex;
    margin-right: 4rem;
    align-items: center;
    gap: 1.5rem;
}
.navigation-icons p {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgb(242,242,242);
    border-radius: 15px;
    gap: 0.2rem;
    padding: 0.5rem;
}
.picture img {
    margin-top: 0.2rem;
    padding: 0;
    cursor: pointer;
}

.tags {
    position: relative;
    left: 12%;
    background-color: white;
    width: 90%;
    padding: 1rem 6rem;
    
}
.tags .arrow {
    position: absolute;
    top: 20%;
    left: 77%;

    border-radius: 0.5rem;
    font-size: 20px;
    font-weight: bold;
    padding: 0.4rem 0.4rem;
    border: none;
    cursor: pointer;
}
.tags ul {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 80%;
    list-style: none;
    overflow-y: hidden;
    overflow-x: scroll;
    scrollbar-width: none;
}
.tags ul li {
    width: 10rem;
}
.all {
    background-color: black;
    border-radius: 0.5rem;
    font-size: 15px;
    padding: 0.4rem 0.6rem;
    border: none;
    color:white;
    cursor: pointer;
}
.tags ul li a {
    color: black;
    text-decoration: none;
    width: 10rem;
    padding: 0.4rem 0.9rem;
    background-color: rgb(242,242,242);
    border-radius: 0.5rem;
    font-weight: 500;
}

.arrow {
    background-color: rgb(242,242,242);
    padding: 0.4rem 0.9rem;
    border-radius: 0.5rem;
    border: none;
}

/*MAINBODY*/
.mainbody {
    height: calc(100vh - 56px);
    display: flex;
    padding-top: 4.2%;
    overflow-x: hidden;
    z-index: -1;
   
}

/*SIDEBAR*/
.categories {
    position: fixed;

    width: 240px;
    height: 100%;
    background: white;

    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
}
.categories:hover {
    scrollbar-width: thin;
}
.category {
    width: 100%;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 24px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
}
.category:hover {
    background: #f9f9f9;
}
.subscriptions {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    
}
.category i, .category img, .category span {
    margin-right: 24px;
}
.category-section {
  border-bottom: 1px solid rgb(153, 153, 153);
  padding: 15px 0;
}
.category-section span i {
    font-size: 1.5rem;
} 
.hidden {
    display: none
}
.category_heading {
    padding: 6px 24px;
    font-size: 16px;
    font-weight: 500;
}
.cagories-footer {
    padding: 25px;
}
.footer-section {
    margin-bottom: 12px;
}
.footer-section span {
    font-size: 13px;
    font-weight: 500;
    margin-right: 5px;
    color: #606060;
    cursor: pointer;
}
.copyright {
    display: block;
    padding: 12px 4px;
    color: #606060;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 20px;
}

/*Video Grid Section*/
.videos {
    position: relative;
    top: 10%;
    left: 19%;
    z-index: -1;
    scrollbar-width: none;
    
    width: calc(100vw - 100px);
    height: 100%;
    background: #f9f9f9;
    z-index: 0;
}
.video-grid {
    margin: 10px;
    display: flex;

    flex-flow: wrap;
    gap: 1rem;
}
.video {
    padding: 0.5rem;
    background: white;
    width: 25vw;
    transition: background-color 0.5s ease;
}
.video:hover, .short-video-container:hover {
    background-color: rgb(255, 221, 228);
    border-radius: 5px;
} 
.video .thumbnail {
    padding: 0.2rem;
    transition: background-color 0.3s ease;
}
.thumbnail img, .thumbnail iframe{
    width: 100%;
    border-radius: 0.5rem; 
}
.thumbnail iframe {
    height: 31vh;
}

.videos .details {
    display: flex;
    transition: background-color 0.3s ease;
}
.profile img {
    width: 35px;
    height: 35px;
    padding: 0.2rem;
    border-radius: 50%;
}
.video-title {
    padding: 0.2rem;

}
.video-title-container p, .video-title p {
    font-weight: 600;
}
.name p {
    margin-top: 0.4rem;
    font-size: 0.9rem;
}
.name p span, .name span {
    font-weight: initial;
    color: grey;
}
.creator {
    font-weight: 500;
    color: grey
}

/*Ad Sections*/
.ad-buttons {
    padding: 0;
    text-align: center;
    transition: background-color 0.3s ease;
}
.ad-buttons button {
    margin-top: 0.5rem;
    padding: 0.5rem 3.3rem;
    border: none;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 700;
}
.visit {
    background-color: black;
    color: white;
}

/*Short Videos*/
#shorts {
    width: 100%;             /* span the full content area */
    margin: 1rem 0;          /* spacing before/after section */
}
.short-header {
    display: flex;
    align-items: center;
    margin: 0.5rem;
    gap: 0.5rem;
}
.short-videos {
    display: flex;
    align-items: flex-start;
    gap: 1rem;              /* flex gap generates space between cards */
    overflow-x: auto;       /* allow horizontal scrolling like YouTube */
    flex-wrap: nowrap;      /* keep items on a single row */
    padding: 0.5rem;        /* breathing room around row */
    scroll-behavior: smooth;
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* IE and Edge */
}
.short-videos::-webkit-scrollbar {
    display: none;
}
.short-video-container {
    flex: 0 0 auto;         /* fixed-width flex item */
    width: 200px;           /* match video element width */
    display: flex;
    flex-direction: column;
}
.short-video {
    padding: 0;
    border-radius: 30px;
}
.short-video video source {
    border-radius: 10px;
}
.short-video-details {
    display: flex;
    margin-left: 1rem;
}
.short-video-details span {
    overflow-x: hidden;
    text-overflow: ellipsis;
}
.detail {
    width: 10rem;
    overflow-x: hidden;
    scrollbar-width: none;
}

/* ========== NEW: Theme transition (smooth dark/light switch) ========== */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== NEW: Dark mode – CSS-only via checkbox (body:has(#theme-checkbox:checked)) ========== */
body:has(#theme-checkbox:checked) {
    background-color: #0f0f0f;
    color: #f1f1f1;
}
body:has(#theme-checkbox:checked) .navbar {
    background-color: #212121;
    transition: all 0.3s ease;
}
body:has(#theme-checkbox:checked) .tags {
    background-color: #212121;
    transition: all 0.3s ease;
}
body:has(#theme-checkbox:checked) .tags ul li a {
    color: #f1f1f1;
    background-color: #3f3f3f;
}
body:has(#theme-checkbox:checked) .arrow {
    background-color: #3f3f3f;
    color: #f1f1f1;
}
body:has(#theme-checkbox:checked) .categories {
    background-color: #212121;
    transition: all 0.3s ease;
}
body:has(#theme-checkbox:checked) .category:hover {
    background: #3f3f3f;
}
body:has(#theme-checkbox:checked) .category_heading {
    color: #f1f1f1;
}
body:has(#theme-checkbox:checked) .footer-section span,
body:has(#theme-checkbox:checked) .copyright {
    color: #aaaaaa;
}
body:has(#theme-checkbox:checked) .videos {
    background: #181818;
    transition: all 0.3s ease;
}
body:has(#theme-checkbox:checked) .video {
    background-color: #212121;
    transition: all 0.3s ease;
}
body:has(#theme-checkbox:checked) .video:hover {
    background-color: #3f3f3f;
}
body:has(#theme-checkbox:checked) .name p span,
body:has(#theme-checkbox:checked) .name span,
body:has(#theme-checkbox:checked) .creator {
    color: #aaaaaa;
}
body:has(#theme-checkbox:checked) .navigation-icons p {
    background-color: #3f3f3f;
    color: #f1f1f1;
}
body:has(#theme-checkbox:checked) .search {
    border-color: #3f3f3f;
    background-color: #121212;
}
body:has(#theme-checkbox:checked) .search input {
    background-color: #121212;
    color: #f1f1f1;
}
body:has(#theme-checkbox:checked) .search button {
    border-left-color: #3f3f3f;
    background-color: #121212;
    color: #f1f1f1;
}
body:has(#theme-checkbox:checked) .searchbar img {
    background-color: #3f3f3f;
}

/* ========== NEW: Theme toggle (label styled as button); show moon in light, sun in dark ========== */
.theme-toggle {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.08);
}
body:has(#theme-checkbox:checked) .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.theme-toggle .material-icons {
    font-size: 24px;
    margin-right: 0;
}
.theme-toggle .icon-light {
    display: none;
}
body:has(#theme-checkbox:checked) .theme-toggle .icon-dark {
    display: none;
}
body:has(#theme-checkbox:checked) .theme-toggle .icon-light {
    display: block;
}

/* ========== NEW: Skeleton loading – CSS-only: shimmer + hide after 1.5s, show video grid ========== */
.skeleton-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 10px;
    display: flex;
    flex-flow: wrap;
    gap: 1rem;
    z-index: 1;
    animation: hide-skeleton 0.3s ease-in 1.5s forwards;
}
@keyframes hide-skeleton {
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}
.video-grid {
    opacity: 0;
    animation: show-video-grid 0.3s ease-out 1.5s forwards;
}
@keyframes show-video-grid {
    to {
        opacity: 1;
    }
}
.skeleton-card {
    padding: 0.5rem;
    background: #e0e0e0;
    width: 25vw;
    border-radius: 5px;
    transition: all 0.3s ease;
}
body:has(#theme-checkbox:checked) .skeleton-card {
    background: #2a2a2a;
}
.skeleton-thumb {
    display: block;
    width: 100%;
    height: 31vh;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
body:has(#theme-checkbox:checked) .skeleton-thumb {
    background: linear-gradient(90deg, #3a3a3a 25%, #454545 50%, #3a3a3a 75%);
    background-size: 200% 100%;
}
.skeleton-details {
    display: flex;
    align-items: flex-start;
    margin-top: 0.5rem;
    gap: 0.5rem;
}
.skeleton-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, #e0e0e0 25%, #eee 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
body:has(#theme-checkbox:checked) .skeleton-avatar {
    background: linear-gradient(90deg, #3a3a3a 25%, #454545 50%, #3a3a3a 75%);
    background-size: 200% 100%;
}
.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.skeleton-line {
    display: block;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0 25%, #eee 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 2s ease-in-out infinite;
}
.skeleton-line.short {
    width: 60%;
}
body:has(#theme-checkbox:checked) .skeleton-line {
    background: linear-gradient(90deg, #3a3a3a 25%, #454545 50%, #3a3a3a 75%);
    background-size: 200% 100%;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton responsive: match video grid at same breakpoints (unchanged layout) */
@media (max-width: 720px) {
    .skeleton-grid {
        flex-direction: column;
        width: 100%;
        margin-top: 2rem;
        padding: 0;
    }
    .skeleton-card {
        width: 100%;
    }
    .skeleton-thumb {
        height: 15vh;
    }
}
@media (min-width: 721px) and (max-width: 1024px) {
    .skeleton-card {
        width: 42vw;
    }
    .skeleton-thumb {
        height: 15vh;
    }
}