/* ============================================================
   SWAPZONE — ЕДИНАЯ ТЕМА
   Общие стили: шрифт, заголовки, цвета, утилиты.
   Bootstrap 5 остаётся основой.
   ============================================================ */

/* ============================================================
   1. ПЕРЕОПРЕДЕЛЕНИЕ BOOTSTRAP-ПЕРЕМЕННЫХ
   ============================================================ */
:root {
    --bs-body-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
                           Roboto, 'Helvetica Neue', Arial, sans-serif;
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.6;
    --bs-body-color: #333333;

    /* Фирменные переменные SWAPZONE */
    --sz-primary: #667eea;
    --sz-secondary: #764ba2;
    --sz-accent: #ffc107;
    --sz-text: #1a1a2e;
    --sz-heading: #2c3e50;
    --sz-muted: #6c757d;
}

/* ============================================================
   2. ЗАГОЛОВКИ — ЕДИНЫЙ СТИЛЬ
   ============================================================ */
h1, .h1 { font-weight: 700; }
h2, .h2 { font-weight: 600; }
h3, .h3 { font-weight: 600; }
h4, .h4 { font-weight: 600; }
h5, .h5 { font-weight: 600; }
h6, .h6 { font-weight: 600; }

/* ============================================================
   3. КАСТОМНЫЕ УТИЛИТЫ
   ============================================================ */

/* --- Градиентный фон SWAPZONE --- */
.bg-gradient-sz {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* --- Тёмный градиент (для catalog-header) --- */
.bg-gradient-dark {
    background: linear-gradient(135deg, #2c2c2c 0%, #3a3a3a 50%, #4a4a4a 100%);
}

/* --- Карточки с тенью (engines, marketplace, community) --- */
.card-sz {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card-sz:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* --- Заголовок секции с подчёркиванием --- */
.section-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.section-title i {
    margin-right: 8px;
    color: #212529;
}

/* ============================================================
   ⭐ ИСПРАВЛЕНО: КОНТЕНТ AI (с маркерами → HTML)
   Усилены отступы между абзацами, заголовками и списками.
   ============================================================ */
.sz-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333333;
}

.sz-content h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
}

.sz-content h2:first-child {
    margin-top: 0 !important;
}

.sz-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 1.8rem !important;
    margin-bottom: 0.6rem !important;
    color: #1a1a2e;
    border-bottom: none;
}

/* Первый абзац после h3 — без отступа сверху */
.sz-content h3 + p {
    margin-top: 0 !important;
    margin-bottom: 1.2rem !important;
}

.sz-content p {
    margin-bottom: 1.2rem !important;
    line-height: 1.8;
}

.sz-content p:last-child {
    margin-bottom: 0 !important;
}

.sz-content ul,
.sz-content ol {
    margin: 1rem 0 1.5rem 1.8rem !important;
    padding-left: 0.5rem;
}

.sz-content li {
    margin-bottom: 0.5rem !important;
    line-height: 1.7;
}

.sz-content ul li { list-style-type: disc; }
.sz-content ol li { list-style-type: decimal; }

.sz-content strong {
    color: #2c3e50;
    font-weight: 700;
}

.sz-content blockquote {
    border-left: 4px solid #ffc107;
    padding: 0.8rem 1.2rem;
    margin: 1rem 0;
    background: #fff8e1;
    border-radius: 0 4px 4px 0;
    color: #555;
    font-style: italic;
}

.sz-content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.sz-content pre {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

/* Пустые абзацы убираем */
.sz-content p:empty {
    display: none;
}

/* ============================================================
   ⭐ ТАБЛИЦЫ КОНТЕНТА — В ФИРМЕННОЙ ПАЛИТРЕ SWAPZONE
   ============================================================ */
.sz-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Шапка — тёмный графит, как у шапки каталога */
.sz-content table thead {
    background: #343a40;
    color: #ffffff;
}

.sz-content table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    color: #ffffff;
    white-space: nowrap;
    vertical-align: middle;
}

