@media (max-width: 1400px) {
    .site-container {
        max-width: 1280px;
        padding: 0 1.5rem;
    }
    
    .header-wrapper {
        gap: 1.5rem;
    }

    .nav-action-label {
        display: none;
    }
    
    .nav-action-link {
        padding: 0.625rem;
        min-width: 42px;
    }
    
    .nav-actions-group {
        gap: 0.375rem;
    }
    
    .header-wrapper {
        gap: 2rem;
    }

    .nav-dropdown.unic-dropdown .nav-action-label {
        display: none;
    }
    
    .nav-dropdown.unic-dropdown .unic-dropdown-toggle {
        padding: 0.625rem;
        min-width: 42px;
    }

    .nav-settings-group .unic-dropdown-toggle {
        padding: 0.625rem;
        min-width: 42px;
    }
}

@media (max-width: 1024px) {
    html {
        font-size: 15px;
    }
    
    .nav-actions-group {
        gap: 0.375rem;
    }
    
    .header-wrapper {
        gap: 1rem;
    }
    
    .header-navigation {
        gap: 1rem;
    }
    
    .footer-top {
        gap: 3rem;
    }
    
    .partners-logos {
        gap: 2rem;
    }
}

@media (max-width: 831px) {
    .user-toggle span {
        display: none;
    }
    
    .user-toggle {
        padding: 0.5rem;
        min-width: 48px;
        justify-content: center;
    }
}

@media (max-width: 771px) {
    .nav-dropdown.unic-dropdown .unic-dropdown-arrow {
        display: none;
    }

    .nav-settings-group .unic-dropdown-arrow {
        display: none;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .header-navigation {
        display: none;
    }
    
    .nav-mobile-toggle {
        display: flex;
    }
    
    .header-wrapper {
        height: 64px;
        gap: 0.75rem;
    }
    
    .mobile-menu {
        top: 64px;
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
    }
    
    .brand-name {
        font-size: 1.5rem;
    }
    
    .site-container,
    .container {
        padding: 0 1rem;
    }
    
    /* ИСПРАВЛЕНИЕ: уведомления ВСЕГДА справа */
    .notifications-modal {
        width: 360px;
        max-width: calc(100vw - 2rem);
        right: 1rem;
        left: auto;
    }
    
    .main-content {
        min-height: calc(100vh - 64px);
        min-height: calc(100dvh - 64px);
        padding: 1.5rem 0;
    }
    
    .footer-top {
        flex-direction: column;
        align-items: center;
        gap: 2.5rem;
    }
    
    .footer-partners,
    .footer-legal {
        width: 100%;
    }
    
    .partners-logos {
        gap: 2rem;
    }
    
    .partner-logo {
        height: 32px;
    }
    
    .legal-links {
        gap: 0.5rem;
    }
    
    .legal-link {
        font-size: 0.875rem;
    }
    
    .footer-app-stores {
        padding: 1rem 0 0.75rem;
    }
    
    .app-stores-title {
        font-size: 0.9375rem;
        margin-bottom: 0.875rem;
    }
    
    .app-store-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
    }
    
    .app-store-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    /* Модальное окно темы на планшетах */
    .theme-modal {
        padding: 0.75rem;
    }
    
    .theme-modal-content {
        max-height: 65vh;
        max-height: 65dvh;
    }
    
    /* Уведомления всплывающие (toast) */
    .notification-container {
        top: 70px;
        right: 10px;
        left: auto;
    }
    
    .notification {
        max-width: calc(100vw - 20px);
    }
    
    .notification-content {
        padding: 12px;
        min-height: 48px;
    }
}

