/* Светлая тема с фиолетовыми акцентами */
:root {
    --primary: #764AF1;
    --primary-light: #aa7ffd;
    --primary-rgb: 118, 74, 241;

    --bg: #FFFFFF;
    --bg-light: #F8F9FA;
    --bg-hover: #F1F3F5;

    --text: #1A1A2E;
    --text-secondary: #4A5568;
    --text-muted: #718096;

    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);

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

    --message-outgoing-bg: #E8E8ED;
    --message-outgoing-bg-hover: #DCDCE1;
    --message-outgoing-check-read: #5A9BD4;
}

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

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-light);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
    cursor: default;
}

/* Для мобильной версии используем clip вместо hidden, чтобы не создавать scroll-container */
@media (max-width: 991px) {
    html, body {
        overflow-x: clip;
    }
}
/* Навигация */
.navbar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.navbar-brand:hover {
    color: var(--primary) !important;
}

.brand-icon {
    font-size: 1.5rem;
    display: inline-block;
}

.brand-logo {
    width: 34px;
    height: 34px;
    display: block;
    object-fit: contain;
    border-radius: 8px;
}

.mobile-brand .brand-logo {
    width: 30px;
    height: 30px;
}

.brand-text {
    color: var(--primary);
}

.navbar-toggler {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2826, 26, 46, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-collapse {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    margin: 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.08);
}

.nav-link.active {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.1);
}

.nav-link i {
    font-size: 1.1rem;
}

.nav-text {
    font-size: 0.95rem;
}

.nav-link-badge {
    position: relative;
}

.nav-link-badge .unread-messages-badge,
.nav-link-badge .unread-notifications-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    min-width: 20px;
    max-width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    z-index: 10;
}

.badge {
    background: var(--primary);
    color: white;
    border-radius: 12px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(var(--primary-rgb), 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Действия навигации (справа) */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.navbar-actions .nav-item {
    display: flex;
    align-items: center;
}

.navbar-actions .btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.navbar-actions .btn-primary,
.mobile-auth-buttons .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    padding: 0.5rem 1.25rem;
}

.navbar-actions .btn-primary:hover,
.mobile-auth-buttons .btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.navbar-actions .btn-primary:active,
.mobile-auth-buttons .btn-primary:active {
    transform: translateY(0);
}

.navbar-actions .btn-outline-primary,
.mobile-auth-buttons .btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
    padding: 0.5rem 1.25rem;
}

.navbar-actions .btn-outline-primary:hover,
.mobile-auth-buttons .btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Мобильная верхняя панель */
.mobile-top-bar {
    display: none;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1001;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip; /* clip вместо hidden - не создает scroll-container */
}

.mobile-top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    overflow-x: clip; /* clip вместо hidden - не создает scroll-container */
}

.mobile-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.mobile-auth-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mobile-auth-buttons .btn {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn i {
    font-size: 1.125rem;
}

.mobile-menu-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.footer-modern {
    background: #1a1a1a;
    color: #ffffff;
    padding: 4rem 0 2rem;
    margin-top: 6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.footer-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 4rem;
    align-items: start;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

.footer-logo .brand-icon {
    font-size: 1.75rem;
}

.footer-logo .brand-text {
    background: linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-nav {
    display: flex;
    gap: 4rem;
    justify-content: center;
}

.footer-nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
    width: fit-content;
}

.footer-nav-link:hover {
    color: #ffffff;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
}

.footer-contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
}

.footer-contact-link:hover {
    color: #ffffff;
}

.footer-contact-link i {
    font-size: 1rem;
    opacity: 0.8;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-copyright {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 1.125rem;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.social-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 991px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .footer-nav {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 2rem;
    }

    .footer-contact {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .footer-modern {
        padding: 3rem 0 1.5rem;
        margin-top: 4rem;
    }

    .footer-wrapper {
        gap: 2rem;
    }

    .footer-top {
        gap: 2.5rem;
    }

    .footer-nav {
        flex-direction: column;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }

    .footer-social {
        align-self: flex-start;
    }
}

/* Публичные layout: переключение desktop / mobile nav */
@media (max-width: 991.98px) {
    .desktop-nav {
        display: none !important;
    }

    .mobile-top-bar {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .mobile-top-bar {
        display: none !important;
    }
}
