@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;700;900&display=swap');

:root {
    --accent: #FFD600;
    --bb-yellow: #FFD600;
    --bb-red: #E60000;
    --bb-yellow-soft: rgba(255,214,0,0.3);
    --bb-red-soft: rgba(230,0,0,0.3);
    --accent-hover: #d4b300;
    --accent-glow: rgba(255,214,0,0.4);
    --accent-soft: rgba(255,214,0,0.3);
    --accent-border: rgba(255,214,0,0.6);
}

body { background-color: #3A3A3A; color: #fff; font-family: 'Inter', sans-serif; overflow-x: hidden; }
*, *::before, *::after { transition: color 0.4s ease, background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease; }

.glass-card { background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.06); border-radius: 1.5rem; backdrop-filter: blur(10px); transition: border-color 0.3s ease, transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275), background 0.4s; position: relative; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 50px -15px rgba(0,0,0,0.4); }
.glass-card:hover { border-color: var(--accent-border); transform: translateY(-5px); background: rgba(0,0,0,0.35); }

.border-l-accent { border-left: 8px solid var(--accent) !important; }
.border-t-accent { border-top: 4px solid var(--accent) !important; }
.border-r-accent { border-right: 4px solid var(--accent) !important; }

.card-title-shorts-fixed { height: 70px; padding-top: 20px; display: flex; align-items: flex-start; justify-content: center; text-align: center; overflow: hidden; }
.card-title-shorts-fixed h4 { font-size: clamp(0.75rem, 2vw, 1.25rem); line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-title-highlights-fixed { height: 80px; display: flex; align-items: center; justify-content: center; text-align: center; }
.fixed-subtitle-area { height: 30px; display: flex; align-items: center; justify-content: center; }
.fixed-value-area { height: 50px; display: flex; align-items: center; justify-content: center; }

.text-accent { color: var(--accent); transition: color 0.3s ease; }
.stat-value { font-size: 2.5rem; font-weight: 900; letter-spacing: -0.05em; line-height: 1; }

.progress-bar { height: 5px; background: rgba(0,0,0,0.4); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: background 0.3s ease; }

.corner-icon { position: absolute; top: 1.5rem; right: 1.5rem; font-size: 1.4rem; opacity: 0.2; transition: all 0.4s ease; color: var(--accent); }
.glass-card:hover .corner-icon { opacity: 0.8; transform: scale(1.1); }
.play-overlay { position: absolute; bottom: 1.5rem; right: 1.5rem; width: 40px; height: 40px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }
.glass-card:hover .play-overlay { opacity: 1; transform: translateY(0); }

.section-title { font-size: 10px; font-weight: 900; color: #fff; text-transform: uppercase; letter-spacing: 0.4em; margin-bottom: 2.5rem; display: flex; align-items: center; gap: 1rem; }
.section-line { width: 40px; height: 1px; background-color: var(--accent); flex-shrink: 0; transition: background-color 0.3s ease; }

.toggle-wrap { display: flex; align-items: center; gap: 20px; margin-bottom: 3rem; user-select: none; }
.toggle-label { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.15em; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #fff; transition: color 0.3s ease; }
.toggle-label.dim { color: #555; }
.toggle-track { width: 72px; height: 36px; background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; position: relative; cursor: pointer; flex-shrink: 0; overflow: hidden; }
.toggle-fill { position: absolute; inset: 0; border-radius: 999px; background: var(--accent); opacity: 0.2; }
.toggle-thumb { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; will-change: transform; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.date-input { background: #1a1a1a; border: 1px solid #444; border-radius: 8px; padding: 10px 16px; color: #fff; font-size: 14px; outline: none; transition: border-color 0.2s; }
.date-input:focus { border-color: var(--accent); }
.apply-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 11px 28px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.15em; cursor: pointer; }
.apply-btn:disabled { background: #555; cursor: not-allowed; }

.post-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); gap: 16px; text-decoration: none; transition: background 0.2s ease; border-radius: 10px; }
.post-row:hover { background: rgba(255,255,255,0.04); }
.post-row:last-child { border-bottom: none; }

.hashtag-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); border-radius: 999px; font-size: 12px; font-weight: 700; transition: all 0.2s; }
.hashtag-pill:hover { background: rgba(255,255,255,0.1); border-color: var(--accent-border); }



@media (max-width: 640px) {
    .stat-value { font-size: 1.8rem; }
    .glass-card { padding: 1.5rem !important; }
    .section-title { font-size: 9px; letter-spacing: 0.2em; }
    .header-title { font-size: 2.5rem !important; line-height: 1; }
    .retention-value { font-size: 4rem !important; }
}

@media print {
    @page { margin: 12mm 10mm; size: A4; }

    body { background-color: #2a2a2a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #fff !important; }

    header .toggle-wrap, header button, #export-modal, .visit-counter-block, footer, .apply-btn, .date-input, label { display: none !important; }

    .tab-panel { display: none !important; }
    .tab-panel.active { display: block !important; }

    header { padding: 6mm 0 4mm !important; }
    header h1 { font-size: 1.8rem !important; margin-bottom: 0 !important; }
    header > p { display: none !important; }

    section { break-inside: avoid; page-break-inside: avoid; margin-bottom: 5mm !important; }
    .glass-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none !important; border: 1px solid rgba(255,255,255,0.12) !important; background: rgba(0,0,0,0.35) !important; }
    .grid { break-inside: avoid; page-break-inside: avoid; }
    canvas { max-height: 160px !important; }

    #print-footer { display: block !important; }
}




.hm-cell { cursor: default; }




@media (max-width: 640px) {
    .card-title-shorts-fixed {
        height: auto !important;
        padding-top: 0 !important;
        padding-bottom: 8px;
        align-items: center !important;
    }
}



.action-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.action-pill:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}
.action-pill i { font-size: 11px; opacity: 0.8; }
.action-pill:hover i { opacity: 1; color: var(--accent); }

.csv-export-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}
.csv-export-btn:hover {
    transform: translateX(4px);
    filter: brightness(1.2);
}
.csv-export-btn i { font-size: 1.2rem; flex-shrink: 0; }



