
/* ==================== */
/* ПЕРЕМЕННЫЕ И СБРОС СТИЛЕЙ */
/* ==================== */


:root {
    --primary-green: #007A33;
    --accent-red: #C8102E;
    --neutral-white: #FFFFFF;
    --light-bg: #f4f6f9;
    --content-bg: #FFFFFF;
    --medium-gray: #e0e3e8;
    --dark-gray: #6c757d;
    --text-color: #212529;
    --text-light: #495057;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --warning-orange: #ffc107;
    --info-blue: #17a2b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ============= */
/* ШАПКА САЙТА */
/* ============= */
header {
    background-color: var(--content-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--medium-gray);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
}

.logo-abkhaz {
    color: var(--text-color);
}

.logo-avito {
    color: var(--accent-red);
}

.logo-aps {
    color: var(--primary-green);
    font-size: 0.7em;
    vertical-align: super;
    margin-left: 2px;
}

/* ============= */
/* ПОИСКОВАЯ СТРОКА */
/* ============= */
.search-bar-container {
    padding: 10px 0;
    background-color: var(--content-bg);
}

.search-bar {
    display: flex;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-bar input {
    flex-grow: 1;
    padding: 10px 15px;
    padding-left: 40px;
    border: 1px solid var(--medium-gray);
    border-radius: 25px 0 0 25px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
}

.search-bar input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 122, 51, 0.2);
}

.search-bar .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark-gray);
}

.search-bar .search-button {
    padding: 10px 20px;
    background-color: var(--primary-green);
    color: var(--neutral-white);
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

/* ============= */
/* ПАНЕЛЬ ПОЛЬЗОВАТЕЛЯ */
/* ============= */
.user-actions {
    display: flex;
    align-items: center;
}

.user-actions a {
    margin-left: 12px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    font-size: 14px;
    transition: color 0.3s;
}

.user-actions a:hover {
    color: var(--primary-green);
}

.user-actions a i {
    margin-right: 5px;
    font-size: 16px;
}

.user-actions .user-icon-text {
    display: none;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    color: white;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-green {
    background-color: var(--primary-green);
}

.btn-green:hover {
    background-color: #005c27;
}

/* ================ */
/* ГЛАВНОЕ МЕНЮ */
/* ================ */
nav {
    background-color: var(--content-bg);
    padding: 10px 0;
    border-top: 1px solid var(--medium-gray);
    display: none;
}

nav.active {
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.nav-links::-webkit-scrollbar {
    height: 4px;
}

.nav-links::-webkit-scrollbar-thumb {
    background-color: var(--medium-gray);
    border-radius: 4px;
}

.nav-links li {
    margin-right: 10px;
}

.nav-links li:last-child {
    margin-right: 0;
}

.nav-links a {
    display: block;
    padding: 8px 15px;
    background-color: var(--light-bg);
    border-radius: 20px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: var(--primary-green);
    color: white;
}

.nav-links a i {
    margin-right: 6px;
}

/* ================= */
/* ОСНОВНОЕ СОДЕРЖИМОЕ */
/* ================= */
.main-content-wrapper {
    padding: 20px 0;
}

.main-content {
    display: flex;
    flex-direction: column;
}

/* ============== */
/* БОКОВАЯ ПАНЕЛЬ */
/* ============== */
.sidebar-toggle-btn {
    display: none;
    width: 100%;
    padding: 12px;
    background-color: var(--primary-green);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 20px;
    cursor: pointer;
}

.sidebar-toggle-btn i {
    margin-right: 8px;
}

.sidebar {
    width: 100%;
    margin-bottom: 20px;
    display: none;
}

.sidebar.active {
    display: block;
}

.sidebar-section {
    background-color: var(--content-bg);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.sidebar-title {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-green);
}

.sidebar-title i {
    margin-right: 10px;
    color: var(--primary-green);
}

/* ============== */
/* КАТЕГОРИИ */
/* ============== */
.categories-list {
    list-style: none;
}

.categories-list li {
    margin-bottom: 5px;
    position: relative;
}

.categories-list>li>a,
.category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-light);
    text-decoration: none;
    padding: 10px 5px;
    border-radius: 5px;
    transition: all 0.3s;
    font-weight: 500;
}

.categories-list>li>a:hover,
.category-link:hover {
    background-color: var(--light-bg);
    color: var(--primary-green);
}

.categories-list>li>a.active,
.category-link.active {
    background-color: var(--primary-green);
    color: white;
}

.categories-list>li>a.active i,
.category-link.active i {
    color: white;
}

.categories-list a i.category-icon,
.category-link i.category-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: var(--primary-green);
}

