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

:root {
    --blue: #2AABEE;
    --blue-dark: #229ED9;
    --blue-light: #E8F4FD;
    --bg: #F7F8FA;
    --white: #FFFFFF;
    --text: #1A1A2E;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.95);
}

.header__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    flex-shrink: 0;
}

.header__logo svg { color: var(--blue); }
.header__logo:hover { color: var(--text); }

.header__nav {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

.header__link {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    transition: color var(--transition);
}

.header__link:hover {
    color: var(--text);
}

.header__search {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 0 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.header__search:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(42,171,238,0.15);
}

.header__search input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    padding: 8px 4px;
    width: 100%;
    font-family: inherit;
    color: var(--text);
}

.header__search input::placeholder { color: var(--text-secondary); }

.header__search button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    padding: 4px;
    transition: color var(--transition);
}

.header__search button:hover { color: var(--blue); }

/* Search wrapper & dropdown */
.header__search-wrap {
    position: relative;
    flex: 0 1 320px;
}

.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
}

.search-dropdown.is-open { display: block; }

.search-dropdown.is-open { display: block; }

.search-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    transition: background var(--transition);
}

.search-dropdown__item:hover,
.search-dropdown__item.is-active {
    background: var(--bg);
    color: var(--text);
}

.search-dropdown__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}

.search-dropdown__info { flex: 1; min-width: 0; }

.search-dropdown__name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.search-dropdown__subs {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-dropdown__all {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    color: var(--blue-dark);
    border-top: 1px solid var(--border);
}

.search-dropdown__all:hover { background: var(--bg); color: var(--blue); }

/* Main */
.main { flex: 1; padding: 32px 0; }

/* Hero */
.hero {
    text-align: center;
    padding: 40px 0 32px;
}

.hero__title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.hero__subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
}

.hero__stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
}

.hero__stat {
    text-align: center;
}

.hero__stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--blue-dark);
}

.hero__stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Page heading */
.page-heading {
    margin-bottom: 24px;
}

.page-heading h1 {
    font-size: 24px;
    font-weight: 700;
}

.page-heading p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 15px;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs span { color: var(--text); }

/* Sections */
.section { margin-bottom: 40px; }

.section__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.section__title { font-size: 22px; font-weight: 700; }

.section__badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue-dark);
    background: var(--blue-light);
    padding: 3px 10px;
    border-radius: 100px;
}

/* Category Tiles */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.cat-tile {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: all var(--transition);
    color: var(--text);
    display: block;
}

.cat-tile:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text);
}

.cat-tile__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cat-tile__name {
    font-size: 15px;
    font-weight: 600;
}

.cat-tile__count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 100px;
}

.cat-tile__channels {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-tile__ch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.cat-tile__avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}

.cat-tile__chname {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.cat-tile__chsubs {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Channel Tiles Grid */
.ch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.ch-tile {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: all var(--transition);
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ch-tile:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow);
    color: var(--text);
}

.ch-tile__top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ch-tile__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
}

.ch-tile__info { flex: 1; min-width: 0; }

.ch-tile__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ch-tile__username {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.ch-tile__subs {
    font-size: 14px;
    font-weight: 700;
    color: var(--blue-dark);
    flex-shrink: 0;
    background: var(--blue-light);
    padding: 4px 10px;
    border-radius: 8px;
}

.ch-tile__desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: -4px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
}

.ch-tile__cat {
    font-size: 12px;
    color: var(--blue-dark);
    margin-top: auto;
    align-self: flex-start;
    background: var(--blue-light);
    padding: 2px 10px;
    border-radius: 100px;
}

/* Channel Detail Page */
.cd-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.cd-main { min-width: 0; }

.cd-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.cd-card__top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.cd-card__avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cd-card__info { flex: 1; min-width: 0; }

.cd-card__name {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cd-card__verified { flex-shrink: 0; }

.cd-card__username {
    font-size: 15px;
    color: var(--blue-dark);
    margin-top: 4px;
    display: inline-block;
}

.cd-card__username:hover { color: var(--blue); }

.cd-card__stats {
    display: flex;
    gap: 24px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.cd-stat {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cd-stat__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-light);
    border-radius: 10px;
    flex-shrink: 0;
}

.cd-stat__num {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

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

.cd-stat__link {
    font-size: 15px;
    font-weight: 600;
    color: var(--blue-dark);
}

.cd-stat__link:hover { color: var(--blue); }

.cd-card__desc {
    margin-bottom: 24px;
}

.cd-card__desc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.cd-card__desc-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-line;
}

.cd-card__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
}

.cd-btn--primary {
    background: var(--blue);
    color: #fff;
}

.cd-btn--primary:hover { background: var(--blue-dark); color: #fff; }

.cd-btn--secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.cd-btn--secondary:hover { border-color: var(--blue); color: var(--blue); }

/* Stats chart */
.cd-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-top: 20px;
}

.cd-section__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.cd-chart { height: 200px; }

/* Similar channels sidebar */
.cd-sidebar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: sticky;
    top: 84px;
}

.cd-similar { display: flex; flex-direction: column; gap: 4px; }

