/* ==========================================
   1. ЦВЕТА И БАЗОВЫЕ СТИЛИ (MODERN UX)
   ========================================== */
:root { 
    --app-bg: #edeef0; 
    --app-box-bg: #ffffff;
    --app-text: #000000;
    --app-text-muted: #828282;
    --app-link: #2a5885;
    --app-btn-primary: #5181b8;
    --app-btn-primary-hover: #4774a8;
    --app-btn-secondary: #e5ebf1;
    --app-btn-secondary-hover: #d6e0e9;
    --app-btn-secondary-text: #55677d;
    --app-border: #d3d9de;
    --app-header-bg: #4a76a8;
    --app-header-height: 46px;
    --border-radius: 4px; 
    --alt-bg: #f4f4f5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    background-color: var(--app-bg); 
    font-family: Tahoma, Arial, Helvetica, sans-serif; 
    font-size: 13px; 
    color: var(--app-text); 
    line-height: 1.462; 
    -webkit-font-smoothing: antialiased;
}

a { color: var(--app-link); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }

/* ==========================================
   2. ШАПКА И КОЛОКОЛЬЧИК (УВЕДОМЛЕНИЯ)
   ========================================== */
.header { 
    background-color: var(--app-header-bg); 
    height: var(--app-header-height); 
    width: 100%; 
    display: flex; 
    justify-content: center; 
    position: fixed; 
    top: 0; 
    left: 0; 
    z-index: 100; 
}

.header-content { 
    width: 100%; 
    max-width: 960px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 15px; 
    height: 100%;
}

.header-logo { 
    font-size: 22px; 
    font-weight: bold; 
    color: #fff; 
    cursor: pointer; 
    text-decoration: none !important; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    letter-spacing: -0.5px;
}

.header-links { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
    position: relative;
}

.header-links a { 
    color: #d9e2ec; 
    font-weight: bold; 
    font-size: 12.5px; 
    transition: color 0.2s;
}

.header-links a:hover { 
    color: #fff; 
    text-decoration: none;
}

.bell-icon { 
    font-size: 18px; 
    cursor: pointer; 
    position: relative; 
    user-select: none; 
}

.bell-badge { 
    position: absolute; 
    top: -5px; 
    right: -8px; 
    background: #e64646; 
    color: white; 
    font-size: 10px; 
    font-weight: bold; 
    padding: 2px 5px; 
    border-radius: 10px; 
    display: none; 
}

#notifications-dropdown { 
    display: none; 
    position: absolute; 
    top: 40px; 
    right: 80px; 
    width: 300px; 
    background: #fff; 
    border: 1px solid var(--app-border); 
    border-radius: var(--border-radius); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    max-height: 300px; 
    overflow-y: auto; 
    z-index: 101; 
}

.notif-item { 
    padding: 10px; 
    border-bottom: 1px solid #e7e8ec; 
    font-size: 12px; 
}

.notif-item:last-child { 
    border-bottom: none; 
}

.notif-item.unread { 
    background: #f0f2f5; 
}

/* ==========================================
   3. ГЛОБАЛЬНЫЙ КАРКАС И МЕНЮ
   ========================================== */
.page-layout { 
    width: 100%; 
    max-width: 960px; 
    margin: 0 auto; 
    display: flex; 
    gap: 15px; 
    padding: calc(var(--app-header-height) + 15px) 15px 15px 15px; 
}

.left-col { 
    width: 150px; 
    flex-shrink: 0; 
    position: sticky; 
    top: calc(var(--app-header-height) + 15px); 
    align-self: flex-start; 
}

