/* ============================================================
   Modern Base Styles — Shared between Index and Admin-Index
   ============================================================ */

:root {
    --brand: #0095f6;
    --brand-hover: #0078cc;
    --brand-light: rgba(0, 149, 246, .08);
    --brand-glow: rgba(0, 149, 246, .25);

    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e4e6eb;
    --border-light: #f0f1f3;
    --text-primary: #1a1a2e;
    --text-secondary: #65676b;
    --text-muted: #8e8e93;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);

    --ease: cubic-bezier(.4,0,.2,1);
    --duration: .2s;
}

body {
    background: var(--bg) !important;
    font-size: 15px;
    font-weight: 300;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

.logo-light,
.logo-dark {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.logo-dark { display: none; }

.header {
    background: rgba(255,255,255,.88) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border) !important;
    padding: 0 !important;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header > .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 12px;
}

.header-content {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    flex-wrap: wrap;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 10px;
}

.site-title a {
    font-size: 24px !important;
    font-weight: 300 !important;
    color: var(--text-primary) !important;
    letter-spacing: .3px;
}

.site-title a:hover {
    color: var(--brand) !important;
}

.social-links {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

.social-link {
    padding: 7px !important;
    border-radius: var(--radius-sm) !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    transition: all var(--duration) var(--ease) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.social-link:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

.social-link.telegram:hover { background: #0088cc !important; color: #fff !important; border-color: #0088cc !important; box-shadow: 0 0 14px rgba(0,136,204,.35) !important; }

.social-link.max:hover { background: #9147ff !important; color: #fff !important; border-color: #9147ff !important; box-shadow: 0 0 14px rgba(145,71,255,.35) !important; }

.social-link.vk:hover { background: #4a76a8 !important; color: #fff !important; border-color: #4a76a8 !important; box-shadow: 0 0 14px rgba(74,118,168,.35) !important; }

.header-search {
    flex: 1;
    min-width: 0;
    max-width: 320px;
    transition: max-width .3s var(--ease);
}

.header-search:focus-within {
    max-width: 460px;
}

.header-search .search-form {
    margin: 0;
}

.header-search .search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    border-radius: var(--radius);
}

.header-search .search-input {
    background: rgba(128,128,128,.08) !important;
    border: none !important;
    border-radius: var(--radius) !important;
    padding: 9px 42px 9px 14px !important;
    font-size: 13px !important;
    color: var(--text-primary) !important;
    width: 100%;
    transition: all .3s var(--ease) !important;
    flex: 1;
    min-width: 0;
}

.header-search .search-input:focus {
    background: var(--surface) !important;
    box-shadow: none !important;
}

.header-search:focus-within .search-wrapper:not(.has-filter) {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

.header-search .search-input::placeholder {
    color: var(--text-muted) !important;
}

.header-search .search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    color: var(--text-muted) !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: color var(--duration) var(--ease);
}

.header-search .search-btn:hover {
    color: var(--brand) !important;
    transform: translateY(-50%);
}

.header-search .search-btn.has-search {
    display: none;
}

.header-search .search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
}

.header-search .search-clear-btn:hover {
    background: #ef4444;
    color: #fff;
}

.search-section {
    display: none !important;
}

.search-wrapper {
    width: 100%;
}

.sidebar-tabs,
.mobile-sidebar-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-tabs {
    gap: 6px;
    flex: 1;
}

.sidebar-tab {
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.sidebar-tab:hover {
    background: var(--brand-light);
    color: var(--brand);
}

.sidebar-tab.active {
    background: var(--brand);
    color: #fff;
}

.mobile-sticky-wrapper {
    display: contents;
}

.mobile-search-tags-container {
    display: none;
}

.sidebar-footer {
    display: none !important;
}

.search-wrapper.has-filter {
    gap: 0;
    background: rgba(128,128,128,.08);
    border-radius: var(--radius);
    overflow: hidden;
}

.search-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px 0 14px;
    background: var(--brand);
    color: #fff;
    border-radius: 0;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: stretch;
}

.search-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    color: #fff;
    font-size: 9px;
    text-decoration: none;
    transition: background var(--duration) var(--ease);
    flex-shrink: 0;
}

.search-filter-clear:hover {
    background: rgba(255,255,255,.45);
}

.search-wrapper.has-filter .search-input {
    flex: 1;
    min-width: 0;
    border-radius: 0 !important;
    background: transparent !important;
    padding-left: 10px !important;
}

.header-search:focus-within .search-wrapper.has-filter {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

.header-search.has-filter {
    max-width: 500px !important;
}

.sidebar-sort {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-sort::before {
    content: 'Сортировка:';
    display: none;
    font-size: 10px;
    color: var(--text-muted);
    margin-right: 2px;
    white-space: nowrap;
}

.sort-btn {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all var(--duration) var(--ease);
    user-select: none;
}

.sort-btn:hover {
    color: var(--brand);
}

.sort-btn.active {
    color: var(--brand);
    font-weight: 600;
}

.sort-sep {
    color: var(--border);
    font-size: 11px;
    margin: 0 1px;
}

body.dark .sort-btn {
    color: #5b5e6b;
}

body.dark .sort-btn.active {
    color: var(--brand);
}

body.dark .sort-sep {
    color: #2a2a3e;
}

.mobile-tags-dropdown .tags-stats {
    display: none !important;
}

.search-input {
    background: var(--bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    padding: 9px 44px 9px 14px !important;
    font-size: 13px !important;
    color: var(--text-primary) !important;
    transition: all var(--duration) var(--ease) !important;
}

.search-input:focus {
    border-color: var(--brand) !important;
    background: var(--surface) !important;
    box-shadow: 0 0 0 3px var(--brand-light) !important;
}

.search-input::placeholder {
    color: var(--text-muted) !important;
}

.main-content {
    grid-template-columns: 360px 1fr !important;
    gap: 20px !important;
    padding-top: 20px;
    padding-bottom: 40px;
}

.sidebar {
    background: var(--surface) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow) !important;
    border: 1px solid var(--border) !important;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 84px;
    max-height: calc((100vh - 100px) / 1.1);
}

.sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding: 10px 12px !important;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tags-list {
    padding: 10px 12px !important;
    gap: 4px !important;
}

.sidebar .tag-end-marker,
.mobile-tags-dropdown .tag-end-marker {
    pointer-events: none !important;
    opacity: .3 !important;
    border: none !important;
    background: none !important;
    color: var(--text-muted) !important;
    justify-content: center !important;
    font-size: 12px !important;
}

.tag-end-marker {
    display: none;
}

.tag-item {
    padding: 9px 12px !important;
    background: var(--bg) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
    border: 1px solid transparent !important;
    transition: all var(--duration) var(--ease) !important;
}

.tag-item:hover {
    background: var(--brand-light) !important;
    color: var(--brand) !important;
    transform: none !important;
    border-color: rgba(0,149,246,.15) !important;
}

.tag-item.active {
    background: var(--brand) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.tag-name {
    font-weight: 500;
}

.sidebar-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sidebar-footer {
    background: transparent !important;
    border-top: 1px solid var(--border-light) !important;
    padding: 12px 18px 14px !important;
    flex-shrink: 0;
}

.tags-stats {
    color: var(--text-muted) !important;
    font-size: 12px !important;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.gallery-item {
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    border: 1px solid var(--border-light) !important;
    overflow: hidden;
    transition: all var(--duration) var(--ease) !important;
    background-color: var(--surface) !important;
}

.gallery-item:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--shadow-md) !important;
}

.gallery-item img {
    border-radius: 0 !important;
}

.multi-photo {
    border-radius: 0 var(--radius-sm) 0 var(--radius) !important;
    font-size: 11px !important;
    font-weight: 600;
    padding: 4px 10px !important;
    letter-spacing: .2px;
}

.results-info {
    color: var(--text-secondary) !important;
    font-size: 14px !important;
    padding: 16px 0 8px;
}

.post-actions {
    flex-wrap: wrap;
    align-items: center;
}

.post-actions .copy-link-btn:hover {
    background: var(--brand-light) !important;
    border-color: var(--brand) !important;
    color: var(--brand) !important;
}

.load-more-container {
    padding-top: 24px !important;
}

.load-more-btn {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    color: var(--text-secondary) !important;
    font-size: 14px !important;
    font-weight: 500;
    box-shadow: var(--shadow-sm) !important;
}

.load-more-btn:hover {
    background: var(--surface) !important;
    border-color: var(--brand) !important;
    color: var(--brand) !important;
    box-shadow: 0 4px 14px var(--brand-glow) !important;
}

body.dark {
    background-color: #121218 !important;
    color-scheme: dark;
    --bg: #16161e;
    --surface: #1c1c28;
    --border: #2a2a3e;
    --border-light: #222236;
    --text-primary: #e8e8ed;
    --text-secondary: #9ca0ab;
    --text-muted: #5b5e6b;
}

body.dark .header {
    background: rgba(22,22,34,.92) !important;
    border-color: #2a2a3e !important;
}

body.dark .header-search {
    background: rgba(22,22,34,.92);
    border-color: #2a2a3e;
}

body.dark .site-title a {
    color: #e8e8ed !important;
}

body.dark .site-description {
    color: #9ca0ab !important;
}

body.dark .header-search .search-input {
    color: #e8e8ed !important;
}

body.dark .header-search .search-input:focus {
    background: #22222e !important;
    box-shadow: none !important;
}

body.dark .header-search:focus-within .search-wrapper:not(.has-filter) {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

body.dark .header-search:focus-within .search-wrapper.has-filter {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

body.dark .search-wrapper.has-filter {
    background: #1e1e2a !important;
}

body.dark .header-search .search-input::placeholder {
    color: #5b5e6b !important;
}

body.dark .header-search .search-clear-btn {
    background: #2a2a3e;
    color: #9ca0ab;
}

body.dark .header-search .search-clear-btn:hover {
    background: #ef4444;
    color: #fff;
}

body.dark .header-search .search-btn {
    color: #5b5e6b !important;
}

body.dark .header-search .search-btn:hover {
    color: var(--brand) !important;
}

body.dark .mobile-search-bar .search-input {
    background: #1e1e2a !important;
    border-color: #2a2a3e !important;
    color: #e8e8ed !important;
}

body.dark .mobile-search-bar .search-input:focus {
    background: #22222e !important;
    box-shadow: none !important;
}

body.dark .mobile-search-bar:focus-within .search-wrapper:not(.has-filter) {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

body.dark .mobile-search-bar:focus-within .search-wrapper.has-filter {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

body.dark .mobile-search-bar .search-wrapper.has-filter {
    background: #1e1e2a !important;
    border-color: #2a2a3e !important;
}

body.dark .mobile-search-bar .search-input::placeholder {
    color: #5b5e6b !important;
}

body.dark .mobile-search-bar .search-clear-btn {
    background: #2a2a3e;
    color: #9ca0ab;
}

body.dark .mobile-search-bar .search-btn {
    color: #5b5e6b !important;
}

body.dark .mobile-search-bar .search-btn:hover {
    color: var(--brand) !important;
}

body.dark .sidebar {
    background: #1a1a26 !important;
    border-color: #2a2a3e !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.3) !important;
}

body.dark .sidebar-header {
    background: transparent !important;
    border-color: #2a2a3e !important;
}

body.dark .sidebar-tab {
    background: #22222e;
    color: #9ca0ab;
}

body.dark .sidebar-tab:hover {
    background: rgba(0,149,246,.1);
    color: var(--brand);
}

body.dark .sidebar-tab.active {
    background: var(--brand);
    color: #fff;
}

body.dark .sidebar-footer {
    background: transparent !important;
    border-color: #2a2a3e !important;
}

body.dark .tags-stats {
    color: #5b5e6b !important;
}

body.dark .tag-item {
    background: #22222e !important;
    color: #9ca0ab !important;
    border-color: transparent !important;
}

body.dark .tag-item:hover {
    background: rgba(0,149,246,.1) !important;
    color: var(--brand) !important;
    border-color: rgba(0,149,246,.15) !important;
}

body.dark .tag-item.active {
    background: var(--brand) !important;
    color: #fff !important;
    border-color: transparent !important;
}

body.dark .gallery-item {
    background-color: #1a1a26 !important;
    border-color: #2a2a3e !important;
}

body.dark .results-info {
    color: #9ca0ab !important;
}

body.dark .social-link {
    background: #1e1e2a !important;
    border-color: #2a2a3e !important;
    color: #9ca0ab !important;
}

body.dark .social-link.telegram:hover {
    background: #0088cc !important;
    color: #fff !important;
    border-color: transparent !important;
}

body.dark .social-link.max:hover {
    background: #9147ff !important;
    color: #fff !important;
    border-color: transparent !important;
}

body.dark .social-link.vk:hover {
    background: #4a76a8 !important;
    color: #fff !important;
    border-color: transparent !important;
}

body.dark .load-more-btn {
    background: #1a1a26 !important;
    border-color: #2a2a3e !important;
    color: #9ca0ab !important;
}

body.dark .load-more-btn:hover {
    background: #22222e !important;
    border-color: rgba(0,149,246,.3) !important;
    color: var(--brand) !important;
}

body.dark .load-more-btn.loading {
    background: #1e1e2a !important;
    border-color: var(--brand) !important;
}

body.dark .modal {
    background-color: rgba(0,0,0,.92) !important;
}

body.dark .modal-content {
    background-color: #1e1e2a !important;
}

body.dark .modal-info {
    background-color: #1e1e2a !important;
}

body.dark .post-date {
    color: #5b5e6b !important;
}

body.dark .post-text {
    color: #e8e8ed !important;
}

body.dark .post-header {
    border-color: #2a2a3e !important;
}

body.dark .close {
    color: #9ca0ab !important;
}

body.dark .close:hover {
    color: #e8e8ed !important;
}

body.dark .mobile-tags-toggle {
    background: #1e1e2a !important;
    border-color: #2a2a3e !important;
    color: #e8e8ed !important;
}

body.dark .mobile-tags-toggle .toggle-icon {
    background: var(--brand);
}

body.dark .mobile-tags-dropdown {
    background: #1a1a26 !important;
    border-color: #2a2a3e !important;
    box-shadow: 0 10px 40px rgba(0,0,0,.5) !important;
}

body.dark .mobile-tags-dropdown .tag-item {
    background: #22222e !important;
    color: #9ca0ab !important;
    border-color: rgba(255,255,255,.04) !important;
}

body.dark .mobile-tags-dropdown .tag-item:hover,
body.dark .mobile-tags-dropdown .tag-item.active {
    background: var(--brand) !important;
    color: #fff !important;
    border-color: transparent !important;
}

body.dark .mobile-tags-dropdown .tags-stats {
    color: #5b5e6b !important;
    border-color: #2a2a3e !important;
}

@media (min-width: 550px) and (max-width: 1024px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
    }
}

@media (max-width: 360px) {
    .gallery {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .mobile-sidebar-tabs .sidebar-sort {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .mobile-sidebar-tabs .sidebar-sort::before {
        display: inline;
    }

    .mobile-sidebar-tabs {
        justify-content: center;
    }
}
                                                                                                                                                                                                                                                                                                                                                                 