:root {
    /* Обновленная цветовая схема с HSL для лучшего контроля */
    --primary: hsl(204, 70%, 53%);
    --primary-dark: hsl(204, 70%, 43%);
    --primary-light: hsl(204, 70%, 73%);
    --primary-extra-light: hsl(204, 46%, 44%);
    --secondary: hsl(6, 78%, 57%);
    --secondary-dark: hsl(6, 78%, 47%);
    --success: hsl(145, 63%, 49%);
    --success-dark: hsl(145, 63%, 39%);
    --warning: hsl(36, 100%, 50%);
    --danger: hsl(6, 78%, 57%);
    --danger-dark: hsl(6, 78%, 47%);
    --info: hsl(204, 70%, 53%);
    --light: hsl(240, 7%, 97%);
    --dark: hsl(210, 29%, 24%);
    --gray: hsl(184, 9%, 62%);
    --gray-light: hsl(204, 17%, 79%);
    --border: hsl(204, 16%, 94%);
    
    /* Тени с улучшенной иерархией */
    --shadow-xs: 0 1px 2px hsla(0, 0%, 0%, 0.05);
    --shadow-sm: 0 1px 3px hsla(0, 0%, 0%, 0.1);
    --shadow-md: 0 4px 6px hsla(0, 0%, 0%, 0.1);
    --shadow-lg: 0 10px 15px hsla(0, 0%, 0%, 0.1);
    --shadow-xl: 0 20px 25px hsla(0, 0%, 0%, 0.1);
    --shadow-modal: 0 5px 15px hsla(0, 0%, 0%, 0.2);
    --shadow-inner: inset 0 2px 4px hsla(0, 0%, 0%, 0.05);
    
    /* Радиусы с системным подходом */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;
    --radius-circle: 50%;
    
    /* Отступы с 8px системой */
    --space-xxs: 0.25rem;  /* 4px */
    --space-xs: 0.5rem;    /* 8px */
    --space-sm: 0.75rem;   /* 12px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-xxl: 3rem;     /* 48px */
    
    /* Транзишены и анимации */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --animation-duration: 0.3s;
    
    /* Типографика */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --text-base: 1rem;
    --text-sm: 0.875rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --leading-normal: 1.5;
    --leading-tight: 1.25;
}

/* Базовые стили */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--dark);
    background-color: var(--light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Улучшенные стили для навигации */
.navbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.navbar::-webkit-scrollbar {
    display: none;
}

.nav-link {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xxs);
    font-size: var(--text-sm);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 70%;
}

/* Стили для конкретных кнопок */
.login-btn {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: var(--space-xs) var(--space-sm);
}

.login-btn:hover {
    background: var(--primary);
    color: white;
}

.register-btn {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
    padding: var(--space-xs) var(--space-sm);
}

.register-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.buy-link {
    color: var(--success-dark);
}

.buy-link::after {
    background: var(--success);
}

.buy-link:hover {
    color: var(--success-dark);
}

.sell-link {
    background: var(--secondary);
    color: white !important;
    box-shadow: var(--shadow-sm);
    padding: var(--space-xs) var(--space-sm);
}

.sell-link::after {
    display: none;
}

.sell-link:hover {
    background: var(--secondary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.profile-link {
    color: var(--primary-dark);
}

.profile-link::after {
    background: var(--primary);
}

.logout-link {
    color: var(--danger);
}

.logout-link::after {
    background: var(--danger);
}

.logout-link:hover {
    color: var(--danger-dark);
}

/* Хедер с улучшенной sticky-логикой */
.header {
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--space-sm) 0;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.9);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.logo {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all var(--transition-normal);
}

.logo:hover {
    color: var(--primary-dark);
    transform: scale(1.02);
}

/* Стили для бургер-меню */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--dark);
    font-size: var(--text-xl);
    cursor: pointer;
    padding: var(--space-xs);
    z-index: 1001;
}

.mobile-menu-btn i {
    transition: transform var(--transition-fast);
}

.mobile-menu-btn.active i {
    transform: rotate(90deg);
}