.categories-list a i.fa-chevron-down,
.category-link i.fa-chevron-down {
    transition: transform 0.3s;
}

.categories-list a.active i.fa-chevron-down,
.category-link.active i.fa-chevron-down {
    transform: rotate(180deg);
}

.subcategories {
    list-style: none;
    padding-left: 25px;
    margin-top: 0px;
    display: none;
    background-color: #fafafa;
    border-radius: 0 0 5px 5px;
    padding-bottom: 5px;
}

.subcategories.show {
    display: block;
}

.subcategories li {
    margin-bottom: 0;
}

.subcategories a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 4px;
}

.subcategories a:hover {
    background-color: var(--medium-gray);
    color: var(--primary-green);
}

.subcategories a i {
    margin-right: 8px;
    color: var(--dark-gray);
    font-size: 12px;
}

/* ================ */
/* ФИЛЬТРЫ */
/* ================ */
.filter-group {
    margin-bottom: 20px;
}

.filter-group h4 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.price-range,
.year-range,
.mileage-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-range input,
.year-range input,
.mileage-range input,
.filter-group select,
.filter-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--medium-gray);
    border-radius: 5px;
    font-size: 14px;
}

.price-range span,
.year-range span,
.mileage-range span {
    color: var(--dark-gray);
}

.checkbox-group label,
.radio-group label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-group input,
.radio-group input {
    margin-right: 10px;
    accent-color: var(--primary-green);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.filter-buttons .btn {
    flex-grow: 1;
    padding: 12px;
}

.btn-reset {
    background-color: var(--dark-gray);
}

.btn-reset:hover {
    background-color: #ffffff;
}

/* ======================== */
/* СПИСОК ОБЪЯВЛЕНИЙ */
/* ======================== */
.advertisements-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(300px, auto);
    gap: 20px;
    width: 100%;
}

.advertisement-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.advertisement-card:hover {
    transform: translateY(-5px);
}

.ad-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.advertisement-card:hover .ad-image img {
    transform: scale(1.05);
}

.ad-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--accent-red);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.ad-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(206, 199, 199, 0.5);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.ad-favorite.active i {
    color: var(--warning-orange);
}

.ad-details {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.ad-price {
    font-weight: bold;
    font-size: 20px;
    color: #333;
    margin-bottom: 5px;
}

.ad-location,
.ad-date {
    color: #666;
    font-size: 14px;
    margin-bottom: 3px;
}

.no-ads {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--content-bg);
    border-radius: 10px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
    grid-column: 1 / -1;
}

.no-ads i {
    font-size: 40px;
    color: var(--primary-green);
    margin-bottom: 15px;
}

.no-ads p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* ============= */
/* ПАГИНАЦИЯ */
/* ============= */
.pagination {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 4px;
    border-radius: 50%;
    background-color: var(--content-bg);
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    margin-bottom: 5px;
    font-size: 14px;
}

.pagination a:hover,
.pagination a.active {
    background-color: var(--primary-green);
    color: white;
}

/* ============= */
/* ПОДВАЛ САЙТА */
/* ============= */
footer {
    background-color: #2a3f54;
    color: #bdc3c7;
    padding: 40px 0 20px;
    margin-top: 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-column h3 {
    font-size: 18px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
    color: var(--neutral-white);
}

.footer-column h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: var(--accent-red);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
}

.social-links {
    display: flex;
    margin-top: 15px;
    gap: 10px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s;
}