.cd-similar__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    color: var(--text);
}

.cd-similar__item:hover { background: var(--bg); color: var(--text); }

.cd-similar__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}

.cd-similar__info { min-width: 0; }

.cd-similar__name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Search page */
.search-page__form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 560px;
}

.search-page__input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-page__input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(42,171,238,0.15);
}

.search-page__btn {
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}

.search-page__btn:hover { background: var(--blue-dark); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 32px;
}

.pagination__link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.pagination__link:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.pagination__link--active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.pagination__dots {
    color: var(--text-secondary);
    padding: 0 4px;
}

/* Empty state */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty__icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty__text { font-size: 16px; }

/* Description links */
.desc-link {
    color: var(--blue-dark);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(42,171,238,0.3);
    text-underline-offset: 2px;
}

.desc-link:hover {
    color: var(--blue);
    text-decoration-color: var(--blue);
}

/* Category description */
.cat-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 720px;
}

/* Related categories */
.related-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.related-cats__item {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 100px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.related-cats__item:hover {
    border-color: var(--blue);
    color: var(--blue);
}

/* Top list */
.top-list { display: flex; flex-direction: column; gap: 4px; }

.top-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    transition: all var(--transition);
    color: var(--text);
}

.top-item:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow);
    color: var(--text);
}

.top-item__rank {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: center;
}

.top-item__rank--gold { color: #FFD700; font-size: 20px; }
.top-item__rank--silver { color: #C0C0C0; font-size: 18px; }
.top-item__rank--bronze { color: #CD7F32; font-size: 18px; }

/* Top category tabs */
.top-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.top-cats__item {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 100px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
}

.top-cats__item:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.top-cats__item--active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.top-cats__item--active:hover {
    background: var(--blue-dark);
    color: #fff;
}

.top-item__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}

.top-item__info { flex: 1; min-width: 0; }

.top-item__name {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-item__username {
    font-size: 13px;
    color: var(--text-secondary);
}

.top-item__cat {
    font-size: 12px;
    color: var(--blue-dark);
    background: var(--blue-light);
    padding: 3px 10px;
    border-radius: 100px;
    flex-shrink: 0;
}

.top-item__subs {
    font-size: 15px;
    font-weight: 700;
    color: var(--blue-dark);
    flex-shrink: 0;
}

/* About page */
.about {
    max-width: 720px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 40px;
}

.about__title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 28px;
}

.about__section { margin-bottom: 24px; }

.about__section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.about__section p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 8px;
}

.about__section ul {
    list-style: none;
    padding: 0;
}

.about__section li {
    font-size: 15px;
    line-height: 1.7;
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.about__section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 6px;
    height: 6px;
    background: var(--blue);
    border-radius: 50%;
}

/* Contact form */
.contact-form { display: flex; flex-direction: column; gap: 16px; max-width: 480px; }

.contact-form__field { display: flex; flex-direction: column; gap: 4px; }

.contact-form__field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.contact-form__field input,
.contact-form__field textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    resize: vertical;
}

.contact-form__field input:focus,
.contact-form__field textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(42,171,238,0.15);
}

.contact-form__btn {
    align-self: flex-start;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}

.contact-form__btn:hover { background: var(--blue-dark); }

.contact-ok {
    text-align: center;
    padding: 40px 20px;
}

.contact-ok__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #E8F8EE;
    color: #22C55E;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.contact-ok__text {
    font-size: 16px;
    font-weight: 500;
}

.contact-error {
    background: #FEF2F2;
    color: #DC2626;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: auto;
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.footer__links {
    display: flex;
    gap: 16px;
}

.footer__links a {
    color: var(--text-secondary);
    transition: color var(--transition);
}

.footer__links a:hover { color: var(--blue); }

/* Responsive */
@media (max-width: 768px) {
    .header__inner { gap: 12px; }
    .header__nav { display: none; }
    .header__search-wrap { flex: 1; }
    .hero__title { font-size: 24px; }
    .hero__stats { gap: 20px; }
    .hero__stat-num { font-size: 20px; }
    .cat-grid { grid-template-columns: 1fr; }
    .ch-grid { grid-template-columns: 1fr; }
    .channel { padding: 12px 16px; gap: 12px; }
    .channel__avatar { width: 44px; height: 44px; }
    .channel__name { font-size: 15px; }
    .cd-layout { grid-template-columns: 1fr; }
    .cd-sidebar { position: static; }
    .cd-card { padding: 20px; }
    .cd-card__top { gap: 14px; }
    .cd-card__avatar { width: 64px; height: 64px; }
    .cd-card__name { font-size: 18px; }
    .cd-card__stats { gap: 16px; flex-wrap: wrap; }
    .footer__inner { flex-direction: column; gap: 8px; }
    .top-item { padding: 10px 14px; gap: 10px; }
    .top-item__cat { display: none; }
    .top-item__avatar { width: 40px; height: 40px; }
    .about { padding: 24px 20px; }
    .search-page__form { flex-direction: column; }
}

@media (max-width: 480px) {
    .hero__stats { flex-direction: column; gap: 12px; }
    .cat-grid { grid-template-columns: 1fr; }
}