.main-col { 
    flex-grow: 1; 
    min-width: 0; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.box { 
    background: var(--app-box-bg); 
    border: 1px solid var(--app-border); 
    border-radius: var(--border-radius); 
    padding: 15px; 
}

.side-menu { 
    list-style: none; 
    width: 100%; 
}

.side-menu li { 
    margin-bottom: 2px; 
}

.side-menu li a { 
    color: var(--app-link); 
    display: flex; 
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px; 
    border-radius: var(--border-radius); 
    font-size: 13px; 
    transition: background 0.1s;
}

.side-menu li a:hover { 
    background-color: #e1e5eb; 
    text-decoration: none;
}

/* ПРОФИЛЬ И НАСТРОЙКИ */
.profile-header-card { 
    padding: 0; 
    overflow: hidden; 
    position: relative; 
}

.profile-cover { 
    height: 200px; 
    background: linear-gradient(135deg, #bacedf 0%, #8ea6bc 100%); 
    width: 100%; 
} 

.profile-info-wrap { 
    padding: 15px 20px; 
    display: flex; 
    gap: 20px; 
    position: relative; 
}

.avatar-container { 
    margin-top: -85px; 
    width: 150px; 
    height: 150px; 
    flex-shrink: 0; 
    position: relative; 
}

.avatar-container img { 
    width: 100%; 
    height: 100%; 
    border-radius: var(--border-radius); 
    border: 4px solid var(--app-box-bg); 
    object-fit: cover; 
    background: #fff;
}

.profile-details { 
    flex-grow: 1; 
    padding-top: 5px; 
}

.profile-name { 
    font-size: 19px; 
    font-weight: 400; 
    color: #000; 
    margin-bottom: 8px; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.status-text { 
    color: var(--app-text); 
    font-size: 13px; 
    margin-bottom: 15px; 
    border-bottom: 1px solid #e7e8ec; 
    padding-bottom: 10px;
}

.info-row { 
    font-size: 13px; 
    margin-bottom: 6px; 
    display: flex; 
    gap: 10px;
}

.info-label { 
    color: var(--app-text-muted); 
    width: 120px; 
    flex-shrink: 0;
}

.profile-actions-row { 
    display: flex; 
    gap: 10px; 
    margin-top: 15px;
}

/* КНОПКИ И ФОРМЫ */
.input-field { 
    border: 1px solid var(--app-border); 
    padding: 8px 10px; 
    font-family: inherit; 
    font-size: 13px; 
    width: 100%; 
    border-radius: var(--border-radius); 
    outline: none; 
    transition: border-color 0.2s;
}

.input-field:focus { 
    border-color: var(--app-btn-primary); 
}

textarea.input-field { 
    resize: vertical; 
    min-height: 50px; 
}

.btn { 
    border: none; 
    font-family: inherit; 
    font-size: 13px; 
    border-radius: var(--border-radius); 
    cursor: pointer; 
    padding: 7px 16px; 
    text-align: center; 
    transition: background-color 0.2s;
}

.btn-primary { 
    background-color: var(--app-btn-primary); 
    color: #fff; 
}

.btn-primary:hover { 
    background-color: var(--app-btn-primary-hover); 
}

.btn-primary:disabled { 
    background-color: #a1b6ce; 
    cursor: not-allowed; 
}

.btn-secondary { 
    background-color: var(--app-btn-secondary); 
    color: var(--app-btn-secondary-text); 
}

.btn-secondary:hover { 
    background-color: var(--app-btn-secondary-hover); 
}

#upload-box { 
    padding: 15px; 
}

.upload-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: 10px; 
}

.tabs { 
    display: flex; 
    border-bottom: 1px solid var(--app-border); 
    margin-bottom: 15px; 
    background: #fafbfc; 
    padding: 0 10px; 
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.tab { 
    padding: 12px 15px; 
    cursor: pointer; 
    color: var(--app-link); 
    font-size: 13px; 
    position: relative;
}

.tab:hover { 
    background: #f0f2f5; 
}

.tab.active { 
    font-weight: bold; 
    color: var(--app-text); 
    background: #fff; 
    border: 1px solid var(--app-border); 
    border-bottom: 1px solid #fff; 
    margin-bottom: -1px; 
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* ==========================================
   4. ПОСТЫ И ЛАЙТБОКС (ПОЛНОЭКРАНКА)
   ========================================== */
.wall-title { 
    font-weight: bold; 
    font-size: 13px; 
    color: var(--app-link); 
    margin-bottom: 15px; 
    border-bottom: 1px solid #e7e8ec; 
    padding-bottom: 10px;
}

.wall-post { 
    padding: 15px; 
    margin-bottom: 15px; 
    transition: background 0.2s; 
}

.post-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 10px; 
}

.post-author-avatar { 
    width: 40px; 
    height: 40px; 
    border-radius: var(--border-radius); 
    object-fit: cover; 
}

.post-author-info { 
    display: flex; 
    flex-direction: column; 
}

.post-author-name { 
    font-weight: bold; 
    color: var(--app-link); 
    font-size: 13px; 
}

.post-date { 
    color: var(--app-text-muted); 
    font-size: 11px; 
    margin-top: 2px;
}

.post-text { 
    font-size: 13px; 
    line-height: 1.5; 
    margin-bottom: 12px; 
    word-wrap: break-word; 
}

.post-image-thumb { 
    width: 100%; 
    border-radius: var(--border-radius); 
    margin-bottom: 12px; 
    cursor: pointer; 
    object-fit: cover; 
    max-height: 400px; 
    transition: filter 0.2s;
}

.post-image-thumb:hover { 
    filter: brightness(0.9); 
}

.post-actions { 
    display: flex; 
    gap: 15px; 
    border-top: 1px solid #e7e8ec; 
    padding-top: 12px; 
}

.action-link { 
    color: var(--app-link); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    font-weight: bold; 
    font-size: 12px; 
    user-select: none;
}

.action-link:hover { 
    text-decoration: underline; 
}

.action-link.liked { 
    color: #d34a44; 
} 

#lightbox { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.85); 
    z-index: 3100 !important; /* ВАЖНО: поверх всего */
    justify-content: center; 
    align-items: center; 
}

.lightbox-close { 
    position: absolute; 
    top: 15px; 
    right: 25px; 
    color: white; 
    font-size: 30px; 
    cursor: pointer; 
    font-weight: bold; 
    opacity: 0.7;
    z-index: 3110;
}

.lightbox-close:hover { 
    opacity: 1; 
}

.lightbox-content { 
    display: flex; 
    max-width: 90%; 
    max-height: 90%; 
    background: var(--app-box-bg); 
    border-radius: var(--border-radius); 
    overflow: hidden; 
}

.lightbox-img-wrap { 
    flex-grow: 1; 
    background: #000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-width: 300px; 
    max-width: 800px;
}

.lightbox-img-wrap img { 
    max-width: 100%; 
    max-height: 90vh; 
    object-fit: contain; 
}

.lightbox-sidebar { 
    width: 320px; 
    background: #fff; 
    display: flex; 
    flex-direction: column; 
}

.lightbox-comments-area { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 15px; 
}

/* КОММЕНТАРИИ */
.comments-section { 
    background: #fafbfc; 
    border-top: 1px solid #e7e8ec; 
    padding: 12px; 
    display: none; 
    margin: 12px -15px -15px -15px; 
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.comment-item { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 10px; 
}

/* ЛЕСЕНКА ДЛЯ ОТВЕТОВ НА КОММЕНТАРИИ */
.comment-reply {
    margin-left: 34px; 
    border-left: 2px solid #e7e8ec;
    padding-left: 10px;
    margin-top: 5px;
}

.comment-avatar { 
    width: 34px; 
    height: 34px; 
    border-radius: var(--border-radius); 
    object-fit: cover; 
}

.comment-content { 
    font-size: 13px; 
    line-height: 1.4; 
    width: 100%; 
    word-wrap: break-word;
}

.comment-content span.author { 
    color: var(--app-link); 
    font-weight: bold; 
    margin-right: 5px; 
}

.comment-input-row { 
    display: flex; 
    gap: 10px; 
    margin-top: 15px; 
}

.comment-input-row img { 
    width: 34px; 
    height: 34px; 
    border-radius: var(--border-radius); 
    object-fit: cover; 
}

/* ==========================================
   5. ДРУЗЬЯ И СПИСКИ
   ========================================== */
.user-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px; 
    border-bottom: 1px solid #e7e8ec;
}

.user-row:last-child { 
    border-bottom: none; 
}

.user-row-info { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

.user-row-info img { 
    width: 50px; 
    height: 50px; 
    object-fit: cover; 
    border-radius: var(--border-radius); 
}

.user-row-name { 
    font-weight: bold; 
    color: var(--app-link); 
    font-size: 13px; 
}

.dialog-row { 
    cursor: pointer; 
    transition: background 0.1s; 
}

.dialog-row:hover { 
    background-color: #f5f6f8; 
}

.dialog-row.unread { 
    background: #f0f2f5; 
}

.unread-badge { 
    background: var(--app-btn-primary); 
    color: white; 
    border-radius: 10px; 
    padding: 2px 7px; 
    font-size: 11px; 
    font-weight: bold; 
    margin-left: auto; 
}

/* ==========================================
   6. MODERN TELEGRAM CHAT UI
   ========================================== */
#msg-box { 
    display: none; 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: var(--app-box-bg); 
    border: 1px solid var(--app-border); 
    box-shadow: 0 5px 20px rgba(0,0,0,0.15); 
    width: 90%; 
    max-width: 550px; 
    height: 85vh; 
    z-index: 1000; 
    border-radius: 8px; 
    flex-direction: column; 
    overflow: hidden;
}

#modal-overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 999; 
}