.social-links a:hover {
    background-color: var(--accent-red);
    transform: translateY(-3px);
}

/* ==================== */
/* МОДАЛЬНЫЕ ОКНА */
/* ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1050;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.modal-content {
    background-color: var(--content-bg);
    border-radius: 10px;
    width: 100%;
    max-width: 420px;
    padding: 25px 30px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    animation: modalFadeIn 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 28px;
    color: var(--dark-gray);
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--accent-red);
}

/* ==================== */
/* ФОРМА АВТОРИЗАЦИИ */
/* ==================== */
.auth-title {
    text-align: center;
    margin-bottom: 25px;
    color: var(--primary-green);
    font-size: 22px;
    font-weight: 600;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form label {
    display: block;
    margin-bottom: 7px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-light);
}

.auth-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--medium-gray);
    border-radius: 5px;
    font-size: 15px;
    transition: all 0.3s;
}

.auth-form input:focus {
    border-color: var(--primary-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 51, 0.2);
}

.auth-btn {
    background-color: var(--primary-green);
    color: white;
    border: none;
    padding: 12px;
    width: 100%;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.auth-btn:hover {
    background-color: #005c27;
}

.auth-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--medium-gray);
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.error-message {
    color: var(--danger-red);
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

/* ==================== */
/* АДАПТИВНЫЕ СТИЛИ */
/* ==================== */
@media (max-width: 767px) {
    .user-actions .btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .user-actions .btn i {
        margin-right: 3px;
    }

    .user-actions a.user-login-link {
        font-size: 0;
    }

    .user-actions a.user-login-link i {
        margin-right: 0;
    }

    .user-actions .user-icon-fav {
        font-size: 0;
    }

    .user-actions .user-icon-fav i {
        margin-right: 0;
    }

    .search-bar-container {
        border-top: 1px solid var(--medium-gray);
    }

    nav {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100%;
        background-color: var(--content-bg);
        z-index: 1001;
        overflow-y: auto;
        padding-top: 60px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease-in-out;
    }

    nav.active {
        left: 0;
    }

    .nav-links {
        flex-direction: column;
        padding: 15px;
        white-space: normal;
        overflow-x: hidden;
    }

    .nav-links li {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .nav-links a {
        padding: 12px 15px;
        font-size: 16px;
    }

    .close-nav-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        font-size: 24px;
        background: none;
        border: none;
        color: var(--dark-gray);
    }

    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .advertisements-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .advertisement-card {
        flex-direction: column;
    }

    .ad-image {
        width: 100%;
        height: 180px;
    }

    .ad-details {
        width: 100%;
    }

    .pagination a {
        padding: 6px 10px;
        margin: 3px;
    }
}

@media (min-width: 576px) {
    .advertisements-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .user-actions .user-icon-text {
        display: inline;
    }

    .search-bar-container {
        padding: 0;
        border-top: none;
    }

    .header-top {
        flex-wrap: nowrap;
    }

    .search-bar {
        order: -1;
        margin: 0 20px;
        flex-grow: 1;
    }

    nav {
        display: block;
        position: static;
        width: auto;
        height: auto;
        overflow-y: visible;
        padding-top: 10px;
        box-shadow: none;
        left: auto;
        transition: none;
    }

    .nav-links {
        flex-direction: row;
        padding: 0;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
    }

    .nav-links li {
        margin-right: 10px;
        margin-bottom: 0;
    }

    .nav-links a {
        padding: 8px 15px;
        font-size: 14px;
    }

    .close-nav-btn {
        display: none;
    }

    .mobile-menu-btn {
        display: none;
    }

    .main-content {
        flex-direction: row;
        gap: 20px;
    }

    .sidebar {
        display: block;
        flex: 0 0 280px;
        margin-bottom: 0;
    }

    .sidebar-toggle-btn {
        display: none;
    }
}

@media (min-width: 992px) {
    .advertisements-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .sidebar {
        flex: 0 0 300px;
    }

    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============== */
/* АНИМАЦИИ */
/* ============== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.new-ads {
    animation: fadeIn 0.5s ease-out;
}

