:root {
    --vine-teal: #00bf8f;
    --bg: #f4f6fb;
    --bg-soft: #eceff5;
    --card: #ffffff;
    --border: #e0e4ec;
    --text-main: #070814;
    --text-soft: #6b7280;
}

/* Basic reset */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        Roboto, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text-main);
}

body {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
}

#app {
    width: 100%;
    min-height: 100vh;
}

/* ------------ Layout (full-width topbar + sidebar) ------------ */

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Full-width topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    background: #ffffff;
    box-shadow: none;
    border-bottom: none;
    /* no global bottom border */
    height: 56px;
    /* explicit height to match sidebar top */
    display: flex;
    align-items: center;
}

.topbar-inner {
    width: 100%;
    padding: 0 16px;
    /* remove vertical padding, only horizontal */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-left {
    flex-shrink: 0;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* make stats pill hug the far right */
.topbar-right {
    margin-left: auto;
    flex-shrink: 0;
}

/* logo */

.logo-link {
    display: inline-flex;
    align-items: center;
}

.logo-img {
    height: 28px;
    display: block;
}

.topbar-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 191, 143, 0.08);
    color: var(--vine-teal);
    border: 1px solid rgba(0, 191, 143, 0.35);
}

/* Topbar search */

.topbar-search {
    width: 100%;
    max-width: 480px;
}

.topbar-search-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 7px 12px;
    font-size: 14px;
    background: #f9fafb;
}

.topbar-search-input:focus {
    outline: none;
    background: #ffffff;
    border-color: rgba(0, 191, 143, 0.7);
    box-shadow: 0 0 0 1px rgba(0, 191, 143, 0.25);
}

/* Topbar right: stats */

.stats-pill {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 191, 143, 0.06);
    border: 1px solid rgba(0, 191, 143, 0.45);
    color: #0b7661;
    white-space: nowrap;
    flex-shrink: 0;
    /* don't let it collapse */
    max-width: none;
}

/* Body with sidebar */

.layout-body {
    flex: 1;
    display: flex;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
    gap: 0;
}

/* Sidebar full-height, YouTube-ish column */

.sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 56px;
    /* matches .topbar height */
    align-self: flex-start;
    height: calc(100vh - 56px);
    /* full viewport minus topbar */
    display: flex;
    background: #ffffff;
    /* same colour as topbar */
    border-right: none;
    box-shadow: inset -1px 0 0 rgba(148, 163, 184, 0.18);
}



.sidebar-inner {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Sidebar nav – like YouTube primary nav */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-soft);
    border: 1px solid transparent;
    background: transparent;
}

/* hide Search + Following via CSS only (2nd & 4th item, matches screenshot) */
.sidebar-nav-link:nth-child(2),
.sidebar-nav-link:nth-child(4) {
    display: none;
}

.sidebar-nav-link:hover {
    background: rgba(148, 163, 184, 0.16);
    border-color: rgba(148, 163, 184, 0.35);
}

.sidebar-nav-link--active {
    background: #e5f9f3;
    color: var(--vine-teal);
    border-color: rgba(0, 191, 143, 0.65);
    font-weight: 600;
}

/* thin divider between main nav and subscriptions */

.sidebar-section-divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.4);
    margin: 6px 4px;
}

/* Subscriptions card area (Following list) */

.sidebar-card {
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 4px 2px 0;
    box-shadow: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 0 6px;
}

.sidebar-card-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
}

.sidebar-link-button {
    border: none;
    background: transparent;
    font-size: 11px;
    color: var(--vine-teal);
    cursor: pointer;
    padding: 0;
}

.sidebar-link-button:hover {
    text-decoration: underline;
}

/* list like YouTube subscriptions */

.following-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 2px;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.following-empty {
    font-size: 12px;
    color: var(--text-soft);
    padding: 4px 6px;
}

.following-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.following-item:hover {
    background: rgba(148, 163, 184, 0.18);
}

.following-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    flex-shrink: 0;
}

.following-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.following-name {
    font-size: 13px;
    color: var(--text-main);
}

/* Main content flush next to sidebar */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px 16px 0 16px;
    box-sizing: border-box;
    border-top: 1px solid var(--border);
    /* creates “bottom border” of topbar only here */
}

/* Generic page sections */

.page-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ------------ Feed header ------------ */

.feed-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-title {
    font-size: 20px;
    font-weight: 600;
}

/* Sort tabs */

.sort-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--border);
}

.sort-tab {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-soft);
    border: none;
    background: transparent;
    line-height: 1;
}

.sort-tab--selected {
    background: rgba(0, 191, 143, 0.12);
    color: var(--vine-teal);
    font-weight: 600;
}

/* ------------ Feed grid + cards ------------ */

.feed-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.card {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 210px;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
    box-shadow:
        0 6px 18px rgba(15, 23, 42, 0.04),
        0 0 0 0.5px rgba(15, 23, 42, 0.02);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.08),
        0 0 0 0.75px rgba(0, 191, 143, 0.4);
    border-color: rgba(0, 191, 143, 0.6);
}

/* 1:1 thumbs */

.card-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #000;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(15, 23, 42, 0.8);
    color: #ffffff;
}

.card-body {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-caption {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.card-meta {
    font-size: 12px;
    color: var(--text-soft);
}

/* ------------ Watch page layout ------------ */

.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 18px;
}

@media (max-width: 768px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }
}

/* Video shell */

.watch-video-shell {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
    box-shadow:
        0 12px 26px rgba(15, 23, 42, 0.12),
        0 0 0 0.5px rgba(15, 23, 42, 0.05);
}