.msg-header { 
    background: var(--app-header-bg); 
    color: #fff; 
    padding: 12px 15px; 
    font-weight: bold; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 14px;
}

.msg-close { 
    cursor: pointer; 
    font-size: 16px; 
    line-height: 1; 
    opacity: 0.8;
}

.msg-history { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 15px; 
    background: #96a9ba; 
    display: flex; 
    flex-direction: column; 
    gap: 10px;
}

.msg-bubble { 
    padding: 8px 12px; 
    border-radius: 12px 12px 12px 0; 
    width: fit-content; 
    max-width: 85%; 
    font-size: 13px; 
    position: relative; 
    background: #fff; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.msg-bubble.me { 
    background: #effdde; 
    align-self: flex-end; 
    border-radius: 12px 12px 0 12px; 
}

.msg-bubble span.author { 
    font-weight: bold; 
    color: var(--app-link); 
    margin-bottom: 3px; 
    display: block; 
    font-size: 11px;
}

/* ИКОНКИ СТАТУСА ПРОЧТЕНИЯ */
.msg-status { 
    font-size: 10px; 
    color: var(--app-text-muted); 
    float: right; 
    margin-left: 10px; 
    margin-top: 5px; 
    user-select: none;
    display: flex;
    align-items: center;
}

.msg-status-icon {
    font-size: 12px;
    margin-left: 4px;
}
.msg-status-icon.read {
    color: #5181b8;
}
.msg-status-icon.delivered {
    color: #8fb1d6;
}

