/* =====================================================
   HIDEN.LIVE - Main Stylesheet
   ===================================================== */

/* ===== CSS Variables ===== */
:root {
    --bg: #0d1016;
    --bg-elevated: #11151c;
    --panel: #151922;
    --sidebar: #0f1218;
    --card: #1c212b;
    --text: #f5f7fb;
    --text-dim: #b8c1d1;
    --muted: #9aa4b5;
    --accent: #7a92b0;
    --accent-2: #ffb74d;
    --accent-glow: rgba(122, 146, 176, 0.15);
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
}

/* ===== Reset & Base ===== */
* { box-sizing: border-box; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
input, textarea, select, .search-input { user-select: text; }

/* Показывать только на мобильных */
.mobile-only,
.sidebar .mobile-only,
.sidebar a.mobile-only {
    display: none !important;
}

@media (max-width: 900px) {
    .mobile-only,
    .sidebar .mobile-only,
    .sidebar a.mobile-only {
        display: flex !important;
    }
}

/* ===== Layout ===== */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    background: linear-gradient(180deg, #0f1218 0%, #0a0c10 100%);
    border-right: 1px solid var(--border);
    padding: 28px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
}

/* Мобильные кнопки авторизации в сайдбаре */
.sidebar-auth-buttons {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-chat-btn {
    display: none;
}

.sidebar-user-profile {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.sidebar-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(77,208,225,0.5);
}

.sidebar-user-avatar-default {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    border: 2px solid rgba(77,208,225,0.5);
}

.sidebar-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 2px;
}

.sidebar-user-link {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.sidebar-logout-link {
    font-size: 11px;
    color: var(--muted);
    opacity: 0.8;
}

.sidebar-logout-link:hover {
    color: #ff6b6b;
    opacity: 1;
}

.sidebar-chat-btn-special {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%) !important;
    border-color: #ff6b6b !important;
    color: #fff !important;
    text-align: center;
    text-decoration: none;
}

.sidebar-chat-btn-special:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e04848 100%) !important;
}

.sidebar-auth-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.sidebar-auth-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
}

.sidebar-auth-btn.primary {
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    border-color: transparent;
    color: #fff;
}

.sidebar-auth-btn.primary:hover {
    box-shadow: 0 4px 12px rgba(77,208,225,0.3);
    transform: translateY(-1px);
}

.sidebar-logout-btn {
    color: #ff4757;
}

.sidebar-logout-btn:hover {
    background: rgba(255,71,87,0.1);
    border-color: rgba(255,71,87,0.3);
}

/* Стильный scrollbar для sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

.sidebar .sidebar-heading {
    margin: 0 0 16px;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding: 0 10px;
}

.sidebar .sidebar-heading.sidebar-heading-linklike {
    margin: 12px 0 4px;
    padding: 8px 10px;
    font-size: 13.5px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-dim);
    font-weight: 500;
}

.sidebar a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--text-dim);
    background: transparent;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}

.sidebar .cat-name {
    flex: 1;
    font-weight: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .cat-count {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar a.active {
    background: rgba(122,146,176,0.08);
    border-left-color: var(--accent);
    color: var(--text);
    font-weight: 600;
}

.sidebar a.active .cat-count {
    background: rgba(122,146,176,0.15);
    color: var(--accent);
}

.sidebar a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    padding-left: 12px;
}

.sidebar a:hover .cat-count {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

/* ===== Content Area ===== */
.content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Mobile Buttons ===== */
.mobile-left-buttons {
    display: none;
    align-items: center;
    gap: 8px;
}

.mobile-cat-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
    width: 40px;
    height: 40px;
    transition: all 0.2s ease;
    position: relative;
}

.mobile-cat-toggle:hover {
    border-color: var(--border-light);
    background: var(--bg-elevated);
}

.mobile-cat-toggle:active {
    transform: scale(0.95);
}

.mobile-messages-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    width: 40px;
    height: 40px;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.mobile-messages-toggle:hover {
    border-color: var(--border-light);
    background: var(--bg-elevated);
}

.mobile-messages-toggle:active {
    transform: scale(0.95);
}

.mobile-messages-toggle svg {
    width: 20px;
    height: 20px;
}

.mobile-unread-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ff4757, #ff6348);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

/* ===== Top Bar ===== */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(15,18,24,0.95);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.02);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    letter-spacing: 0.5px;
}

