/* ============================================================
   wanted-parts.css
   Общие стили для фичи "Разыскиваемые запчасти":
   - pages/part-requests/part-requests.php  (лента)
   - pages/needed_part.php                  (страница одного запроса)
   Подключается условно в index.php только на этих двух роутах.
   ============================================================ */

/* ===== Разыскиваемые запчасти — карточки-бирки ===== */

.pr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px 24px;
}

/* Переопределение только для этой страницы — файл подключается только на /part-requests и /needed-part,
   на главную (home.php) не влияет, хотя класс общий */
.sp_search-container {
    padding: 14px;
}

.pr-ticket {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #FFFFFF;
    border: 1px solid #E2DFD6;
    border-radius: 10px;
    text-decoration: none;
    color: #1F2421;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    overflow: hidden;
}

.pr-ticket:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(31, 36, 33, 0.08);
    border-color: #629dd1;
}

.pr-ticket-photo {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    align-self: center;
    background: #F3F1EA;
    border-right: 1px solid #E2DFD6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pr-ticket-body {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.pr-ticket-title {
    font-family: 'Roboto', Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: #1F2421;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Категория — небольшая бирка с почти прямыми углами (перекликается с квадратным фото) */
.pr-ticket-cat {
    display: inline-block;
    font-family: 'Roboto Condensed', 'Roboto', Helvetica, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6B7280;
    background: #F3F1EA;
    border: 1px solid #E2DFD6;
    border-radius: 3px;
    padding: 2px 7px;
    margin-bottom: 3px;
}

/* Марка/модель/кузов — выделено заливкой в фирменный синий, чтобы бросалось в глаза */
.pr-ticket-car {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #2c5f8a;
    background: #EAF2FA;
    border-radius: 4px;
    padding: 3px 7px;
    margin-bottom: 3px;
}

.pr-ticket-meta {
    font-size: 10px;
    color: #6B7280;
    font-variant-numeric: tabular-nums;
}

.pr-empty {
    text-align: center;
    padding: 60px 20px 40px;
}

.pr-empty-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border: 1.5px dashed #C4C1B6;
    border-radius: 50%;
    font-family: 'Roboto Condensed', 'Roboto', Helvetica, sans-serif;
    font-weight: 700;
    color: #A9A69B;
}

.pr-empty-title {
    font-size: 17px;
    font-weight: 500;
    color: #1F2421;
    margin: 0 0 6px;
}

.pr-empty-text {
    font-size: 14px;
    color: #6B7280;
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .pr-grid {
        grid-template-columns: 1fr;
        padding: 4px 15px 40px;
    }
}

@media (max-width: 420px) {
    .sp_filters-row .sp_dropdown,
    .sp_filters-row .sp_condition {
        width: 100%;
    }
}

/* ---- Стили страницы одного запроса (needed_part.php) ---- */

:root {
    --pd-bg: #F3F1EA;
    --pd-surface: #FFFFFF;
    --pd-ink: #1F2421;
    --pd-steel: #6B7280;
    --pd-line: #E2DFD6;
    --pd-accent: #629dd1;
    --pd-accent-dark: #528bbf;
}

.pd-page { padding-bottom: 24px; }
.pd-page.pd-has-composer { padding-bottom: 150px; }

.pd-closed-banner {
    background: var(--pd-bg);
    border: 1px solid var(--pd-line);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0 16px 16px;
    color: var(--pd-steel);
    font-size: 14px;
}

/* --- Фото (шире) + данные --- */
.pd-content {
    display: flex;
    gap: 24px;
    padding: 0 16px;
    margin-bottom: 20px;
}
.pd-photo-col { flex: 0 0 60%; }
.pd-fields-col { flex: 1; min-width: 0; padding-top: 36px; }

.pd-gallery { display: flex; gap: 8px; }
.pd-thumbs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    width: 52px;
}
.pd-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}
.pd-thumb:hover { opacity: 1; }
.pd-thumb-active { border-color: var(--pd-accent); opacity: 1; }