/* Основной контент с улучшенной читаемостью */
.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
    background: linear-gradient(to bottom, var(--light), white);
}

/* Модальные окна с современным дизайном */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 1050;
    padding: var(--space-md);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-modal);
    transform: translateY(-20px);
    transition: all var(--transition-normal);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: var(--text-xl);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    cursor: pointer;
    color: var(--gray);
    transition: color var(--transition-fast);
    line-height: 1;
    padding: var(--space-xs);
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: var(--space-md);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: var(--text-sm);
}

/* Формы с улучшенной UX */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--dark);
}

.form-group input {
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-extra-light);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    width: 100%;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Флеш-сообщения */
.flash-messages {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-width: 400px;
    width: 100%;
}

.flash-message {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideIn var(--animation-duration) ease forwards;
    position: relative;
    overflow: hidden;
    font-size: var(--text-sm);
}

.flash-message::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.flash-message.flash-success {
    color: var(--success-dark);
}

.flash-message.flash-error {
    color: var(--danger-dark);
}

.flash-message.flash-warning {
    color: var(--warning);
}

.flash-message.flash-info {
    color: var(--info);
}

.flash-message.hide {
    animation: slideOut var(--animation-duration) ease forwards;
}

.flash-icon {
    font-size: var(--text-lg);
}

.flash-close {
    background: none;
    border: none;
    margin-left: auto;
    color: inherit;
    cursor: pointer;
    font-size: var(--text-lg);
    line-height: 1;
    padding: var(--space-xxs);
    transition: opacity var(--transition-fast);
}

.flash-close:hover {
    opacity: 0.7;
}

/* Футер с улучшенной структурой */
.footer {
    background: var(--dark);
    color: white;
    padding: var(--space-xl) 0 var(--space-md);
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.footer-logo {
    font-size: var(--text-xl);
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.footer-description {
    color: var(--gray-light);
    line-height: var(--leading-tight);
}

.social-links {
    display: flex;
    gap: var(--space-sm);
}

.social-links a {
    color: var(--gray-light);
    font-size: var(--text-lg);
    transition: color var(--transition-fast);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
}

.social-links a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.footer-title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
    position: relative;
    padding-bottom: var(--space-xs);
    color: white;
}

.footer-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background: var(--secondary);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.footer-links a {
    color: var(--gray-light);
    text-decoration: none;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xxs) 0;
}

.footer-links a:hover {
    color: white;
    transform: translateX(var(--space-xxs));
}

.footer-links i {
    font-size: var(--text-sm);
    transition: transform var(--transition-fast);
}

.footer-links a:hover i {
    transform: translateX(2px);
}

.footer-contacts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-contacts li {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--gray-light);
    line-height: var(--leading-tight);
}

.footer-contacts i {
    flex-shrink: 0;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray-light);
    font-size: var(--text-sm);
}

/* Анимации */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

.register-btn, .sell-link {
    animation: pulse 2s infinite;
}

.register-btn:hover, .sell-link:hover {
    animation: none;
}

/* Стили для кнопки ОСАГО */
.nav-link.osago-link {
    color: #3b82f6;
    transition: all var(--transition-normal);
}

.nav-link.osago-link:hover {
    color: #2563eb;
    background-color: rgba(59, 130, 246, 0.1);
}

.nav-link.osago-link i {
    margin-right: var(--space-xs);
}

.nav-link.osago-link.active {
    color: #1d4ed8;
    font-weight: 600;
    border-bottom: 2px solid #1d4ed8;
}

.footer-links li a[href*="osago"] i {
    color: #3b82f6;
}

.footer-links li a[href*="osago"]:hover {
    color: #2563eb;
}

/* Стили для кнопки Контакты */
.nav-link.contact-link {
    color: var(--info);
    transition: all var(--transition-normal);
}

.nav-link.contact-link:hover {
    color: var(--primary-dark);
    background-color: var(--primary-extra-light);
}

.nav-link.contact-link i {
    margin-right: var(--space-xs);
}

.nav-link.contact-link.active {
    color: var(--primary-dark);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-dark);
}

.footer-links li a[href*="contact"] i {
    color: var(--info);
}