.lang-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    font-size: 10px;
    font-weight: 900;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: all 0.2s;
    background: transparent;
    color: #555;
}
.lang-btn.active {
    background: var(--accent) !important;
    color: #fff !important;
}
.lang-btn:not(.active):hover {
    color: #fff;
}

/* Flatpickr dark theme */
.flatpickr-calendar {
    background: #2a2a2a !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5) !important;
}
.flatpickr-day { color: #ccc !important; border-radius: 6px !important; }
.flatpickr-day:hover { background: rgba(255,255,255,0.08) !important; border-color: transparent !important; }
.flatpickr-day.selected { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.flatpickr-day.today { border-color: var(--accent) !important; }
.flatpickr-day.disabled { color: #444 !important; }
.flatpickr-months { padding: 8px !important; }
.flatpickr-month { color: #fff !important; fill: #fff !important; }
.flatpickr-current-month { color: #fff !important; }
.flatpickr-current-month select { color: #fff !important; background: transparent !important; }
.flatpickr-weekday { color: #666 !important; }
.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: #888 !important; }
.flatpickr-prev-month:hover svg, .flatpickr-next-month:hover svg { fill: var(--accent) !important; }
.numInputWrapper input { color: #fff !important; }

/* Drag & Drop */
section.sortable-ghost {
    opacity: 0.3;
    background: rgba(255,255,255,0.02);
    border: 2px dashed var(--accent);
    border-radius: 1.5rem;
}
section.sortable-chosen {
    cursor: grabbing !important;
}
section.sortable-drag {
    opacity: 0.9;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6) !important;
}




section { position: relative; }
section.hidden-section { display: none !important; }
.hidden-sections-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 0;
}
.show-section-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.show-section-pill:hover { border-color: var(--accent); color: var(--accent); }




.ctrl-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    font-size: 11px;
    transition: all 0.2s;
    padding: 0;
}
.ctrl-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.1);
}
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; }

/* ===== MOBILE ===== */
@media (max-width: 768px) {

    /* Шапка — строка с меню и юзером */
    #header-controls {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        margin-bottom: 1.5rem !important;
    }
    #menu-wrap { flex-shrink: 0; }
    #user-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }

    /* Справка — не выходит за экран */
    #section-help-popup {
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
    }

    /* Тоггл */
    .toggle-wrap { margin-bottom: 1.5rem; gap: 12px; }
    .toggle-label { font-size: 10px; }

    /* Меню дропдаун — на всю ширину */
    #menu-dropdown {
        left: 0 !important;
        right: 0 !important;
        min-width: unset !important;
    }
}

@media (max-width: 768px) {
    #user-name { display: none !important; }
    #header-controls { flex-wrap: nowrap !important; }
}

/* ===== SKELETON LOADING ===== */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    color: transparent !important;
    user-select: none;
    min-width: 80px;
    min-height: 1em;
    display: inline-block;
}
.skeleton * { visibility: hidden; }

.glass-card.has-thumb {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-color: rgba(255,255,255,0.12) !important;
    box-shadow: 0 25px 50px -15px rgba(0,0,0,0.6) !important;
}
.cmp-date-input {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.cmp-date-input:focus { border-color: var(--accent); }

/* Flatpickr altInput fix */
.flatpickr-input[readonly] {
    cursor: pointer !important;
}

@media (max-width: 768px) {
    /* Меню — шире на мобилке */
    #menu-dropdown {
        min-width: 200px !important;
        width: 200px !important;
    }
    .menu-item {
        white-space: nowrap;
    }
}

/* ── Video Top Cards (thumb-top layout) ──────────────────────────────────── */
.vtop-card {
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 1rem;
    overflow: hidden;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: #fff;
    position: relative;
}
.vtop-card:hover {
    border-color: var(--accent-border);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.vtop-card__img {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    flex-shrink: 0;
}
.vtop-card__rank {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 12px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.vtop-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.25s;
}
.vtop-card:hover .vtop-card__play { opacity: 1; }
.vtop-card__play i {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.vtop-card__body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.vtop-card__title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: #ddd;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
}
.vtop-card__badge {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}
.vtop-card__stat {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #fff;
}
.vtop-card__meta {
    font-size: 10px;
    color: #777;
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .vtop-grid { grid-template-columns: 1fr !important; }
    .vtop-card__stat { font-size: 1.5rem; }
}

/* ── YouTube subsection headers ──────────────────────────────────────────── */
.yt-subsection-title {
    font-size: 15px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 0 10px 14px;
    margin: 32px 0 16px 0;
    border-left: 3px solid var(--accent);
    position: relative;
}
.yt-subsection-title:first-of-type {
    margin-top: 12px;
}
.yt-subsection-subtitle {
    font-size: 11px;
    font-weight: 400;
    color: #666;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}
.yt-subsection-hint {
    font-size: 13px;
    color: #555;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
}
.yt-subsection-hint:hover {
    color: var(--accent);
}

/* ── vtop-grid spacing fix ───────────────────────────────────────────────── */
.vtop-grid {
    margin-bottom: 8px;
}
