﻿/* ==========================================================================
   СТИЛИ СТРАНИЦЫ ПРОДАЖИ ОПАЛУБКИ
   ========================================================================== */

/* ==================== ТАБЛИЦА ПРАЙСА (десктоп) ==================== */
.price-table-container {
    margin: 40px 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid #e2e8f0;
    background: white;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.price-table thead {
    background: #334155;
}

.price-table th {
    color: white;
    padding: 20px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 1.1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.price-table th:last-child { border-right: none; }

.price-table tbody tr { transition: all 0.3s ease; }
.price-table tbody tr:nth-child(even) { background-color: #f8fafc; }
.price-table tbody tr:hover { background-color: #f1f5f9; }

.price-table td {
    padding: 18px 15px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.price-table td:first-child {
    font-weight: 600;
    color: var(--secondary);
}

.price-table tr:last-child td { border-bottom: none; }

.item-name {
    font-weight: 600;
    color: var(--secondary);
}

.item-category {
    color: var(--gray);
    font-size: 0.9rem;
}

/* ---------- Бейджи состояния ---------- */
.condition-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.condition-new { background: #f1f5f9; color: #334155; }
.condition-used { background: #f1f5f9; color: #334155; }

/* ---------- Поля ввода количества ---------- */
.quantity-input {
    width: 80px;
    padding: 8px 10px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
}

.quantity-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== МОБИЛЬНЫЙ АККОРДЕОН ==================== */
.price-accordion {
    display: none;               /* показывается только на мобильном */
}

.price-card {
    background: white;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.price-card-header {
    background: #334155;         /* тёмная шапка, как было */
    color: white;
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.price-card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: white;
}

.price-card-header i {
    transition: transform 0.3s ease;
    color: white;
}

.price-card-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.price-card.active .price-card-content { max-height: 2000px; }
.price-card.active .price-card-header i { transform: rotate(180deg); }

.price-item {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.price-item:last-child { border-bottom: none; }

.mobile-item-name {
    font-weight: 600;
    color: var(--secondary);
    font-size: 1.1rem;
}

.mobile-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin: 10px 0;
}

.mobile-quantity-input {
    width: 100px;
    padding: 10px 12px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    font-size: 1rem;
}

.mobile-add-btn {
    padding: 12px 25px;
    border-radius: 4px;
    flex: 1;
    min-width: 120px;
}

/* ==================== КАЛЬКУЛЯТОР КП ==================== */
.calculator {
    margin-top: 0;
    padding-top: 20px;
}

.selected-items-wrapper {
    margin-top: 10px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid #e2e8f0;
}

.selected-items-title {
    background: #334155;
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-size: 1.2rem;
    text-align: center;
}

.selected-items-table .tech-table { margin: 0; }

.selected-items-table table {
    width: 100%;
    border-collapse: collapse;
}

.selected-items-table th {
    padding: 12px 15px;
    background: #334155;
    color: white;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.selected-items-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.selected-items-table tfoot td {
    font-weight: bold;
    background: #f8fafc;
}

.calc-actions {
    padding: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    border-top: 1px solid #e2e8f0;
}

/* Пустая строка в калькуляторе */
.calc-empty {
    text-align: center;
    padding: 30px;
    color: var(--gray);
}

.calc-empty i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    color: var(--accent);
}

/* Строки подвала калькулятора */
.calc-footer-label {
    text-align: right;
    font-weight: bold;
}

.calc-footer-label-soft {
    text-align: right;
}

.calc-footer-value {
    font-weight: bold;
}

.calc-footer-total {
    font-weight: bold;
    color: var(--primary);
}

/* Поля доставки и налога */
.calc-input-small {
    width: 80px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.calc-select {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-right: 10px;
}

.calc-tax-amount {
    margin-left: 8px;
    font-weight: 600;
    color: var(--primary);
}

/* ==================== БЛОК PDF-ПРАЙСА ==================== */
.price-pdf-section {
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: 30px;
    margin: 40px 0;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.price-pdf-section h3 {
    color: var(--secondary);
    margin-bottom: 15px;
}

.price-pdf-section p {
    color: var(--gray);
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== ИНСТРУКЦИЯ «Как получить КП» ==================== */
.kp-instruction {
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: 25px;
    margin: 25px 0;
    border-left: 4px solid var(--accent);
}

.kp-instruction h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

.kp-instruction ol {
    color: var(--gray);
    margin-left: 20px;
    line-height: 1.6;
}

.kp-instruction li { margin-bottom: 10px; }

/* Кнопка «Перейти к выбору товаров» */
.kp-cta {
    text-align: center;
    margin-top: 30px;
}

.btn-arrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* ==================== ИНФО-БОКС (внутри kp-instruction) ==================== */
.info-box {
    margin-top: 20px;
    padding: 15px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.info-box p {
    color: var(--primary);
    margin: 0;
}

/* ==================== КАТАЛОГ КАТЕГОРИЙ ==================== */
#catalog-sale .services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

#catalog-sale .service-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
}

#catalog-sale .service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

#catalog-sale .service-img {
    height: 200px;
    overflow: hidden;
    position: relative;
}

#catalog-sale .service-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

#catalog-sale .service-card:hover .service-img img {
    transform: scale(1.05);
}

#catalog-sale .service-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#catalog-sale .service-content h3 {
    color: var(--secondary);
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
}

#catalog-sale .service-content p {
    color: var(--gray);
    margin-bottom: 20px;
    text-align: center;
    flex-grow: 1;
}

#catalog-sale .category-items {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}

#catalog-sale .category-items li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    color: var(--dark-gray);
    position: relative;
    padding-left: 25px;
}

#catalog-sale .category-items li:before {
    content: "✓";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

#catalog-sale .category-items li:last-child { border-bottom: none; }

/* Статусы категорий */
.category-status {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-new { background-color: #f1f5f9; color: #334155; }
.status-used { background-color: #e2e8f0; color: #334155; }

/* ==================== ПОДСВЕТКА СТРОК ПРИ СКРОЛЛЕ ==================== */
.highlight-row {
    background-color: #f0f9ff !important;
    animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
    0%   { background-color: #f0f9ff; }
    50%  { background-color: #e1f0ff; }
    100% { background-color: #f0f9ff; }
}

/* ==================== ПУЛЬСАЦИЯ ФОРМЫ ==================== */
#contactForm.pulse {
    animation: pulse 2s ease;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    70%  { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 768px) {
    /* Таблица / аккордеон: переключаем */
    .price-table { display: none; }
    .price-accordion { display: block; }

    .price-card-header { padding: 16px 20px; }
    .price-item { padding: 16px 20px; }

    .mobile-item-details {
        flex-direction: column;
        align-items: stretch;
    }

    .mobile-quantity-input { width: 100%; }
    .mobile-add-btn { width: 100%; min-width: unset; }

    .selected-items-title {
        padding: 12px 15px;
        font-size: 1.1rem;
    }

    .selected-items-table th,
    .selected-items-table td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* Кнопки калькулятора по центру */
    .calc-actions {
        flex-direction: column;
        align-items: center;
    }

    .calc-actions .btn {
        width: 100%;
        max-width: 300px;
        margin: 0 auto 10px;
        display: flex;
        justify-content: center;
    }

    #calculator .selected-items-table .tech-table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #calculator .selected-items-table .tech-table table {
        display: table !important;
        width: 100%;
        min-width: 500px;
    }

    /* Каталог категорий */
    #catalog-sale .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    #catalog-sale .service-img { height: 180px; }
    #catalog-sale .service-content { padding: 20px; }

    .price-pdf-section {
        padding: 20px;
        margin: 30px 0;
    }

    .kp-instruction {
        padding: 20px;
        margin: 20px 0;
    }

    .calc-input-small,
    .calc-select {
        width: 100%;
        margin-bottom: 10px;
    }

    .btn-arrow {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

@media (min-width: 769px) {
    .price-accordion { display: none; }
    .price-table { display: table; }
}