/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: #0f0f0f;
    color: #f1f1f1;
    min-height: 100vh;
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 56px;
    background-color: #0f0f0f;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid #2a2a2a;
}

/* Left Section */
.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px;
}

.hamburger {
    width: 24px;
    height: 2px;
    background-color: #f1f1f1;
    border-radius: 2px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.logo-icon {
    width: 32px;
    height: 24px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.logo-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Center Section */
.nav-center {
    flex: 1;
    max-width: 640px;
    display: flex;
    justify-content: center;
}

.search-container {
    display: flex;
    width: 100%;
    max-width: 580px;
}

.search-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    background-color: #121212;
    border: 1px solid #303030;
    border-radius: 40px 0 0 40px;
    color: #f1f1f1;
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: #3ea6ff;
}

.search-input::placeholder {
    color: #888;
}

.search-btn {
    width: 64px;
    height: 40px;
    background-color: #222;
    border: 1px solid #303030;
    border-left: none;
    border-radius: 0 40px 40px 0;
    cursor: pointer;
    font-size: 16px;
}

.search-btn:hover {
    background-color: #333;
}

/* Right Section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: #272727;
}

.btn-icon {
    font-size: 20px;
}

/* --- CREATE BUTTON STYLES (UPDATED) --- */
.create-btn {
    width: auto;
    padding: 0 12px;
    border-radius: 20px;
    gap: 8px;
    /* Always show a subtle "active" background to indicate it's interactive */
    background-color: #272727; 
    transition: all 0.2s ease;
}

/* Force Create Button Text and Icon to White */
.create-btn .btn-text,
.create-btn .btn-icon {
    color: #ffffff !important;
}

/* Special Hover Effect: Brighter background + slight scale up */
.create-btn:hover {
    background-color: #3a3a3a;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Active click effect */
.create-btn:active {
    transform: scale(0.98);
}

/* --------------------------------------- */

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background-color: #cc0000;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f0f0f;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3ea6ff, #0066cc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* Dropdown Styles */
.dropdown {
    position: absolute;
    top: 56px;
    right: 0;
    background-color: #272727;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    min-width: 280px;
    display: none;
    z-index: 1001;
}

.dropdown.active {
    display: block;
}

/* ADD SPACING TO RIGHT-SIDE DROPDOWNS */
.create-dropdown {
    right: 8px;
    min-width: 240px;
}

.notification-dropdown {
    right: 8px;
    min-width: 360px;
}

/* PROFILE DROPDOWN - NO SCROLLING, ALL ITEMS VISIBLE */
.profile-dropdown {
    right: 8px;
    min-width: 320px;
    max-height: none !important;
    overflow-y: visible !important;
    padding: 8px 0;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #3a3a3a;
}

.header-text {
    font-size: 16px;
    font-weight: 500;
}

.settings-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 50%;
}

.settings-link:hover {
    background-color: #3a3a3a;
}

.dropdown-divider {
    height: 1px;
    background-color: #3a3a3a;
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #3a3a3a;
}

.item-icon {
    font-size: 18px;
    width: 24px;
}

.item-text {
    font-size: 14px;
}

/* Notification Items */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.notification-item:hover {
    background-color: #3a3a3a;
}

.channel-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-time {
    font-size: 12px;
    color: #aaa;
}

.notification-thumbnail {
    width: 120px;
    height: 68px;
    border-radius: 8px;
    background: linear-gradient(135deg, #333, #444);
    flex-shrink: 0;
    position: relative;
}

.notification-menu {
    position: absolute;
    top: 8px;
    right: 8px;
}

.menu-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: #aaa;
}

.menu-trigger:hover {
    background-color: #3a3a3a;
}

.menu-options {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #272727;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    display: none;
    z-index: 1002;
}

.menu-options.active {
    display: block;
}

.menu-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
}

.menu-option:hover {
    background-color: #3a3a3a;
}

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background-color: #0f0f0f;
    padding: 12px 0;
    transition: transform 0.3s ease;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 999;
}