.logo a {
    text-decoration: none;
    background: linear-gradient(135deg, #b7c7e5, #8ba5cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: filter 0.2s ease;
    color: transparent;
}

.logo a:hover {
    filter: brightness(1.1);
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* Sidebar brand */
.sidebar-brand {
    margin-bottom: 20px;
    padding: 0 2px;
}

.sidebar-brand a {
    display: inline-block;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 0.4px;
    text-decoration: none;
    background: linear-gradient(135deg, #b7c7e5, #8ba5cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    transition: filter 0.2s ease;
}

/* Стили для логотипа-картинки */
.sidebar-logo-img {
    max-width: 220px;
    max-height: 56px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: filter 0.2s ease, transform 0.2s ease;
}

/* Защита на случай сторонних/старых правил (например img{width:100%}) */
.sidebar-brand img {
    max-width: 220px !important;
    max-height: 56px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: block;
}

.sidebar-brand a:has(.sidebar-logo-img) {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.sidebar-brand a:hover .sidebar-logo-img,
.sidebar-brand a:focus .sidebar-logo-img {
    filter: brightness(1.1);
    transform: scale(1.02);
}

.sidebar-brand a:hover,
.sidebar-brand a:focus,
.sidebar-brand a:active {
    filter: brightness(1.08);
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    background: linear-gradient(135deg, #b7c7e5, #8ba5cc);
    -webkit-background-clip: text;
    background-clip: text;
    text-decoration: none;
}

.sidebar-brand-tagline {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.35;
}

.sidebar .logo-section {
    margin-bottom: 20px;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
}

.sidebar .logo-section .chat-header-link {
    padding: 8px 12px;
    background: rgba(122,146,176,0.1);
    border: 1px solid rgba(122,146,176,0.2);
    border-radius: 10px;
    display: none;
}

.home-header-link,
.chat-header-link {
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text);
    border: 1px solid transparent;
}

.home-header-link:hover,
.chat-header-link:hover {
    background: rgba(122,146,176,0.1);
    color: var(--accent);
    border-color: rgba(255,255,255,0.08);
}

.sidebar-chat-btn {
    margin-top: 10px;
    background: rgba(122,146,176,0.1);
    border-color: rgba(122,146,176,0.2);
}

.sidebar-chat-btn:hover {
    background: rgba(122,146,176,0.2);
    border-color: rgba(122,146,176,0.3);
}

.top-links { 
    display: flex; 
    gap: 8px; 
    align-items: center;
    margin-left: auto;
}

.top-links a {
    padding: 9px 14px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.top-links a.active,
.top-links a:hover {
    color: var(--accent);
    background: rgba(122,146,176,0.08);
}

/* ===== Auth Overlay ===== */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.auth-overlay-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
    text-align: center;
}

.auth-overlay-box h3 {
    margin: 0 0 12px;
    font-size: 20px;
    color: var(--text);
}

.auth-overlay-box p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.auth-overlay-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}

.auth-overlay-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.auth-overlay-btn.primary {
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    color: #0a0c10;
    border: none;
}

.auth-overlay-close {
    margin-top: 8px;
    display: inline-block;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
}

/* ===== Auth Buttons ===== */
.auth-btn {
    padding: 9px 16px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-btn:hover {
    background: var(--bg-elevated);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.auth-btn-primary {
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    border-color: transparent;
    color: #fff;
}

.auth-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(77,208,225,0.3);
    transform: translateY(-2px);
}

/* ===== User Avatar in Header ===== */
.user-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.2s;
}

.user-link:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(77,208,225,0.3);
    transform: translateY(-1px);
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(77,208,225,0.5);
}

.user-avatar-small-default {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    border: 2px solid rgba(77,208,225,0.5);
}

.auth-link {
    padding: 9px 14px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.auth-link:hover {
    color: #ff4757;
    background: rgba(255,71,87,0.1);
}

/* ===== Messages Icon ===== */
.messages-link {
    position: relative;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.messages-link:hover {
    background: rgba(122,146,176,0.08);
    color: var(--accent);
}

.messages-link svg {
    width: 20px;
    height: 20px;
}

/* ===== Admin Icon ===== */
.admin-link {
    position: relative;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-link:hover {
    background: rgba(255,183,77,0.08);
    color: var(--accent-2);
}

.admin-link svg {
    width: 20px;
    height: 20px;
}

.unread-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ff4757, #ff6348);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: none;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.unread-badge.show {
    display: block;
}

/* ===== User Popup ===== */
.user-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.user-popup.active { display: flex; }

.user-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.user-popup-content {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    padding: 24px;
    z-index: 10001;
}

.user-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.user-popup-close:hover { background: rgba(255,255,255,0.05); }

.user-popup-loading { text-align: center; padding: 40px; color: var(--muted); }

.user-popup-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: block;
    border: 3px solid rgba(77,208,225,0.3);
}

.user-popup-avatar-default {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 0 auto 16px;
}

.user-popup-username {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.user-popup-bio {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.user-popup-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.user-popup-stat {
    text-align: center;
}

.user-popup-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.user-popup-stat-label {
    font-size: 12px;
    color: var(--muted);
}

.user-popup-actions {
    display: flex;
    gap: 8px;
}

.user-popup-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.user-popup-btn-primary {
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    border: none;
    color: #fff;
}

.user-popup-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77,208,225,0.4);
}

.user-popup-btn-secondary {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.user-popup-btn-secondary:hover {
    background: var(--bg-elevated);
}

/* ===== Search Form ===== */
.search-form {
    flex: 1;
    display: flex;
    justify-content: center;
}

.search-input {
    width: min(640px, 90%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 16px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder {
    color: var(--muted);
}

/* ===== Container & Grid ===== */
.container { padding: 24px; }
.muted { color: var(--muted); font-size: 0.92rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.sidebar-overlay { display: none; }

/* ===== Mobile Search ===== */
.mobile-search-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    width: 40px;
    height: 40px;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 18px;
}

.mobile-search-toggle:hover {
    border-color: var(--border-light);
    background: var(--bg-elevated);
}

.mobile-search-toggle:active {
    transform: scale(0.95);
}

/* Оверлей мобильного поиска */
.mobile-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(2px);
}

.mobile-search-overlay.active {
    display: flex;
}

.mobile-search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding: 20px;
    padding-top: 60px;
}

.mobile-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 24px;
    gap: 12px;
}

.mobile-search-input {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 16px;
    transition: all 0.2s ease;
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.mobile-search-input::placeholder {
    color: var(--muted);
}

.mobile-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 24px;
    transition: all 0.2s ease;
    padding: 0;
}

.mobile-search-close:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
}

.mobile-search-results {
    width: 100%;
    max-width: 600px;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.mobile-search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    cursor: pointer;
}

.mobile-search-result-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.mobile-search-result-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1e2530, #14181f);
    overflow: hidden;
    flex-shrink: 0;
}

.mobile-search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-search-result-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mobile-search-result-meta {
    font-size: 12px;
    color: var(--muted);
}

.mobile-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 60px;
    color: var(--muted);
    text-align: center;
    gap: 12px;
}

