:root {
    --bg: #0f0f13;
    --surface: #1a1a24;
    --surface2: #22222e;
    --border: #2e2e3e;
    --accent: #6c63ff;
    --accent2: #ff6584;
    --text: #e8e8f0;
    --muted: #6b6b80;
    --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; min-height: 100vh; }

/* NAV */
nav { display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; height: 64px; border-bottom: 1px solid var(--border); background: rgba(15,15,19,.95); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 200; }
.logo { font-size: 1.4rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-right: auto; }
.nav-cta { background: var(--accent); color: #fff; border: none; padding: .5rem 1.2rem; border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: .9rem; }
.nav-cta:hover { opacity: .85; }
.nav-menu-btn { background: none; border: 1px solid var(--border); color: var(--text); width: 38px; height: 38px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s; flex-shrink: 0; }
.nav-menu-btn:hover { background: var(--surface2); }

/* APP LAYOUT */
.app-layout { display: flex; min-height: calc(100vh - 64px); overflow-x: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow: hidden;
    transition: width .25s cubic-bezier(.4,0,.2,1),
                min-width .25s cubic-bezier(.4,0,.2,1),
                max-width .25s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    z-index: 150;
}
.sidebar.collapsed { width: 58px; min-width: 58px; max-width: 58px; }

/* quando recolhida, esconde textos/setas/badges/sub-menus */
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-arrow,
.sidebar.collapsed .sidebar-badge,
.sidebar.collapsed .sidebar-sub { display: none !important; }
.sidebar.collapsed .sidebar-tab { justify-content: center; padding: .5rem 0; gap: 0; }
.sidebar.collapsed .sidebar-platform { justify-content: center; padding: .4rem 0; gap: 0; }
.sidebar.collapsed .sidebar-nav { padding: .5rem .25rem; }
.sidebar.collapsed .sidebar-section-label { display: none; }
.sidebar.collapsed .sidebar-divider { margin: .3rem .5rem; }

/* botão de toggle (> / <) */
.sidebar-toggle {
    position: absolute;
    top: 14px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background .2s, color .2s, border-color .2s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.sidebar { position: relative; }

/* nav interno */
.sidebar-nav {
    padding: .6rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}
.sidebar-section-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: .5rem .75rem .25rem;
    opacity: .7;
}
.sidebar-divider { height: 1px; background: var(--border); margin: .35rem .5rem; }

/* item principal (tab) */
.sidebar-tab {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .55rem;
    padding: .5rem .75rem;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    transition: background .15s, color .15s;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}
.sidebar-tab:hover { background: var(--surface2); color: var(--text); }
.sidebar-tab.active { background: rgba(108,99,255,.18); color: var(--accent); font-weight: 600; }

.sidebar-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.sidebar-tab.active .sidebar-icon,
.sidebar-tab:hover .sidebar-icon { opacity: 1; }
.sidebar-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar-arrow { flex-shrink: 0; width: 12px; height: 12px; opacity: .5; transition: transform .2s; }
.sidebar-arrow.rotated { transform: rotate(180deg); }
.sidebar-badge {
    background: var(--accent);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    padding: .15rem .4rem;
    border-radius: 10px;
    min-width: 17px;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}

/* sub-menu de plataformas */
.sidebar-sub {
    display: none;
    flex-direction: column;
    gap: .05rem;
    padding: .1rem .35rem .15rem 1.5rem;
    overflow: hidden;
    max-width: 100%;
    flex-shrink: 0;
}
.sidebar-sub.open { display: flex; flex-direction: column; }

/* item de plataforma */
.sidebar-platform {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .5rem;
    padding: .38rem .55rem;
    border-radius: 7px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .82rem;
    font-family: inherit;
    text-align: left;
    transition: background .15s, color .15s;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}
.sidebar-platform:hover { background: var(--surface2); color: var(--text); }
.sidebar-platform.active { color: var(--text); font-weight: 600; }
.sidebar-platform.active .platform-icon-wrap { box-shadow: 0 0 0 2px var(--accent); }

.platform-icon-wrap {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.platform-icon-wrap svg { width: 24px; height: 24px; }
/* alias antigo */
.platform-icon { width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px; }

.sidebar-platform span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MAIN CONTENT */
.main-content { flex: 1; min-width: 0; overflow: hidden; }

/* ===== MOBILE: sidebar vira drawer overlay ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        height: calc(100vh - 64px);
        width: 240px;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s;
        box-shadow: none;
        z-index: 300;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.5);
    }
    /* overlay atrás do drawer */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: 64px;
        background: rgba(0,0,0,.5);
        z-index: 299;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.visible { display: block; }

    /* esconde o botão toggle no mobile (usamos o hamburger do nav) */
    .sidebar-toggle { display: none; }
    /* reseta largura collapsed no mobile */
    .sidebar.collapsed { width: 240px; }
    .sidebar.collapsed .sidebar-label,
    .sidebar.collapsed .sidebar-arrow,
    .sidebar.collapsed .sidebar-badge,
    .sidebar.collapsed .sidebar-sub,
    .sidebar.collapsed .sidebar-section-label { display: flex !important; }
    .sidebar.collapsed .sidebar-tab { justify-content: flex-start; padding: .5rem .75rem; gap: .55rem; }
    .sidebar.collapsed .sidebar-platform { justify-content: flex-start; padding: .4rem .6rem; gap: .5rem; }
    .sidebar.collapsed .sidebar-nav { padding: .6rem .5rem; }
    .sidebar.collapsed .sidebar-badge { display: inline-flex !important; }
    .sidebar.collapsed .sidebar-label { display: block !important; }
}

/* HERO */
.hero { text-align: center; padding: 80px 2rem 60px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.15; max-width: 700px; margin: 0 auto 1rem; }
.hero h1 span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 520px; margin: 0 auto 2rem; }