.pd-photo {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--pd-bg);
    border: 1px solid var(--pd-line);
    aspect-ratio: 16 / 10;
    flex: 1;
    min-width: 0;
}
.pd-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-stamp {
    position: absolute;
    top: 8px;
    right: 8px;
    font-family: 'Roboto Condensed', 'Roboto', Helvetica, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--pd-accent);
    background: var(--pd-surface);
    border: 1.5px solid var(--pd-accent);
    border-radius: 4px;
    padding: 2px 6px;
    transform: rotate(-3deg);
}

.pd-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pd-title { font-size: 22px; font-weight: 700; color: var(--pd-ink); margin: 0; line-height: 1.25; }
.pd-share-btn {
    display: none; /* показывается только на мобилке — см. медиа-запрос ниже, как .share-btn в product.php */
    flex-shrink: 0;
    width: 34px; height: 34px;
    border: 1px solid var(--pd-line);
    background: var(--pd-surface);
    border-radius: 8px;
    align-items: center; justify-content: center;
    cursor: pointer;
}
.pd-share-btn:hover { border-color: var(--pd-accent); }
.pd-share-btn img { width: 16px; height: 16px; opacity: 0.7; }
.pd-field { font-size: 14px; color: var(--pd-ink); margin: 0 0 6px; }
.pd-field strong { color: var(--pd-steel); font-weight: 500; }

.pd-owner-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--pd-bg);
    border: 1px solid var(--pd-line);
    border-radius: 10px;
    max-width: 280px;
}
.pd-owner-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--pd-surface);
    border: 1px solid var(--pd-line);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pd-owner-avatar img { width: 18px; height: 18px; opacity: 0.6; }