.watch-video-shell video {
    width: 100%;
    display: block;
    max-height: 90vh;
}

.watch-video-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.45) 0,
            rgba(0, 0, 0, 0.08) 45%,
            transparent 100%);
}

.playback-hint {
    position: absolute;
    left: 10px;
    bottom: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
}

/* Right side meta */

.watch-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Back link above main content */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-soft);
    cursor: pointer;
    margin-bottom: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.08);
}

.back-link span:first-child {
    font-size: 18px;
}

.back-link:hover {
    background: rgba(148, 163, 184, 0.16);
}

/* Profile row (avatar + name) */

.profile-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-text {
    display: flex;
    flex-direction: column;
}

.profile-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.profile-username {
    font-size: 12px;
    color: var(--text-soft);
}

/* Follow button */

.follow-button {
    margin-left: auto;
    border-radius: 999px;
    border: 1px solid rgba(0, 191, 143, 0.6);
    padding: 4px 10px;
    font-size: 12px;
    background: rgba(0, 191, 143, 0.06);
    color: var(--vine-teal);
    cursor: pointer;
}

.follow-button.following {
    background: rgba(0, 191, 143, 0.14);
}

.link {
    color: var(--vine-teal);
    cursor: pointer;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* Caption + subline */

.watch-caption {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
}

.watch-subline {
    font-size: 13px;
    color: var(--text-soft);
}

/* Badges */

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.badge {
    padding: 3px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid rgba(148, 163, 184, 0.5);
    font-size: 11px;
    color: var(--text-soft);
}

/* ------------ Profile page ------------ */

.profile-page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow:
        0 8px 20px rgba(15, 23, 42, 0.05),
        0 0 0 0.5px rgba(15, 23, 42, 0.02);
}

.profile-page-avatar {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.profile-page-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-page-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.profile-page-username {
    font-size: 13px;
    color: var(--text-soft);
}

.profile-bio {
    font-size: 14px;
    color: var(--text-soft);
    margin-top: 8px;
}

/* ------------ Search page ------------ */

.search-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-bar-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.search-input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 8px 12px;
    font-size: 14px;
    background: #ffffff;
}

.search-input:focus {
    outline: none;
    border-color: rgba(0, 191, 143, 0.7);
    box-shadow: 0 0 0 1px rgba(0, 191, 143, 0.25);
}

.search-button {
    border-radius: 999px;
    border: none;
    padding: 8px 14px;
    font-size: 14px;
    background: var(--vine-teal);
    color: #ffffff;
    cursor: pointer;
}

.search-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.search-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-soft);
}

.search-history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.search-chip {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-soft);
    cursor: pointer;
}

.search-chip:hover {
    background: rgba(148, 163, 184, 0.2);
}

/* ------------ History page ------------ */

.history-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    cursor: pointer;
}

.history-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: #111827;
    overflow: hidden;
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-caption {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.history-username {
    font-size: 12px;
    color: var(--text-soft);
}

.history-meta {
    font-size: 11px;
    color: var(--text-soft);
}

/* ------------ Following page ------------ */

.following-page-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.following-page-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 8px 10px;
    cursor: pointer;
}

.following-page-item:hover {
    background: rgba(148, 163, 184, 0.08);
}

.following-page-username {
    font-size: 13px;
    color: var(--text-soft);
}

/* ------------ About page ------------ */

.page-about {
    min-height: 100%;
}

.about-main {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.about-hero {
    position: relative;
    margin-top: 4px;
    margin-bottom: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.about-hero-pill {
    height: 90px;
    width: 85%;
    border-radius: 40px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.55),
            rgba(255, 255, 255, 0.15));
}

.about-hero-text {
    position: absolute;
    text-align: center;
}

.about-hero-text h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--vine-teal);
}

.about-hero-text p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-soft);
}

.about-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 16px 18px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.about-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #e5f9f3;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.about-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-main);
}

.about-card p {
    font-size: 14px;
    color: var(--text-soft);
    margin: 0;
}

/* Legal grid */

.about-legal {
    margin-top: 8px;
}

.about-legal h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--vine-teal);
    margin: 0 0 4px;
}

.about-legal .subtitle {
    font-size: 13px;
    color: var(--text-soft);
    margin: 0 0 10px;
}

.legal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.legal-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 14px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legal-icon-bubble {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(0, 191, 143, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.legal-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

.legal-card p {
    font-size: 13px;
    color: var(--text-soft);
    margin: 0;
}

.legal-link-chip {
    display: inline-flex;
    align-items: center;
    margin-top: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 191, 143, 0.06);
    color: var(--vine-teal);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

/* Footer */

.footer {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-soft);
    text-align: center;
    opacity: 0.85;
}

/* Generic states */

.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.spinner {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 3px solid rgba(148, 163, 184, 0.25);
    border-top-color: var(--vine-teal);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.6);
    font-size: 13px;
    color: #b91c1c;
}

/* 404 */

.not-found {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
}

/* Responsive tweaks */

@media (max-width: 900px) {
    .layout-body {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        height: auto;
        max-width: 100%;
        flex: none;
    }

    .sidebar-inner {
        display: flex;
        flex-direction: column;
        gap: 4px;
        height: 100%;
        padding: 12px 10px;
        background: #ffffff;
        /* unify topbar + sidebar color */
    }

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

    .topbar-inner {
        flex-wrap: wrap;
    }

    .topbar-center {
        order: 3;
        width: 100%;
        margin-top: 6px;
    }

    .topbar-right {
        margin-left: auto;
    }
}