.mobile-search-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== Responsive: Tablet & Mobile (max-width: 900px) ===== */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(-100%) translateZ(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1050;
        box-shadow: 4px 0 24px rgba(0,0,0,0.6);
        padding: 24px 16px;
    }
    
    .sidebar.open { transform: translateX(0) translateZ(0); }
    
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.7);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        backdrop-filter: blur(6px);
    }
    
    .sidebar-overlay.visible {
        opacity: 1;
        pointer-events: all;
    }
    
    .mobile-left-buttons { display: flex; }
    .mobile-cat-toggle { display: inline-flex; }
    .mobile-messages-toggle { display: inline-flex; }
    .mobile-search-toggle { display: inline-flex; }

    /* Яндекс: избегаем текста < 12px на мобилке */
    .sidebar .sidebar-heading { font-size: 12px; }
    .sidebar .sidebar-heading.sidebar-heading-linklike { font-size: 13.5px; }
    .sidebar .cat-count { font-size: 12px; }
    .mobile-unread-badge,
    .unread-badge { font-size: 12px; }
    .topbar { justify-content: space-between; padding: 10px 16px; }
    .search-form { display: none; }
    .logo-section { margin-left: auto; }
    
    .home-header-link,
    .chat-header-link {
        border: 1px solid rgba(255,255,255,0.12);
        background: rgba(255,255,255,0.02);
    }
    
    .home-header-link:hover,
    .chat-header-link:hover {
        border-color: rgba(255,255,255,0.16);
        background: rgba(255,255,255,0.05);
    }

    /* На мобилке в шапке: показываем "Все категории" вместо "Секс чат" */
    .topbar-categories-link { display: inline-flex; }
    .topbar-sexchat-link { display: none; }
    
    /* Показываем кнопки авторизации в сайдбаре */
    .sidebar-auth-buttons { display: flex; }
    .sidebar-user-profile.show { display: flex; }
    .sidebar-chat-btn { display: block; }
    
    /* Адаптивный логотип для мобильных */
    .sidebar-logo-img {
        max-width: 180px;
        max-height: 46px;
    }

    .sidebar-brand img {
        max-width: 180px !important;
        max-height: 46px !important;
    }
    
    /* Скрываем десктопные кнопки авторизации на мобилке */
    .top-links { display: none !important; }
}