.sidebar.collapsed {
    transform: translateX(-240px);
}

.sidebar-content {
    padding: 0 12px;
}

.sidebar-section {
    margin-bottom: 12px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    color: #aaa;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-header:hover {
    background-color: #272727;
    border-radius: 8px;
}

.section-title {
    font-weight: 500;
}

.expand-icon {
    font-size: 12px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 12px;
    color: #f1f1f1;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s;
    font-size: 14px;
}

.sidebar-item:hover {
    background-color: #272727;
}

.sidebar-item.active {
    background-color: #272727;
    font-weight: 500;
}

.sidebar-item .item-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-item .channel-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-divider {
    height: 1px;
    background-color: #2a2a2a;
    margin: 12px 0;
}

/* UPDATED: Default to BLOCK so menus are open by default */
.sidebar-submenu {
    display: block; 
    margin-top: 4px;
}

/* Class to hide if toggled closed */
.sidebar-submenu.hidden {
    display: none;
}

/* Main Content */
.main-content {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

.content-area {
    flex: 1;
    padding: 24px;
    background-color: #0f0f0f;
    margin-left: 240px;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .content-area {
    margin-left: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-center {
        display: none;
    }
    
    .create-btn .btn-text {
        display: none;
    }
    
    .create-btn {
        width: 40px;
        height: 40px;
        padding: 0;
    }
    
    .sidebar {
        transform: translateX(-240px);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content-area {
        margin-left: 0;
    }
}

/* Home feed content */
.content-area {
    min-width: 0;
    padding: 0 24px 48px;
}

.feed-content {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

.topic-filter {
    position: sticky;
    top: 56px;
    z-index: 20;
    display: flex;
    gap: 12px;
    padding: 12px 0;
    overflow-x: auto;
    scrollbar-width: none;
    background: #0f0f0f;
}

.topic-filter::-webkit-scrollbar,
.shorts-track::-webkit-scrollbar {
    display: none;
}

.topic-chip {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 13px;
    border: 0;
    border-radius: 8px;
    background: #272727;
    color: #f1f1f1;
    font: 500 14px/32px 'Roboto', Arial, sans-serif;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.topic-chip:hover {
    background: #3f3f3f;
}

.topic-chip.active {
    background: #f1f1f1;
    color: #0f0f0f;
}

.video-grid,
.continue-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 38px 16px;
    padding: 12px 0 38px;
}

.feed-card {
    min-width: 0;
}

.thumbnail-link {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #272727;
}

.thumbnail-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .35s ease, filter .35s ease;
}

.feed-card:hover .thumbnail-link img {
    transform: scale(1.025);
    filter: brightness(.88);
}

.duration,
.live-badge {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 3px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .8);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.live-badge {
    right: auto;
    left: 6px;
    padding: 4px 6px;
    background: #f00;
    font-weight: 700;
    letter-spacing: .4px;
}

.watch-progress {
    --progress: 0%;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: linear-gradient(to right, #f00 var(--progress), rgba(255,255,255,.45) var(--progress));
}

.card-details {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 28px;
    gap: 12px;
    padding-top: 12px;
}

.card-details.compact {
    grid-template-columns: minmax(0, 1fr) 28px;
}

.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.avatar-amber { background: linear-gradient(145deg, #e0a22a, #7c4314); }
.avatar-violet { background: linear-gradient(145deg, #9d75ff, #3b246f); }
.avatar-blue { background: linear-gradient(145deg, #45a6e8, #183d83); }
.avatar-red { background: linear-gradient(145deg, #ec4141, #7c1616); }
.avatar-green { background: linear-gradient(145deg, #48a86b, #164d2b); }
.avatar-orange { background: linear-gradient(145deg, #fa8334, #793311); }

.card-copy {
    min-width: 0;
}

.card-title,
.short-title {
    display: -webkit-box;
    overflow: hidden;
    color: #f1f1f1;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.channel-name,
.card-meta {
    color: #aaa;
    font-size: 14px;
    line-height: 1.45;
}

a.channel-name {
    display: block;
    margin-top: 6px;
    text-decoration: none;
}

a.channel-name:hover {
    color: #f1f1f1;
}

.card-meta span {
    margin: 0 2px;
}

.verified {
    display: inline-grid;
    width: 13px;
    height: 13px;
    place-items: center;
    border-radius: 50%;
    background: #aaa;
    color: #0f0f0f;
    font-size: 9px;
    font-weight: 700;
}

.card-menu-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #f1f1f1;
    font-size: 22px;
    line-height: 22px;
    cursor: pointer;
    opacity: 0;
}

.feed-card:hover .card-menu-btn,
.card-menu-btn:focus-visible {
    opacity: 1;
}

.card-menu-btn:active {
    background: #3f3f3f;
}

.feed-shelf {
    padding: 24px 0 38px;
    border-top: 4px solid #272727;
}

.shelf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.shelf-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
}

.shorts-mark {
    width: 24px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px 4px;
    background: #f00;
    color: white;
    font-size: 11px;
}

.shelf-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shelf-arrow,
.dismiss-shelf {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #f1f1f1;
    font-size: 30px;
    cursor: pointer;
}

.dismiss-shelf {
    font-size: 28px;
}

.shelf-arrow:hover,
.dismiss-shelf:hover {
    background: #272727;
}

.shorts-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 180px;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.short-card {
    width: 180px;
    max-width: 180px;
    min-width: 180px;
    scroll-snap-align: start;
}

.short-card > a:first-child {
    display: block;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 12px;
    background: #272727;
}

.short-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .3s ease;
}

.short-card:hover img {
    transform: scale(1.03);
}

.short-title {
    margin-top: 10px;
}

.short-card p {
    margin-top: 5px;
    color: #aaa;
    font-size: 14px;
}

.play-all {
    height: 36px;
    padding: 0 15px;
    border: 1px solid #3f3f3f;
    border-radius: 18px;
    background: transparent;
    color: #f1f1f1;
    font-weight: 500;
    cursor: pointer;
}

.play-all:hover {
    background: #272727;
}

.continue-grid {
    padding: 0;
}

.video-context-menu {
    position: fixed;
    z-index: 1500;
    width: 270px;
    display: none;
    padding: 8px 0;
    border-radius: 12px;
    background: #282828;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
}

.video-context-menu.active {
    display: block;
}

.video-context-menu button {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    color: #f1f1f1;
    font-size: 17px;
    cursor: pointer;
    text-align: left;
}

.video-context-menu button span {
    font-size: 14px;
}

.video-context-menu button:hover {
    background: #3f3f3f;
}

.video-context-menu hr {
    height: 1px;
    margin: 8px 0;
    border: 0;
    background: #3f3f3f;
}

.feed-loader {
    display: flex;
    justify-content: center;
    gap: 7px;
    padding: 24px;
}

.feed-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #aaa;
    animation: feed-pulse 1.2s infinite ease-in-out;
}

.feed-loader span:nth-child(2) { animation-delay: .15s; }
.feed-loader span:nth-child(3) { animation-delay: .3s; }

@keyframes feed-pulse {
    0%, 70%, 100% { opacity: .25; transform: scale(.75); }
    35% { opacity: 1; transform: scale(1); }
}

@media (min-width: 1600px) {
    .video-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .shorts-track {
        grid-auto-columns: 200px;
    }

    .short-card {
        width: 200px;
        max-width: 200px;
        min-width: 200px;
    }
}

@media (max-width: 1120px) {
    .video-grid,
    .continue-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 0 12px 40px;
    }

    .topic-filter {
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .video-grid,
    .continue-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .shorts-track {
        grid-auto-columns: 150px;
    }

    .short-card {
        width: 150px;
        max-width: 150px;
        min-width: 150px;
    }

    .shelf-header h2 {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thumbnail-link img,
    .short-card img,
    .shorts-track {
        transition: none;
        scroll-behavior: auto;
    }

    .feed-loader span {
        animation: none;
    }
}