/* CSS Variables for YouTube-like design */
:root {
    --yt-bg: #0f0f0f;
    --yt-header-bg: #0f0f0f;
    --yt-sidebar-bg: #0f0f0f;
    --yt-text-primary: #ffffff;
    --yt-text-secondary: #aaaaaa;
    --yt-border: #3f3f3f;
    --yt-hover: #272727;
    --yt-red: #ff0000;
    --yt-blue: #3ea6ff;
    --header-height: 56px;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 72px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--yt-bg);
    color: var(--yt-text-primary);
    font-family: "Roboto", Arial, sans-serif;
    overflow-x: hidden;
}

/* Layout */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    height: var(--header-height);
    background-color: var(--yt-header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

.menu-btn:hover {
    background-color: var(--yt-hover);
}

.logo {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
    font-size: 20px;
    letter-spacing: -1px;
    cursor: pointer;
}

.logo span {
    color: var(--yt-red);
    font-size: 24px;
}

.header-center {
    flex: 0 1 720px;
    display: flex;
    align-items: center;
}

.search-container {
    display: flex;
    width: 100%;
    background-color: #121212;
    border: 1px solid var(--yt-border);
    border-radius: 40px 0 0 40px;
    padding: 0 16px;
    margin-left: 32px;
}

.search-container input {
    width: 100%;
    background: none;
    border: none;
    color: white;
    padding: 8px 0;
    font-size: 16px;
    outline: none;
}

.search-btn {
    background-color: var(--yt-hover);
    border: 1px solid var(--yt-border);
    border-left: none;
    border-radius: 0 40px 40px 0;
    padding: 0 20px;
    cursor: pointer;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
}

.icon-btn:hover {
    background-color: var(--yt-hover);
}

.profile-pic {
    width: 32px;
    height: 32px;
    background-color: #7e57c2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-left: 8px;
    cursor: pointer;
    overflow: hidden;
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Authentication UI in Header */
.login-btn-top {
    color: var(--yt-blue);
    border: 1px solid var(--yt-border);
    background: none;
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.login-btn-top:hover {
    background-color: #263850;
    border-color: transparent;
}

/* Main Content Area */
.main-wrapper {
    display: flex;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

/* Sidebar */
aside {
    width: var(--sidebar-width);
    background-color: var(--yt-sidebar-bg);
    overflow-y: auto;
    padding: 12px 0;
    transition: width 0.2s;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 24px;
    cursor: pointer;
    border-radius: 10px;
    margin: 0 12px;
}

.sidebar-item:hover {
    background-color: var(--yt-hover);
}

.sidebar-item.active {
    background-color: var(--yt-hover);
    font-weight: bold;
}

.sidebar-item i {
    font-size: 20px;
}

.sidebar-divider {
    height: 1px;
    background-color: var(--yt-border);
    margin: 12px 0;
}

/* Content */
main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Category Tags */
.tags-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    position: sticky;
    top: -24px;
    background-color: var(--yt-bg);
    padding: 12px 0;
    z-index: 100;
}

.tag {
    background-color: var(--yt-hover);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.tag.active {
    background-color: white;
    color: black;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.video-card {
    cursor: pointer;
}

.thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1e1e1e, #333);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
}

.video-card:hover .thumbnail {
    transform: scale(1.02);
    border-radius: 0;
}

.thumbnail-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.video-info {
    display: flex;
    gap: 12px;
}

.channel-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--yt-hover);
    flex-shrink: 0;
}

.details {
    flex: 1;
}

.title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meta {
    font-size: 14px;
    color: var(--yt-text-secondary);
}

/* Dropdown Menus */
.dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0px;
    background-color: #282828;
    border-radius: 12px;
    width: 280px;
    display: none;
    flex-direction: column;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--yt-border);
    margin-bottom: 8px;
}

.dropdown-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: var(--yt-hover);
}

/* Video Player View */
#video-player-view {
    padding: 0 24px;
}

.player-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.main-player h2 {
    margin: 16px 0 8px 0;
    font-size: 20px;
}

.video-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
}

.player-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subscribe-btn {
    background-color: white;
    color: black;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 12px;
    transition: background-color 0.2s;
}

.subscribe-btn.subscribed {
    background-color: var(--yt-hover);
    color: white;
}

.player-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background-color: var(--yt-hover);
    border: none;
    color: white;
    padding: 6px 16px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.action-btn.active {
    background-color: var(--yt-border);
}

.description-box {
    background-color: var(--yt-hover);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 24px;
}

#active-video-desc {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.comment-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.comment-input-area input {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 1px solid var(--yt-border);
    color: white;
    padding: 8px 0;
    outline: none;
}

/* Related Videos Side */
.related-videos {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-video-card {
    display: flex;
    gap: 8px;
    cursor: pointer;
}

.sidebar-thumbnail {
    width: 168px;
    height: 94px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    padding: 8px;
    text-align: center;
}

.sidebar-info .title {
    font-size: 14px;
    margin-bottom: 2px;
}

.sidebar-info .meta {
    font-size: 12px;
}

/* Overlays (Modal Base) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.overlay.show {
    display: flex;
}

.modal-content {
    background-color: #282828;
    color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    overflow: hidden;
}

/* Voice Search UI */
.voice-content {
    text-align: center;
    color: white;
}

.voice-status {
    font-size: 24px;
    margin-bottom: 40px;
}

.voice-wave {
    display: flex;
    justify-content: center;
    gap: 10px;
    height: 60px;
}

.voice-wave span {
    width: 4px;
    height: 100%;
    background-color: var(--yt-red);
    animation: wave 1.2s infinite ease-in-out;
}

.voice-wave span:nth-child(2) {
    animation-delay: 0.1s;
}

.voice-wave span:nth-child(3) {
    animation-delay: 0.2s;
}

.voice-wave span:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes wave {

    0%,
    100% {
        transform: scaleY(0.3);
    }

    50% {
        transform: scaleY(1);
    }
}

/* Upload Modal UI */
.upload-modal {
    padding: 24px;
}

.upload-modal h2 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--yt-text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background-color: #1a1a1a;
    border: 1px solid var(--yt-border);
    border-radius: 4px;
    color: white;
    padding: 12px;
    font-size: 16px;
}

.form-group textarea {
    height: 100px;
    resize: none;
}

.upload-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 4000;
}

.toast {
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Profile Icon specifically for Google Auth */
#g_id_signin {
    margin-right: 8px;
}

@media (max-width: 1000px) {
    .player-container {
        grid-template-columns: 1fr;
    }
}