.chat-image { 
    max-width: 100%; 
    border-radius: 8px; 
    margin-top: 5px; 
    cursor: pointer; 
}

.chat-audio { 
    width: 250px; 
    margin-top: 5px; 
    height: 40px;
}

.chat-input-area { 
    padding: 10px 15px; 
    background: #f0f2f5; 
    border-top: 1px solid var(--app-border); 
    position: relative;
}

.chat-input-wrapper { 
    display: flex; 
    align-items: flex-end; 
    background: #fff; 
    border-radius: 24px; 
    padding: 5px 15px; 
    gap: 10px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-icon-btn { 
    cursor: pointer; 
    font-size: 20px; 
    color: var(--app-text-muted); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 5px; 
    transition: color 0.2s; 
    user-select: none;
}

.chat-icon-btn:hover { 
    color: var(--app-btn-primary); 
}

#msg-text { 
    flex-grow: 1; 
    border: none; 
    background: transparent; 
    resize: none; 
    max-height: 100px; 
    min-height: 24px; 
    padding: 5px 0; 
    outline: none; 
    font-family: inherit; 
    font-size: 14px; 
    line-height: 1.4;
}

#typing-indicator { 
    position: absolute; 
    top: -20px; 
    left: 15px; 
    display: none; 
    font-size: 11px; 
    color: var(--app-text-muted); 
    background: rgba(255,255,255,0.8); 
    padding: 2px 8px; 
    border-radius: 10px;
}

#recording-ui { 
    display: none; 
    flex-grow: 1; 
    align-items: center; 
    gap: 10px; 
    padding: 5px 0; 
}

.rec-dot { 
    width: 10px; 
    height: 10px; 
    background-color: #ff3b30; 
    border-radius: 50%; 
    animation: pulse-red 1s infinite; 
}

