.theme-loading,
.theme-loading *,
.theme-loading *::before,
.theme-loading *::after {
    transition: none !important;
    animation: none !important;
}

:root {
    --body-bg: #ffffff;
    --header-bg: #ffffff;
    --sidebar-bg: #f8f9fa;
    --post-bg: #ffffff;
    --post-border: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --button-primary-bg: #007bff;
    --button-primary-text: #ffffff;
    --button-secondary-bg: #6c757d;
    --link-color: #007bff;
    --accent-color: #17a2b8;
    --accent-color-rgb: 23, 162, 184;
    --error-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --modal-bg: #ffffff;
    --modal-overlay: rgba(0,0,0,0.5);
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --navbar-text: #495057;
    --footer-bg: #2d3436;
    --footer-text: #ffffff;
    --footer-border: rgba(255,255,255,0.1);
    --footer-text-secondary: rgba(255,255,255,0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--body-bg);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
}

p, span, div, a, label, h1, h2, h3, h4, h5, h6, 
li, td, th, blockquote, pre, code {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.brand-name,
.btn,
button,
[type="button"],
[type="submit"],
[type="reset"],
[onclick],
.no-wrap,
[data-no-wrap] {
    word-break: normal;
    overflow-wrap: normal;
    white-space: nowrap;
}

/* Контейнер для header (расширенный) */
.site-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Общий контейнер для страниц */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.site-header {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--post-border);
    transition: all 0.3s ease;
}

.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: 3rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

/* Логотип */
.brand-logo {
    flex-shrink: 0;
}

.brand-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-name {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-color), var(--button-primary-bg));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* Навигация */
.header-navigation {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: flex-end;
}

/* Группа кнопок действий */
.nav-actions-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Кнопки действий */
.nav-action-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    height: 42px;
    white-space: nowrap;
}