.sz-content table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: #333333;
    vertical-align: top;
}

.sz-content table tbody tr:last-child td {
    border-bottom: none;
}

/* Чётные строки — лёгкий серый зебра-эффект */
.sz-content table tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* --- Таблица характеристик (engines) --- */
.specs-table {
    width: 100%;
    margin: 15px 0;
    border-collapse: collapse;
}

.specs-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.specs-table tr:last-child {
    border-bottom: none;
}

.specs-table td {
    padding: 10px 0;
    vertical-align: top;
}

.specs-table .spec-name {
    font-weight: 500;
    color: #495057;
    width: 40%;
    padding-right: 30px;
    font-size: 0.95rem;
}

.specs-table .spec-value {
    color: #000000;
    font-weight: 500;
    width: 60%;
    padding-left: 15px;
    font-size: 0.95rem;
}

/* --- Индикатор статуса (точка онлайн) --- */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.online { background: #28a745; }
.status-dot.offline { background: #6c757d; }
.status-dot.warning { background: #ffc107; }
.status-dot.danger { background: #dc3545; }

/* --- Скрытый скроллбар --- */
.scrollbar-hidden {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.scrollbar-hidden::-webkit-scrollbar {
    display: none;
}

/* --- Бейджи сложности (community) --- */
.badge.bg-beginner { background-color: #28a745 !important; }
.badge.bg-intermediate { background-color: #ffc107 !important; color: #000 !important; }
.badge.bg-advanced { background-color: #fd7e14 !important; }
.badge.bg-expert { background-color: #dc3545 !important; }

/* ============================================================
   ⭐ УНИВЕРСАЛЬНЫЙ СТИЛЬ БЕЙДЖЕЙ В FLEX-КОНТЕЙНЕРАХ
   ============================================================ */
.card-body > .badge,
.card-body > span.badge,
.featured-article-card .card-body > .badge,
.article-card .card-body > .badge,
.guide-card .card-body > .badge,
.catalog-guide-card .card-body > .badge,
.engine-card .card-body > .badge {
    align-self: flex-start;
    display: inline-block;
    width: auto;
    max-width: 100%;
}


/* ============================================================
   4. АДАПТИВНОСТЬ ОБЩАЯ
   ============================================================ */
@media (max-width: 768px) {
    .sz-content {
        font-size: 0.95rem;
    }

    .sz-content h2 {
        font-size: 1.3rem;
    }

    .sz-content h3 {
        font-size: 1.1rem;
    }

    .specs-table td {
        padding: 8px 0;
        font-size: 0.9rem;
    }

    .specs-table .spec-name {
        padding-right: 15px;
    }

    .sz-content table {
        font-size: 0.85rem;
    }

    .sz-content table th,
    .sz-content table td {
        padding: 8px 10px;
    }

    .sz-content table th {
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 576px) {
    .specs-table td {
        padding: 6px 0;
        font-size: 0.85rem;
    }

    .specs-table .spec-name {
        padding-right: 10px;
    }

    .sz-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .sz-content table th,
    .sz-content table td {
        white-space: nowrap;
    }
}

/* ============================================================
   5. COMMUNITY — ПРОЕКТЫ ПОЛЬЗОВАТЕЛЕЙ
   ============================================================ */
.project-card {
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.project-image-container {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.project-image {
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-image-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.3s;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-stats {
    align-self: flex-start;
}

.project-difficulty {
    align-self: flex-end;
}

.project-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-meta .badge {
    font-size: 0.8rem;
}

.photo-thumbnail {
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
}

.project-story {
    font-size: 1.1rem;
    line-height: 1.6;
}

.car-info p, .project-details p {
    margin-bottom: 1rem;
}

/* ============================================================
   6. COMMUNITY — ФОРМА ПРОЕКТА
   ============================================================ */
.photo-form {
    transition: transform 0.2s;
}

.photo-form:hover {
    transform: translateY(-2px);
}

/* ============================================================
   7. MARKETPLACE — КАРТОЧКИ ТОВАРОВ
   ============================================================ */
.product-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.product-card .card-img-top {
    transition: transform 0.3s;
}

.product-card:hover .card-img-top {
    transform: scale(1.03);
}

.product-thumb {
    transition: opacity 0.2s;
}

.product-thumb:hover {
    opacity: 0.7;
}

.product-video-container video {
    max-height: 400px;
    width: 100%;
    background: #000;
    border-radius: 8px;
}

/* ============================================================
   8. MARKETPLACE — АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 576px) {
    .product-card .card-body {
        padding: 0.5rem !important;
    }
    .product-card .card-footer {
        padding: 0.25rem 0.5rem !important;
    }
    .product-image-wrapper img {
        height: 120px !important;
    }

    .h2-md {
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    .cart-table td,
    .cart-table th {
        padding: 0.4rem 0.3rem;
        font-size: 0.85rem;
    }

    .cart-table .form-control-sm {
        width: 40px !important;
        padding: 0.1rem 0.2rem;
        font-size: 0.75rem;
    }

    .orders-table td,
    .orders-table th {
        padding: 0.4rem 0.3rem;
        font-size: 0.8rem;
    }

    .orders-table .badge {
        font-size: 0.65rem;
    }

    .order-detail-card .card-header h4 {
        font-size: 1rem;
    }

    .order-detail-card .table td,
    .order-detail-card .table th {
        padding: 0.3rem;
        font-size: 0.8rem;
    }
}

/* ============================================================
   ⭐ ХЛЕБНЫЕ КРОШКИ — ФИРМЕННЫЙ СТИЛЬ SWAPZONE
   ============================================================ */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: #1a1a2e;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #1a1a2e;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #adb5bd;
    content: "›";
    padding: 0 6px;
}

/* ============================================================
   ГЛОБАЛЬНЫЙ СТИЛЬ ССЫЛОК SWAPZONE
   ============================================================ */
a:not(.btn):not(.badge):not(.nav-link):not(.dropdown-item):not(.page-link):not(.link-card a):not(.navbar-brand):not(.brand-text) {
    color: #495057;
    text-decoration: none;
    transition: color 0.2s;
}

a:not(.btn):not(.badge):not(.nav-link):not(.dropdown-item):not(.page-link):not(.link-card a):not(.navbar-brand):not(.brand-text):hover {
    color: #1a1a2e;
    text-decoration: underline;
}

/* ============================================================
   21. КНОПКА «СБРОСИТЬ ПОИСК» В ПУСТОМ СОСТОЯНИИ
   ============================================================ */
.btn-reset-search,
.btn-reset-search:hover,
.btn-reset-search:focus,
.btn-reset-search:active,
.btn-reset-search:visited {
    text-decoration: none !important;
    border-bottom: none !important;
}

.btn-reset-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 0 22px;
    height: 44px;
    border-radius: 8px;
    border: none;
    background: #ffc107;
    color: #212529;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 44px;
    vertical-align: middle;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    text-decoration: none !important;
}

.btn-reset-search:hover {
    background: #e0a800;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    text-decoration: none !important;
}

.btn-reset-search:active {
    transform: translateY(0);
}

.btn-reset-search:focus {
    outline: 0;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.3);
    text-decoration: none !important;
}

.btn-reset-search i,
.btn-reset-search .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    color: inherit;
    text-decoration: none !important;
    vertical-align: middle;
    margin: 0;
    padding: 0;
    position: relative;
    top: 0;
}

/* ============================================================
   22. FAQ В СТАТЬЯХ — вопросы и ответы без префиксов
   ============================================================ */
.sz-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 1.5rem 0 0.4rem 0;
    border-bottom: none;
}

.sz-content h3 + p {
    margin-top: 0;
    margin-bottom: 1rem;
}