.rec-time-text { 
    font-size: 14px; 
    font-variant-numeric: tabular-nums; 
    font-weight: bold; 
}

.rec-slide-text { 
    flex-grow: 1; 
    text-align: center; 
    color: #8e8e93; 
    font-size: 13px; 
    animation: slide-hint 2s infinite;
}

/* ==========================================
   7. ГЛОБАЛЬНЫЙ ЭКРАН ВХОДЯЩЕГО ЗВОНКА 
   ========================================== */
#global-incoming-call {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(25, 30, 35, 0.95); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    color: white;
}

.global-call-avatar { 
    width: 140px; 
    height: 140px; 
    border-radius: 50%; 
    margin-bottom: 20px; 
    object-fit: cover; 
    box-shadow: 0 0 30px rgba(0,0,0,0.5); 
}

.global-call-name { 
    font-size: 28px; 
    font-weight: 500; 
    margin-bottom: 10px; 
    letter-spacing: 0.5px;
}

.global-call-status { 
    font-size: 16px; 
    color: #aaa; 
    margin-bottom: 60px; 
}

.global-call-buttons { 
    display: flex; 
    gap: 60px; 
}

.call-btn-circle {
    width: 76px; 
    height: 76px; 
    border-radius: 50%; 
    border: none; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 32px; 
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
    transition: transform 0.2s;
}

.call-btn-circle:hover { 
    transform: scale(1.05); 
}

.call-btn-accept { 
    background: #34c759; 
    animation: pulse-green 1.5s infinite; 
}

.call-btn-reject { 
    background: #ff3b30; 
}

/* ==========================================
   8. ЭКРАН АКТИВНОГО ВИДЕОЗВОНКА
   ========================================== */
#call-modal {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: #111; 
    z-index: 99999; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
}

#remote-video {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    object-fit: cover; 
    z-index: 1; 
    background: #000;
}

#local-video {
    position: absolute; 
    bottom: 30px; 
    right: 30px; 
    width: 120px; 
    height: 160px;
    object-fit: cover; 
    z-index: 2; 
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); 
    border: 2px solid rgba(255,255,255,0.2);
    background: #222;
}

.call-ui-layer {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    z-index: 3; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
    padding: 40px 20px; 
    pointer-events: none;
}

.call-header-info { 
    text-align: center; 
    color: white; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.8); 
}

#call-status-text { 
    font-size: 16px; 
    color: rgba(255,255,255,0.8); 
    margin-top: 5px; 
    transition: opacity 0.5s; 
}

.call-controls-bottom { 
    display: flex; 
    justify-content: center; 
    padding-bottom: 20px; 
    pointer-events: auto; 
}

/* ==========================================
   9. МОДАЛЬНЫЕ ОКНА И АДМИНКА
   ========================================== */
#create-post-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: var(--app-box-bg);
    width: 100%; max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: fadeInModal 0.2s ease-out;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--app-border);
    display: flex; justify-content: space-between; align-items: center;
    font-weight: bold; font-size: 16px;
    background: var(--app-bg);
}

