/* ==================== */
/* ОСНОВНЫЕ ПЕРЕМЕННЫЕ И СБРОС СТИЛЕЙ */
/* ==================== */
: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;
}

.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;
}

.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;
}

/* ==================== */
/* ХЛЕБНЫЕ КРОШКИ */
/* ==================== */
.breadcrumbs {
    padding: 15px 0;
    font-size: 14px;
}

.breadcrumbs a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumbs a:hover {
    color: var(--primary-green);
}

.breadcrumbs span {
    color: var(--dark-gray);
    margin: 0 5px;
}

/* ==================== */
/* ОСНОВНОЕ СОДЕРЖИМОЕ ОБЪЯВЛЕНИЯ */
/* ==================== */
.ad-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0 40px;
}

@media (min-width: 992px) {
    .ad-content {
        flex-direction: row;
    }
}

/* ==================== */
/* ГАЛЕРЕЯ ИЗОБРАЖЕНИЙ */
/* ==================== */
.ad-gallery {
    flex: 1;
    min-width: 0;
}

.main-image {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    background-color: var(--content-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.thumbnail-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.thumbnail {
    height: 70px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    background-color: var(--content-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail.active {
    border-color: var(--primary-green);
}

/* ==================== */
/* ДЕТАЛИ ОБЪЯВЛЕНИЯ */
/* ==================== */
.ad-details {
    flex: 1;
    min-width: 0;
}

.ad-header {
    background-color: var(--content-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.ad-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.ad-price {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 15px;
}

.ad-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-light);
}

.ad-meta-item {
    display: flex;
    align-items: center;
}

.ad-meta-item i {
    margin-right: 5px;
    color: var(--primary-green);
}

.ad-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.ad-actions .btn {
    flex: 1;
    text-align: center;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
}

.btn-outline:hover {
    background-color: var(--primary-green);
    color: white;
}

.btn-red {
    background-color: var(--accent-red);
}

.btn-red:hover {
    background-color: #a00d25;
}

.ad-description {
    background-color: var(--content-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.ad-description h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-green);
}

.ad-description p {
    margin-bottom: 15px;
    line-height: 1.7;
}

/* ==================== */
/* ХАРАКТЕРИСТИКИ */
/* ==================== */
.ad-specs {
    background-color: var(--content-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.ad-specs h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-green);
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--medium-gray);
}

.spec-name {
    color: var(--text-light);
    font-weight: 500;
}

.spec-value {
    font-weight: 600;
}

/* ==================== */
/* ИНФОРМАЦИЯ О ПРОДАВЦЕ */
/* ==================== */
.seller-info {
    background-color: var(--content-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.seller-info h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-green);
}

.seller-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.seller-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
    background-color: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.seller-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.seller-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.seller-meta {
    font-size: 14px;
    color: var(--text-light);
}

.seller-meta i {
    color: var(--primary-green);
    margin-right: 5px;
}

.seller-stats {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    padding: 15px 0;
    border-top: 1px solid var(--medium-gray);
    border-bottom: 1px solid var(--medium-gray);
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-green);
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.seller-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==================== */
/* ПОХОЖИЕ ОБЪЯВЛЕНИЯ */
/* ==================== */
.similar-ads {
    margin-top: 40px;
}

.section-title {
    font-size: 22px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-green);
}

.ads-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (min-width: 768px) {
    .ads-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .ads-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.ad-card {
    background-color: var(--content-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.ad-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ad-card-image {
    height: 160px;
    overflow: hidden;
    position: relative;
}

.ad-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.ad-card:hover .ad-card-image img {
    transform: scale(1.05);
}

.ad-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--accent-red);
    color: white;
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 10px;
    font-weight: 600;
}

.ad-card-details {
    padding: 12px;
}

.ad-card-price {
    font-weight: bold;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 5px;
}

.ad-card-title {
    font-size: 14px;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.ad-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
}

/* ==================== */
/* ПОДВАЛ САЙТА */
/* ==================== */
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;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

.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);
}

/* ==================== */
/* АДАПТИВНЫЕ СТИЛИ */
/* ==================== */
@media (max-width: 767px) {
    .main-image {
        height: 300px;
    }

    .specs-grid {
        grid-template-columns: 1fr;
    }

    .ad-actions {
        flex-direction: column;
    }
}

/* ==================== */
/* ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ */
/* ==================== */
.text-green {
    color: var(--primary-green);
}

.text-red {
    color: var(--accent-red);
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none;
}

/* ==================== */
/* МОДАЛЬНЫЕ ОКНА (ВХОД/РЕГИСТРАЦИЯ) */
/* ==================== */
.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;
}

/* ==================== */
/* ОБЩИЕ СТИЛИ МОДАЛЬНЫХ ОКОН */
/* ==================== */
.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);
}

/* ==================== */
/* МОБИЛЬНАЯ АДАПТАЦИЯ */
/* ==================== */
@media (max-width: 767px) {
    /* Шапка */
    .header-top {
        padding: 10px 0;
        flex-wrap: wrap;
    }
    
    .logo {
        font-size: 18px;
        margin-bottom: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .user-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-actions a {
        margin-left: 0;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .user-actions a i {
        font-size: 14px;
        margin-right: 3px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Хлебные крошки */
    .breadcrumbs {
        font-size: 12px;
        padding: 10px 0;
        white-space: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Галерея */
    .main-image {
        height: 250px;
    }
    
    .thumbnail-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .thumbnail {
        height: 60px;
    }
    
    /* Детали объявления */
    .ad-title {
        font-size: 20px;
    }
    
    .ad-price {
        font-size: 24px;
    }
    
    .ad-meta {
        font-size: 12px;
        gap: 10px;
    }
    
    .ad-actions {
        flex-direction: column;
    }
    
    .ad-actions .btn {
        width: 100%;
    }
    
    /* Описание и характеристики */
    .ad-description,
    .ad-specs,
    .seller-info {
        padding: 15px;
    }
    
    .ad-description h3,
    .ad-specs h3,
    .seller-info h3 {
        font-size: 16px;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    /* Информация о продавце */
    .seller-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .seller-avatar {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .seller-stats {
        flex-wrap: wrap;
    }
    
    .stat-item {
        flex: 0 0 50%;
        margin-bottom: 10px;
    }
    
    .seller-actions .btn {
        width: 100%;
    }
    
    /* Похожие объявления */
    .ads-grid {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    /* Подвал */
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .footer-column {
        margin-bottom: 20px;
    }
    
    .footer-column h3 {
        font-size: 16px;
    }
    
    .footer-links a {
        font-size: 13px;
    }
    
    /* Модальные окна */
    .modal-content {
        padding: 20px;
        max-width: 95%;
    }
    
    .auth-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .auth-form input {
        padding: 8px 10px;
    }
    
    /* Кнопка выхода - исправление цвета */
    .profile-menu .logout-link {
        color: var(--danger-red) !important;
        background: none !important;
    }
    
    .profile-menu .logout-link:hover {
        color: white !important;
        background-color: var(--danger-red) !important;
    }
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    .main-image {
        height: 200px;
    }
    
    .thumbnail-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ad-title {
        font-size: 18px;
    }
    
    .ad-price {
        font-size: 22px;
    }
    
    .user-actions a span.user-icon-text {
        display: none;
    }
    
    .user-actions a i {
        margin-right: 0;
        font-size: 16px;
    }
    
    .btn-post-ad span.user-icon-text {
        display: none;
    }
}