/* === CSS Variables === */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #212121;
    --bg-hover: #2a2a2a;
    --bg-input: #121212;
    --text-primary: #f1f1f1;
    --text-secondary: #aaaaaa;
    --text-muted: #717171;
    --border-color: #303030;
    --accent: #3ea6ff;
    --accent-hover: #65b8ff;
    --danger: #cc0000;
    --success: #2ba640;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent-hover);
}

/* === Header === */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    align-items: center;
    padding: 0 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

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

.header__logo a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
}

.header__hamburger-logo {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: opacity var(--transition);
}
.header__hamburger-logo:hover {
    opacity: 1;
}

.header__yt-logo {
    height: 28px;
    width: auto;
}

.header__company-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.header__company-name:hover {
    color: var(--accent);
}

.brand-container {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* === Search === */
.search {
    display: flex;
    justify-content: center;
}

.search form {
    display: flex;
    width: 100%;
    max-width: 540px;
}

#search__input {
    flex: 1;
    padding: 8px 16px;
    font-size: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition);
}
#search__input:focus {
    border-color: var(--accent);
}
#search__input::placeholder {
    color: var(--text-muted);
}

.search__icon {
    height: 36px;
    width: 48px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--transition);
}
.search__icon:hover {
    opacity: 1;
}

/* === Header Icons === */
.header__icons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.header__icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    transition: background var(--transition);
}
.header__icons a:hover {
    background: var(--bg-hover);
}

.header__icons--upload,
.header__icons--bell,
.header__icons--grid {
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.header__icons--profile {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.login-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    width: auto !important;
}
.login-btn:hover {
    background: rgba(62, 166, 255, 0.1);
}

/* === Layout === */
.wrapper {
    padding-top: 56px;
    min-height: 100vh;
}

.main-wrapper {
    display: grid;
    grid-template-columns: 1fr minmax(0, 1400px) 1fr;
    padding: 24px 0;
}

main {
    grid-column: 2;
    display: grid;
    grid-gap: 24px;
    grid-template-columns: 1fr 380px;
    grid-template-areas: "video aside" "section aside";
    padding: 0 24px;
}

/* === Video Section === */
.main__video {
    grid-area: video;
}

.main__video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.main__video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.main__video,
section {
    font-size: 14px;
}

/* === Description === */
.main__description {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.main__description p {
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.main__name {
    margin-bottom: 12px;
}
.main__name h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.main__subscriptions {
    float: right;
}

/* === Sub Info === */
.main__sub-description {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.main__sub-description p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.main__more {
    margin-top: 8px;
}
.main__more a {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* === Comments Section === */
section {
    grid-area: section;
}

.section__comments {
    width: 100%;
}

.section__sort-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}
.section__sort-container p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.section__profile {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.input__container {
    margin-bottom: 24px;
}

.input__container input {
    width: 100%;
    padding: 8px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition);
}
.input__container input:focus {
    border-bottom-color: var(--accent);
}
.input__container input::placeholder {
    color: var(--text-muted);
}

/* === Comment Items === */
.comments {
    margin-bottom: 16px;
}

.comments p,
.comments a {
    margin: 0;
}

.comments__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.comments__name a {
    color: var(--text-primary);
}

.comments__comment {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.likes {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.comments__text {
    color: var(--text-secondary);
}

.comments__replies {
    color: var(--accent);
    font-weight: 500;
    cursor: pointer;
}
.comments__replies:hover {
    color: var(--accent-hover);
}

/* === Sidebar === */
aside {
    grid-area: aside;
}

.first-img-aside img {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    object-fit: cover;
    aspect-ratio: 16/9;
}

.aside__top-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
}
.aside__top-container p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.aside__top-container a {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.aside__video {
    padding: 8px 0;
}

.aside__video a {
    display: flex;
    gap: 12px;
    text-decoration: none;
    padding: 8px 0;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.aside__video a:hover {
    background: var(--bg-hover);
}

.aside__video img {
    width: 168px;
    height: 94px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.aside__video .aside__info {
    flex: 1;
    min-width: 0;
}

.aside__video .aside__title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.aside__video .aside__meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.aside__more {
    width: 100%;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 12px;
    text-align: center;
    border-radius: var(--radius-sm);
    margin-top: 16px;
    transition: background var(--transition);
    cursor: pointer;
}
.aside__more:hover {
    background: var(--bg-hover);
}
.aside__more a {
    color: var(--text-secondary);
    text-decoration: none;
}

/* === Responsive === */
@media only screen and (max-width: 1002px) {
    header {
        grid-template-columns: auto 1fr auto;
        padding: 0 12px;
    }
    .search form {
        max-width: 100%;
    }
    main {
        grid-template-columns: 1fr;
        grid-template-areas: "video" "aside" "section";
        padding: 0 16px;
    }
    aside {
        width: 100%;
    }
}

@media only screen and (max-width: 640px) {
    header {
        grid-template-columns: 40px 1fr auto;
        gap: 8px;
    }
    .header__company-name {
        display: none;
    }
    .search__icon {
        width: 40px;
    }
    main {
        padding: 0 12px;
    }
    .aside__video a {
        flex-direction: column;
    }
    .aside__video img {
        width: 100%;
        height: auto;
    }
}