.footer-links li a[href*="contact"]:hover {
    color: var(--primary);
}

/* Стили для кнопки Донат */
.nav-link.donate-link {
    color: #e91e63;
    transition: all var(--transition-normal);
}

.nav-link.donate-link:hover {
    color: #c2185b;
    background-color: rgba(233, 30, 99, 0.1);
}

.nav-link.donate-link i {
    margin-right: var(--space-xs);
}

.nav-link.donate-link.active {
    color: #c2185b;
    font-weight: 600;
    border-bottom: 2px solid #c2185b;
}

.footer-links li a[href*="donate"] i {
    color: #e91e63;
}

.footer-links li a[href*="donate"]:hover {
    color: #c2185b;
}

/* Адаптивность */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }
    
    .mobile-menu-btn {
        display: flex;
        position: absolute;
        right: var(--space-md);
        top: 50%;
        transform: translateY(-50%);
    }
    
    .navbar {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: var(--space-md) 0;
        background: white;
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: var(--shadow-md);
        z-index: 999;
    }
    
    .navbar.active {
        display: flex;
    }
    
    .nav-link {
        width: 100%;
        padding: var(--space-sm) var(--space-md);
        border-radius: 0;
    }
    
    .nav-link:hover {
        background-color: var(--primary-extra-light);
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .flash-messages {
        left: var(--space-md);
        right: var(--space-md);
        max-width: none;
    }

    /* Улучшенный аккордеон для футера с иконками + и − */
.footer-section {
    position: relative;
    padding: 0;
    margin-bottom: var(--space-sm);
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.footer-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--transition-fast);
}

.footer-accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.footer-title {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0;
    color: white;
    pointer-events: none;
    transition: color var(--transition-fast);
    padding: 0;
}

.footer-title::after {
    display: none;
}

.footer-accordion-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    position: relative;
    color: white;
    font-size: 1.25rem;
    font-weight: 400;
    transition: all var(--transition-normal);
}

.footer-links,
.footer-contacts {
    max-height: 0;
    overflow: hidden;
    padding: 0 var(--space-lg);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                padding 0.3s ease;
    will-change: max-height;
}

.footer-section.active {
    background-color: rgba(255, 255, 255, 0.08);
}

.footer-section.active .footer-links,
.footer-section.active .footer-contacts {
    max-height: 1000px;
    padding: 0 var(--space-lg) var(--space-md);
}

.footer-links li a,
.footer-contacts li {
    padding: var(--space-xs) 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity var(--transition-normal), 
                transform var(--transition-normal);
}

.footer-section.active .footer-links li a,
.footer-section.active .footer-contacts li {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

    /* Цвета индикаторов для разных секций */
    .footer-section:nth-child(1) .footer-accordion-indicator::before {
        color: var(--primary);
    }

    .footer-section:nth-child(2) .footer-accordion-indicator::before {
        color: var(--success);
    }

    .footer-section:nth-child(3) .footer-accordion-indicator::before {
        color: var(--secondary);
    }

    .footer-section:nth-child(4) .footer-accordion-indicator::before {
        color: var(--warning);
    }

    .footer-brand {
        padding-bottom: var(--space-md);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 480px) {
    :root {
        --space-md: 0.75rem;
        --space-lg: 1.25rem;
        --space-xl: 1.5rem;
    }
    
    .modal-content {
        border-radius: var(--radius-lg);
    }
    
    .footer-links a {
        font-size: var(--text-sm);
    }
    
    .nav-link.osago-link span,
    .nav-link.contact-link span,
    .nav-link.donate-link span {
        display: none;
    }
    
    .nav-link.osago-link i,
    .nav-link.contact-link i,
    .nav-link.donate-link i {
        margin-right: 0;
        font-size: var(--text-lg);
    }
}

/* Контактные кнопки */
.contact-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 15px;
    border-radius: 5px;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.whatsapp-btn {
    background-color: #25D366;
}

.telegram-btn {
    background-color: #0088cc;
}

.phone-number {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-time {
    margin-top: 15px;
    color: #666;
    font-size: 0.9em;
}