.modal-close {
    cursor: pointer; font-size: 20px; line-height: 1; color: var(--app-text-muted); transition: color 0.2s;
}
.modal-close:hover { color: #e64646; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.modal-footer { padding: 15px 20px; border-top: 1px solid var(--app-border); display: flex; justify-content: flex-end; background: #fafbfc; }
#admin-container { animation: fadeInModal 0.3s ease-out; }

/* ПРЕВЬЮ ССЫЛОК */
.link-preview {
    margin-top: 8px; border: 1px solid var(--app-border); border-radius: 8px; overflow: hidden;
    text-decoration: none; display: block; background: #f9f9f9; color: inherit; transition: background 0.2s;
}
.link-preview:hover { background: #f0f2f5; text-decoration: none; }
.link-preview-img { width: 100%; height: 150px; object-fit: cover; display: block; border-bottom: 1px solid #eee; }
.link-preview-info { padding: 10px; }
.link-preview-title { font-weight: bold; font-size: 13px; margin-bottom: 4px; color: var(--app-link); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-preview-desc { font-size: 11px; color: var(--app-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }


/* ==========================================
   10. КАСТОМНЫЙ ПЛЕЕР И ПЛЕЙЛИСТ
   ========================================== */
#global-player-bar {
    position: fixed;
    top: 0; left: 0; width: 100%;
    height: var(--app-header-height);
    background: #ffffff;
    border-bottom: 1px solid #d3d9de;
    z-index: 2000; /* Перекрывает хедер */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: none; /* Управляется JS */
}

.player-inner {
    max-width: 960px;
    width: 100%; height: 100%; margin: 0 auto;
    display: flex; align-items: center; padding: 0 15px;
    justify-content: space-between; transition: background 0.2s;
}

.player-inner:hover { background: #f9f9f9; cursor: pointer; }
.player-controls { display: flex; align-items: center; gap: 15px; }
.player-btn { background: none; border: none; color: #5181b8; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: opacity 0.2s; }
.player-btn:hover { opacity: 0.7; }
.player-btn.play-btn { background: #5181b8; color: white; border-radius: 50%; width: 40px; height: 40px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.player-btn.toggle-btn { color: #99a2ad; }
.player-btn.toggle-btn.active { color: #5181b8; }

.player-track-info { display: flex; align-items: center; justify-content: center; flex-grow: 1; overflow: hidden; white-space: nowrap; margin: 0 20px; }
.track-title { font-weight: bold; font-size: 14px; color: #000; text-overflow: ellipsis; overflow: hidden; margin-right: 5px; }
.track-artist { font-size: 14px; color: #5181b8; text-overflow: ellipsis; overflow: hidden; margin-left: 5px; }
.player-actions { display: flex; align-items: center; }

/* Ползунок */
.player-slider { flex-grow: 1; height: 4px; cursor: pointer; accent-color: #5181b8; background: #d3d9de; border-radius: 2px; -webkit-appearance: none; appearance: none; outline: none; }
.player-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; background: #5181b8; border-radius: 50%; cursor: pointer; }

/* Окно плейлиста */
#playlist-popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 3050; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.playlist-popup-content { background: var(--app-box-bg); width: 95%; max-width: 450px; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); display: flex; flex-direction: column; height: 75vh; position: relative; overflow: hidden; }
.playlist-header { padding: 20px; border-bottom: 1px solid var(--app-border); background: #fafbfc; display: flex; flex-direction: column; }
.playlist-controls { display: flex; align-items: center; justify-content: center; gap: 25px; margin-bottom: 10px; }
.playlist-tracks-container { overflow-y: auto; flex-grow: 1; padding: 10px 0; background: #fff; }
.playlist-track-item { padding: 12px 20px; display: flex; align-items: center; gap: 15px; cursor: pointer; border-bottom: 1px solid #f5f5f5; transition: background 0.2s; }
.playlist-track-item:hover { background: #f0f2f5; }
.playlist-track-item.active { background: #e5ebf1; border-left: 4px solid var(--app-btn-primary); padding-left: 16px; }
.playlist-track-title { font-weight: bold; font-size: 14px; color: #000; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; margin-bottom: 2px;}
.playlist-track-artist { font-size: 12px; color: var(--app-text-muted); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

/* ==========================================
   11. АНИМАЦИИ И УТИЛИТЫ
   ========================================== */
#toast-container { position: fixed; bottom: 20px; left: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background-color: rgba(0, 0, 0, 0.8); color: white; padding: 12px 16px; border-radius: var(--border-radius); font-size: 13px; animation: fadeIn 0.3s; }
.toast.error { background-color: rgba(200, 50, 50, 0.9); }
@keyframes pulse-red { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); } 70% { box-shadow: 0 0 0 20px rgba(52, 199, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }
@keyframes slide-hint { 0% { opacity: 0.5; transform: translateX(5px); } 50% { opacity: 1; transform: translateX(-5px); } 100% { opacity: 0.5; transform: translateX(5px); } }
@keyframes fadeIn { from { opacity: 0; bottom: -10px; } to { opacity: 1; bottom: 0; } }
@keyframes fadeInModal { from { opacity: 0; transform: translateY(-15px); } to { opacity: 1; transform: translateY(0); } }
.loader { border: 3px solid #f3f3f3; border-top: 3px solid var(--app-btn-primary); border-radius: 50%; width: 20px; height: 20px; animation: spin 1s linear infinite; display: inline-block; margin: 10px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================
   12. МОБИЛЬНАЯ АДАПТАЦИЯ (MEDIA QUERIES)
   ========================================== */
@media screen and (max-width: 768px) {
    .page-layout { flex-direction: column; padding: calc(var(--app-header-height) + 10px) 10px 10px 10px; gap: 10px; }
    .left-col { width: 100%; position: static; padding: 0; }
    .side-menu { display: flex; overflow-x: auto; white-space: nowrap; padding-bottom: 5px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .side-menu::-webkit-scrollbar { display: none; }
    .side-menu li { flex-shrink: 0; margin-right: 5px; }
    .side-menu li a { background: var(--app-box-bg); border: 1px solid var(--app-border); padding: 8px 15px; }
    .profile-cover { height: 120px; }
    .profile-info-wrap { flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 15px 10px; }
    .avatar-container { margin-top: -60px; width: 100px; height: 100px; }
    .info-row { justify-content: center; }
    .info-label { width: auto; margin-right: 5px; }
    .profile-actions-row { justify-content: center; width: 100%; flex-wrap: wrap; }
    .profile-actions-row .btn { width: 100%; flex-basis: 100%; }
    .lightbox-content { flex-direction: column; max-height: 100%; width: 100%; border-radius: 0; }
    .lightbox-sidebar { width: 100%; height: 40vh; }
    .lightbox-img-wrap { height: 60vh; }
    
    #msg-box { 
        width: 100%; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; 
        max-width: 100%; border: none; padding-bottom: env(safe-area-inset-bottom); 
        z-index: 3000 !important;
    }
    #modal-overlay { z-index: 2999 !important; }
    #notifications-dropdown { right: 10px; width: 280px; }
    .global-call-buttons { gap: 40px; }
    #local-video { bottom: 100px; right: 20px; width: 90px; height: 120px; }
    .modal-content { height: 100%; border-radius: 0; max-width: 100%; justify-content: center; }
    .modal-body { flex-grow: 1; justify-content: center; }

    .playlist-popup-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    #playlist-popup { padding: 0; }

    /* ПЛЕЕР: ЗАМЕЩАЕТ ХЕДЕР НА МОБИЛКЕ (54px ВЫСОТА) */
    #global-player-bar {
        position: fixed !important;
        top: 0 !important;
        bottom: auto !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 54px !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        padding: 0 !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
        z-index: 2000 !important;
    }
    
    .player-inner {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 10px !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .player-controls { gap: 8px !important; margin: 0 !important; flex-direction: row !important; }
    .player-btn { font-size: 16px !important; }
    .player-btn.play-btn { width: 36px !important; height: 36px !important; font-size: 16px !important; }
    
    .player-track-info { width: auto !important; flex-grow: 1 !important; margin: 0 10px !important; justify-content: center !important;}
    .player-cover { display: none !important; }
    .track-title { font-size: 12px !important; margin:0!important;}
    .track-artist { font-size: 11px !important; margin:0!important;}
    .player-text { width: 100% !important; flex-direction: row!important; justify-content: center!important; align-items:center!important; gap: 5px!important;}
    
    .player-actions { border: none !important; padding: 0 !important; margin: 0 !important; height: auto !important; display: flex !important; align-items: center !important;}
    .close-btn { font-size: 20px !important; color: #888 !important; display: block !important;}
    
    /* ЖЕСТКО СКРЫВАЕМ ЛИШНЕЕ НА МОБИЛКЕ В ВЕРХНЕЙ ПАНЕЛИ */
    .player-controls #btn-shuffle, 
    .player-controls #btn-repeat,
    .player-controls .player-btn:not(.play-btn):not(.close-btn),
    .volume-slider, 
    #btn-volume-icon, 
    .add-btn { 
        display: none !important; 
    }
    
    .call-controls-bottom { gap: 30px; }
    .call-btn-action { background: rgba(255,255,255,0.2); backdrop-filter: blur(5px); color: white; }
    .call-btn-action:hover { background: rgba(255,255,255,0.3); }
}