/* Общие стили страницы */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f0f2f5;
    color: #333;
}

/* Шапка сайта */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
}

.header a {
    text-decoration: none;
}

/* Кнопки в шапке */
.button, .button-primary, .button-success, .button-danger, .button-small {
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    display: inline-block;
}

.button-primary {
    background: #0066cc;
    color: white;
}

.button-primary:hover {
    background: #0052a3;
    transform: translateY(-1px);
}

.button-success {
    background: #28a745;
    color: white;
}

.button-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

.button-danger {
    background: #dc3545;
    color: white;
}

.button-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.button-small {
    padding: 5px 12px;
    font-size: 0.85em;
    margin-right: 5px;
}

/* Сетка карточек */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

/* Карточка объявления */
.ad-card {
    background: white;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Ссылка-обёртка внутри карточки */
.ad-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
    min-height: 0;
}

.ad-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* Блок с фото */
.ad-image-container {
    width: 100%;
    height: 180px;
    min-height: 180px;
    max-height: 180px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
    background: #f0f0f0;
}

.ad-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.ad-image-placeholder {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    font-size: 2em;
    color: #999;
}

/* Контент карточки */
.ad-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ad-title {
    font-size: 1.05em;
    margin: 4px 0;
    color: #1a1a1a;
    font-weight: 600;
    line-height: 1.3;
    overflow: visible;
}

.ad-description {
    color: #4a5568;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9em;
    flex: 1;
}

.ad-price {
    font-size: 1.3em;
    font-weight: bold;
    color: #0066cc;
    margin: 4px 0;
    flex-shrink: 0;
}

.ad-meta {
    font-size: 0.85em;
    color: #666;
    margin-top: auto;
    padding-top: 4px;
    flex-shrink: 0;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* ============ Responsive ============ */

/* Планшет: 2 колонки */
@media (max-width: 900px) {
    .ads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    body {
        padding: 15px;
    }
}

/* Мобильные: 1 колонка */
@media (max-width: 600px) {
    .ads-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body {
        padding: 10px;
    }

    .header {
        padding: 12px 15px;
        gap: 8px;
    }

    .button, .button-primary, .button-success, .button-danger {
        padding: 8px 16px;
        font-size: 0.85em;
    }

    .ad-card {
        padding: 10px;
    }

    .ad-image-container,
    .ad-image,
    .ad-image-placeholder,
    .ad-image-container img {
        height: 180px;
    }

    .ad-title {
        font-size: 1.05em;
    }

    .ad-price {
        font-size: 1.2em;
    }

    .site-footer {
        padding: 15px;
        border-radius: 8px;
    }

    .site-footer a {
        display: block;
        margin: 5px 0;
    }
}
/* Футер */
.site-footer {
    margin-top: 40px;
    padding: 20px 30px;
    background: #2d3748;
    border-radius: 12px;
    text-align: center;
    color: #cbd5e0;
    font-size: 0.85em;
}

.site-footer a {
    color: #90cdf4;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #ffffff;
}

.site-footer .copyright {
    margin-top: 8px;
    color: #a0aec0;
}