.pd-owner-info { display: flex; flex-direction: column; min-width: 0; }
.pd-owner-label { font-size: 11px; color: var(--pd-steel); text-transform: uppercase; letter-spacing: 0.04em; }
.pd-owner-name { font-size: 14px; color: var(--pd-ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pd-description-block { padding: 0 16px; margin-bottom: 20px; }
.pd-description-block h2 { font-size: 16px; color: var(--pd-ink); margin: 0 0 8px; }
.pd-description-block p { font-size: 14px; line-height: 1.6; color: var(--pd-ink); margin: 0; white-space: pre-line; }

.pd-section-title { font-size: 17px; font-weight: 600; color: var(--pd-ink); margin: 8px 16px 12px; }
.pd-empty-text, .pd-warning { margin: 0 16px 16px; font-size: 14px; color: var(--pd-steel); }
.pd-warning { background: #FBF2EA; border: 1px solid #E8C9A8; border-radius: 8px; padding: 12px 14px; color: #8A5A2A; }

.pd-offers { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.pd-offer-card { background: var(--pd-surface); border: 1px solid var(--pd-line); border-radius: 10px; padding: 14px; }
.pd-offer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pd-offer-price { font-size: 19px; color: var(--pd-ink); font-variant-numeric: tabular-nums; }
.pd-offer-date { font-size: 12px; color: var(--pd-steel); }
.pd-offer-seller { font-size: 14px; color: var(--pd-steel); margin-bottom: 4px; }
.pd-offer-comment { font-size: 14px; color: var(--pd-ink); margin-bottom: 12px; }
.pd-offer-actions { display: flex; gap: 8px; margin-bottom: 8px; }

.pd-btn {
    display: flex; align-items: center; justify-content: center;
    height: 38px; padding: 0 16px; border-radius: 8px;
    font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
    border: none; flex: 1; transition: opacity 0.15s ease, background 0.15s ease;
}
.pd-btn:hover { opacity: 0.85; }
.pd-btn-full { width: 100%; }
.pd-btn-outline { background: var(--pd-bg); color: var(--pd-ink); border: 1px solid var(--pd-line); }
.pd-btn-whatsapp { background: #25D366; color: #fff; }
.pd-btn-accent { background: var(--pd-accent); color: #fff; }
.pd-btn-accent:hover { background: var(--pd-accent-dark); opacity: 1; }
.pd-btn-ghost { background: none; color: var(--pd-steel); border: 1px solid var(--pd-line); }

.pd-close-form { padding: 0 16px; margin-top: 8px; }
.pd-my-offer { margin: 0 16px 16px; background: var(--pd-bg); border: 1px solid var(--pd-line); border-radius: 10px; padding: 14px; }
.pd-my-offer p { margin: 0 0 4px; color: var(--pd-ink); font-size: 14px; }
.pd-my-offer span { font-size: 13px; color: var(--pd-steel); }

/* --- Похожие объявления: hover тоже синий --- */
.ad-cards .card:hover { border-color: var(--pd-accent); }

/* --- Композер внизу экрана --- */
.pd-composer-wrap {
    position: fixed;
    left: 0; right: 0;
    bottom: 68px;
    z-index: 999;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(243,241,234,0.97) 65%, rgba(243,241,234,0));
}
.pd-composer {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--pd-surface);
    border: 1px solid var(--pd-line);
    border-radius: 28px;
    padding: 8px 8px 8px 18px;
    min-height: 56px;
}
.pd-composer-price {
    width: 140px;
    border: none; outline: none;
    font-size: 15px; padding: 12px 0;
    background: transparent; color: var(--pd-ink);
}
.pd-composer-comment {
    flex: 1; border: none; outline: none;
    font-size: 15px; padding: 12px 0;
    border-left: 1px solid var(--pd-line); padding-left: 14px;
    min-width: 0; background: transparent; color: var(--pd-ink);
}
.pd-composer-send {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
    background: var(--pd-accent); border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.15s ease;
}
.pd-composer-send:hover { background: var(--pd-accent-dark); }
.pd-composer-guest-text { flex: 1; font-size: 14px; color: var(--pd-steel); padding-left: 6px; }
.pd-composer .pd-btn-accent { flex: none; padding: 0 22px; border-radius: 20px; }
.pd-composer-notice {
    max-width: 720px; margin: 0 auto; border-radius: 10px; padding: 12px 16px;
    font-size: 14px; text-align: center; box-shadow: 0 8px 24px rgba(31, 36, 33, 0.12);
}
.pd-composer-error { background: #FBEAEA; color: #B23B3B; border: 1px solid #E8C0C0; }
.pd-composer-success { background: #EAF6EE; color: #2F7A45; border: 1px solid #BFE3CA; }

/* --- Панель "отправляете как" --- */
.pd-self-panel {
    max-width: 720px;
    margin: 0 auto 8px;
    background: var(--pd-surface);
    border: 1px solid var(--pd-line);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(31, 36, 33, 0.1);
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}
.pd-self-panel.pd-open { max-height: 160px; opacity: 1; padding: 12px 16px; }
.pd-self-panel-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--pd-steel); margin-bottom: 6px; }
.pd-self-row { font-size: 14px; color: var(--pd-ink); margin-bottom: 3px; }
.pd-self-row span { color: var(--pd-steel); }

@media (min-width: 901px) {
    .pd-composer-wrap { bottom: 12px; }
}

/* --- Мобильная версия: фото первым, во всю ширину, миниатюры скрыты (полагаемся на свайп) --- */
@media (max-width: 600px) {
    .pd-page { padding-top: 15px; }
    .pd-content { flex-direction: column; padding: 0; gap: 0; }
    .pd-photo-col { flex: none; max-width: none; order: -1; margin-top: 14px; }
    .pd-gallery { gap: 0; }
    .pd-thumbs { display: none; }
    .pd-photo { border-radius: 0; border-left: none; border-right: none; aspect-ratio: 4 / 3; }
    .pd-fields-col { padding: 16px; }
    .pd-owner-card { max-width: none; }
    .pd-title { font-size: 19px; }
    .pd-share-btn { display: flex; }
}
@media (max-width: 480px) {
    .pd-composer-price { width: 100px; }
}