/* SEARCH COMPACTO (fora da home) */
.search-compact { padding: 1rem 2rem .5rem; border-bottom: 1px solid var(--border); }
.search-compact .search-wrap { max-width: 600px; margin: 0; }

/* SEARCH BAR */
.search-wrap { display: flex; gap: .5rem; max-width: 540px; margin: 0 auto 1rem; }
.search-wrap input { flex: 1; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 1rem; outline: none; }
.search-wrap input:focus { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border: none; padding: .75rem 1.4rem; border-radius: var(--radius); font-weight: 700; cursor: pointer; font-size: 1rem; white-space: nowrap; }
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* NICHES */
.niches { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: 700px; margin: 0 auto; }
.niche-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: .4rem .9rem; border-radius: 20px; cursor: pointer; font-size: .875rem; transition: all .2s; }
.niche-btn:hover, .niche-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* GALLERY */
.section { padding: 2.5rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .3rem; }
.section-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.section-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-header .section-title { margin: 0; }
.filter-tabs { display: flex; gap: .4rem; margin-left: auto; }
.demo-badge { background: var(--accent2); color: #fff; font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 4px; margin-left: .5rem; vertical-align: middle; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.gallery-shorts { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
.thumb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform .2s, border-color .2s; position: relative; }
.thumb-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.thumb-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--surface2); }
.gallery-shorts .thumb-card img { aspect-ratio: 9/16; }
.thumb-card-info { padding: .75rem; }
.thumb-card-title { font-size: .875rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb-card-channel { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.thumb-card-overlay { position: absolute; inset: 0; background: rgba(108,99,255,.85); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; border-radius: var(--radius); }
.thumb-card:hover .thumb-card-overlay { opacity: 1; }
.overlay-btn { background: #fff; color: var(--accent); font-weight: 700; padding: .6rem 1.2rem; border-radius: 8px; font-size: .9rem; cursor: pointer; border: none; }

/* FAV BUTTON */
.fav-btn { position: absolute; top: .5rem; right: .5rem; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s, background .2s; z-index: 5; }
.thumb-card:hover .fav-btn { opacity: 1; }
.fav-btn.faved { opacity: 1; color: #ff4d6d; background: rgba(0,0,0,.6); }
.fav-btn:hover { background: rgba(255,77,109,.8) !important; color: #fff !important; }
.delete-btn { color: var(--muted) !important; background: rgba(0,0,0,.55) !important; }
.delete-btn:hover { background: rgba(200,50,50,.8) !important; color: #fff !important; }

/* LOAD MORE */
.load-more-wrap { text-align: center; margin-top: 2rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); padding: .6rem 1.4rem; border-radius: var(--radius); cursor: pointer; font-size: .9rem; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* SKELETON */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skeleton-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.skeleton-img { width: 100%; aspect-ratio: 16/9; }
.skeleton-line { height: 14px; margin: .75rem; border-radius: 4px; }
.skeleton-line.short { width: 60%; }

/* EMPTY */
.empty { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty svg { margin-bottom: 1rem; }

/* FOOTER */
footer { border-top: 1px solid var(--border); padding: 2rem; text-align: center; color: var(--muted); font-size: .85rem; margin-top: 4rem; }

@media (max-width: 768px) {
    .hero { padding: 40px 1rem 30px; }
    .search-wrap { flex-direction: column; }
    .gallery { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .section { padding: 1.5rem 1rem; }
}