/* ===== Responsive: Very Small Screens (< 360px) ===== */
@media (max-width: 360px) {
    .layout { grid-template-columns: 1fr; }
    
    .sidebar {
        width: 85vw;
        max-width: 280px;
        padding: 20px 12px;
    }
    
    .sidebar .sidebar-heading {
        font-size: 12px;
        margin: 0 0 12px;
        padding: 0 6px;
    }
    
    .sidebar .sidebar-heading.sidebar-heading-linklike {
        font-size: 12.5px;
        margin: 10px 0 4px;
        padding: 6px 8px;
    }
    
    .sidebar a {
        padding: 6px 8px;
        margin-bottom: 1px;
        font-size: 12.5px;
    }
    
    .sidebar .cat-count {
        min-width: 20px;
        padding: 2px 4px;
        font-size: 12px;
    }
    
    .topbar { padding: 8px 12px; gap: 8px; }
    .logo-section { display: flex; gap: 6px; }
    
    .home-header-link,
    .chat-header-link {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 8px;
    }
    
    .mobile-cat-toggle,
    .mobile-messages-toggle,
    .mobile-search-toggle {
        width: 36px;
        height: 36px;
        padding: 6px;
        font-size: 16px;
    }
    
    .sidebar-auth-btn {
        padding: 10px;
        font-size: 13px;
    }
    
    .sidebar-user-info {
        display: none;
    }
    
    .sidebar-user-profile.show {
        gap: 8px;
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .sidebar-user-avatar,
    .sidebar-user-avatar-default {
        width: 40px;
        height: 40px;
        border-width: 1px;
    }
}

/* ===== Cards ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(90,200,250,0.3), rgba(77,208,225,0.1));
    -webkit-mask: linear-gradient(#fff 0%, #fff 100%) content-box, linear-gradient(#fff 0%, #fff 100%);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(90,200,250,0.2);
}

.card:hover::after {
    opacity: 1;
}

.thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1e2530, #14181f);
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.95rem;
    overflow: hidden;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

.card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.9rem;
}

.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.05);
}

/* ===== Player ===== */
.player-wrapper { max-width: 980px; margin: 0; position: relative; z-index: 1; }

.player-wrapper video,
.player-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 900px) {
    .player-wrapper { max-width: 100%; }
    
    .player-wrapper video,
    .player-wrapper img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        background: #000;
        object-fit: contain;
    }
}

/* ===== Pagination ===== */
.pagination {
    margin-top: 32px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.page-btn:hover {
    border-color: var(--border-light);
    background: var(--bg-elevated);
    transform: translateY(-1px);
}

.page-btn.active {
    background: linear-gradient(135deg, rgba(122,146,176,0.15), rgba(122,146,176,0.08));
    border-color: rgba(122,146,176,0.3);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(122,146,176,0.15);
}

/* ===== Footer ===== */
footer {
    border-top: 1px solid var(--border);
    padding: 24px 24px;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: auto;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.2));
}

footer a {
    color: var(--text-dim);
    transition: all 0.2s ease;
}

footer a:hover {
    color: var(--accent);
}

/* ===== Auth Modals ===== */
.auth-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.auth-modal.active {
    display: flex;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 440px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slideUp 0.3s ease;
    z-index: 10000;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.modal-header .modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    color: var(--muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.auth-form {
    padding: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #4dd0e1;
    box-shadow: 0 0 0 3px rgba(77,208,225,0.15);
}

.form-input::placeholder {
    color: var(--muted);
}

.form-error {
    color: #ff4757;
    font-size: 13px;
    margin-top: 6px;
    display: none;
}

.form-error.active {
    display: block;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4dd0e1, #26a69a);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(77,208,225,0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--muted);
    font-size: 14px;
}

.form-switch a {
    color: #4dd0e1;
    font-weight: 600;
    text-decoration: none;
}

.form-switch a:hover {
    text-decoration: underline;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        max-width: none;
    }

    .modal-header {
        padding: 20px 24px;
    }

    .auth-form {
        padding: 24px;
    }
}