.nav-action-link:hover {
    background: var(--sidebar-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-action-link svg {
    flex-shrink: 0;
}

.nav-action-label {
    display: none;
}

/* Кнопка уведомлений */
.notification-btn {
    position: relative;
}

/* Счетчик уведомлений */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--error-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.notification-badge.mobile {
    position: static;
    margin-left: auto;
}

/* Группа настроек */
.nav-settings-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    height: 42px;
}

.dropdown-toggle:hover {
    background: var(--sidebar-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dropdown-text {
    display: none;
}

@media (min-width: 768px) {
    .dropdown-text {
        display: inline;
    }
}

.dropdown-arrow {
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--post-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    padding: 0.5rem;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-radius: 10px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--sidebar-bg);
    transform: translateX(4px);
}

.dropdown-item.active {
    background: var(--sidebar-bg);
    color: var(--accent-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--post-border);
    margin: 0.5rem 0;
}

/* Dropdown поиска */
.search-dropdown .dropdown-menu {
    min-width: 220px;
}

.search-dropdown .dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   УНИКАЛЬНЫЕ DROPDOWN ДЛЯ HEADER (ПРЕФИКС unic-)
   ============================================ */

/* Уникальный Dropdown */
.unic-dropdown {
    position: relative;
}

.unic-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    height: 42px;
}

.unic-dropdown-toggle:hover {
    background: var(--sidebar-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.unic-dropdown-text {
    display: none;
}

.unic-dropdown-arrow {
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.unic-dropdown.active .unic-dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.unic-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--post-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    padding: 0.5rem;
}

.unic-dropdown.active .unic-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.unic-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-radius: 10px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 500;
}

.unic-dropdown-item:hover {
    background: var(--sidebar-bg);
    transform: translateX(4px);
}

.unic-dropdown-item.active {
    background: var(--sidebar-bg);
    color: var(--accent-color);
}

.unic-dropdown-divider {
    height: 1px;
    background: var(--post-border);
    margin: 0.5rem 0;
}

/* Превью темы в уникальном dropdown */
.unic-dropdown-menu.theme-menu {
    min-width: 320px;
    max-height: 420px !important;
    overflow-y: auto !important;
    overflow-x: hidden;
}

.unic-dropdown-menu.theme-menu::-webkit-scrollbar {
    width: 6px;
}

.unic-dropdown-menu.theme-menu::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
    border-radius: 0 10px 10px 0;
}

.unic-dropdown-menu.theme-menu::-webkit-scrollbar-thumb {
    background: var(--input-border);
    border-radius: 3px;
}

.unic-dropdown-menu.theme-menu::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.unic-dropdown-menu.theme-menu {
    scrollbar-width: thin;
    scrollbar-color: var(--input-border) var(--sidebar-bg);
}

/* Nav dropdown для медиа/общения */
.nav-dropdown.unic-dropdown .unic-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-dropdown.unic-dropdown .unic-dropdown-menu {
    min-width: 220px;
}

.nav-dropdown.unic-dropdown .unic-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-dropdown.unic-dropdown .unic-dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Флаги */
.flag {
    width: 24px;
    height: 18px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.flag-en {
    background: linear-gradient(180deg, 
        #B22234 0%, #B22234 7.7%, 
        #FFFFFF 7.7%, #FFFFFF 15.4%,
        #B22234 15.4%, #B22234 23.1%,
        #FFFFFF 23.1%, #FFFFFF 30.8%,
        #B22234 30.8%, #B22234 38.5%,
        #FFFFFF 38.5%, #FFFFFF 46.2%,
        #B22234 46.2%, #B22234 53.9%,
        #FFFFFF 53.9%, #FFFFFF 61.6%,
        #B22234 61.6%, #B22234 69.3%,
        #FFFFFF 69.3%, #FFFFFF 77%,
        #B22234 77%, #B22234 84.7%,
        #FFFFFF 84.7%, #FFFFFF 92.4%,
        #B22234 92.4%, #B22234 100%
    );
    position: relative;
}

.flag-en::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 53.8%;
    background: #3C3B6E;
    border-radius: 2px 0 0 0;
}

.flag-ru {
    background: linear-gradient(180deg, #fff 0%, #fff 33%, #0039a6 33%, #0039a6 66%, #d52b1e 66%);
}

.flag-kz {
    background: #00AFCA;
}

.flag-kz::after {
    content: '';
    position: absolute;
    left: 20%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    background: #FEC50A;
    border-radius: 50%;
}

/* Иконка темы */
.theme-icon {
    color: var(--text-secondary);
}

/* Превью темы */
.theme-item {
    padding: 0.875rem 1rem;
}

.theme-preview {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.theme-color {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--post-bg);
}

.theme-info {
    flex: 1;
    text-align: left;
}

.theme-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.theme-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Модальное окно уведомлений */
.notifications-modal {
    position: absolute;
    top: calc(100% + 8px);
    right: 1.5rem;
    width: 380px;
    max-width: 380px;
    max-height: 480px;
    background: var(--post-bg);
    border: 1px solid var(--post-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notifications-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Заголовок уведомлений */
.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--post-border);
    flex-shrink: 0;
}

.notifications-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notifications-actions {
    display: flex;
    gap: 0.5rem;
}

.mark-all-read-btn,
.clear-notifications-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.mark-all-read-btn:hover,
.clear-notifications-btn:hover {
    background: var(--sidebar-bg);
    color: var(--text-primary);
}

/* Фильтр уведомлений */
.notification-filter {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--post-border);
    flex-shrink: 0;
}

.filter-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    background: var(--post-bg);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
}

/* Счетчики в фильтрах */
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--sidebar-bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 10px;
}

.filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Список уведомлений */
.notifications-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
    position: relative;
}

/* Элемент уведомления */
.notification-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    overflow: hidden;
}

/* Непрочитанные уведомления */
.notification-item.unread {
    background: rgba(23, 162, 184, 0.05);
    border-color: transparent;
}

.notification-item.unread:hover {
    background: rgba(23, 162, 184, 0.08);
    border-color: rgba(23, 162, 184, 0.2);
}

/* Прочитанные уведомления */
.notification-item.read {
    opacity: 0.7;
    background: var(--sidebar-bg);
    border-color: var(--post-border);
}

.notification-item.read:hover {
    opacity: 1;
    background: var(--post-bg);
    border-color: var(--input-border);
}

/* Текст в прочитанных уведомлениях */
.notification-item.read .notification-text {
    color: var(--text-secondary);
}