/* Маленькие телефоны */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .site-container,
    .container {
        padding: 0 0.75rem;
    }
    
    .header-wrapper {
        height: 56px;
        padding: 0;
    }
    
    .mobile-menu {
        top: 56px;
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
    }
    
    .brand-name {
        font-size: 1.25rem;
    }
    
    .header-brand {
        gap: 0.5rem;
        min-width: auto;
    }
    
    .nav-mobile-toggle {
        width: 40px;
        height: 40px;
    }
    
    /* ИСПРАВЛЕНИЕ: уведомления ВСЕГДА справа */
    .notifications-modal {
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
        right: 1rem;
        left: auto;
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
    }
    
    .main-content {
        min-height: calc(100vh - 56px);
        min-height: calc(100dvh - 56px);
        padding: 1rem 0;
    }
    
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-wrapper {
        gap: 2rem;
    }
    
    .footer-top {
        gap: 2rem;
    }
    
    .partners-title,
    .legal-title {
        font-size: 1rem;
    }
    
    .partners-logos {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .footer-app-stores {
        padding: 0.75rem 0 0.5rem;
    }
    
    .app-store-btn {
        padding: 0.625rem 1.25rem;
    }
    
    .store-label {
        font-size: 0.7rem;
    }
    
    .store-name {
        font-size: 1rem;
    }
    
    /* Модальное окно темы на маленьких телефонах */
    .theme-modal {
        padding: 0.5rem;
    }
    
    .theme-modal-content {
        max-width: 100%;
        max-height: 70vh;
        max-height: 70dvh;
        border-radius: 12px;
    }
    
    .theme-modal-header {
        padding: 1rem 1.25rem;
    }
    
    .theme-modal-title {
        font-size: 1.125rem;
    }
    
    .theme-modal-body {
        padding: 0.75rem;
    }
    
    .theme-modal-item {
        padding: 0.875rem;
    }
    
    .theme-modal-list {
        gap: 0.5rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    .brand-name {
        font-size: 1.125rem;
    }
    
    .mobile-menu-inner {
        padding: 1.5rem 1rem;
    }
    
    .theme-modal-content {
        max-height: 80vh;
        max-height: 80dvh;
    }
}

/* Landscape ориентация на телефонах */
@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
    .header-wrapper {
        height: 48px;
    }
    
    .mobile-menu {
        top: 48px;
        height: calc(100vh - 48px);
        height: calc(100dvh - 48px);
    }
    
    .main-content {
        min-height: calc(100vh - 48px);
        min-height: calc(100dvh - 48px);
        padding: 1rem 0;
    }
    
    .theme-modal-content {
        max-height: 75vh;
        max-height: 75dvh;
    }
    
    .theme-modal-header {
        padding: 0.875rem 1.25rem;
    }
    
    .theme-modal-body {
        padding: 0.75rem;
    }
    
    .theme-modal-item {
        padding: 0.75rem;
    }
    
    .mobile-menu-inner {
        padding: 1rem;
    }
}

/* Адаптация для iOS Safari (безопасная зона) */
@supports (padding: max(0px)) {
    .header-wrapper,
    .mobile-menu-inner,
    .footer-wrapper {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .mobile-menu {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .theme-modal-content {
        max-height: 80vh;
        max-height: 80dvh;
    }
    
    .theme-modal-header {
        padding: 0.875rem 1.25rem;
    }
    
    .theme-modal-body {
        padding: 0.75rem;
    }
    
    .theme-modal-item {
        padding: 0.75rem;
    }
}

/* Адаптация touch устройств */
@media (hover: none) and (pointer: coarse) {
    .nav-action-link:hover,
    .dropdown-toggle:hover,
    .unic-dropdown-toggle:hover,
    .mobile-menu-item:hover,
    .theme-modal-item:hover {
        transform: none;
    }
    
    .nav-action-link:active,
    .mobile-menu-item:active,
    .theme-modal-item:active {
        transform: scale(0.98);
    }
}

/* Режим высокой контрастности */
@media (prefers-contrast: high) {
    :root {
        --post-border: #000000;
        --input-border: #000000;
    }
    
    .nav-action-link,
    .dropdown-toggle,
    .unic-dropdown-toggle,
    .mobile-menu-item {
        border-width: 2px;
    }
}

/* Уменьшение движения для пользователей с motion sensitivity */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .notification-item {
        animation: none;
    }
}

/* Печать */
@media print {
    .site-header,
    .footer,
    .mobile-menu,
    .btn,
    .dropdown,
    .unic-dropdown,
    .theme-modal {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .main-content {
        padding: 0;
    }
}

/* Счетчик непрочитанных чатов */
.chat-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;
}

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

/* Для кнопки чатов нужна позиция relative */
.chat-link {
    position: relative;
}

/* Анимация пульсации для chat badge */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.5);
    }
}

/* Кнопки-иконки для авторизации */
.btn-icon {
    padding: 0.625rem;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
}

.btn-icon svg {
    flex-shrink: 0;
}

/* Убираем текст, оставляем только иконку */
.header-auth .btn-icon {
    gap: 0;
}

/* Hover эффекты для иконок */
.btn-icon:hover svg {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.btn-icon svg {
    transition: transform 0.2s ease;
}
