/* PPF Groups CSS - v5 */

/* ===== ШАПКА ГРУППЫ ===== */
.ppf-group {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #fff;
}

.ppf-group-head {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    gap: 16px;
}

/* Картинка - 60px */
.ppf-group-head-left {
    width: 60px !important;
    min-width: 60px !important;
    flex-shrink: 0;
}
.ppf-group-head-left img {
    width: 60px !important;
    height: 60px !important;
    object-fit: contain !important;
    border-radius: 4px;
    background: #f5f5f5;
}

/* Название */
.ppf-group-title {
    flex: 1;
    min-width: 0;
}
.ppf-group-title a {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    text-decoration: none;
}
.ppf-group-title a:hover {
    color: #1565c0;
}

/* Артикул справа */
.ppf-group-head-right {
    flex-shrink: 0;
}
.ppf-group-sku {
    font-family: monospace;
    font-size: 13px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 4px;
}

/* Скрываем итого группы */
.ppf-group-total {
    display: none !important;
}

/* ===== ЗАГОЛОВОК ТАБЛИЦЫ ===== */
.ppf-group-table-head {
    display: grid !important;
    grid-template-columns: 85px 95px 175px 65px 110px 40px !important;
    gap: 8px !important;
    padding: 10px 16px !important;
    background: #f5f5f5 !important;
    border-bottom: 1px solid #e0e0e0 !important;
    font-size: 11px !important;
    color: #666 !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
}
.ppf-group-table-head > div:nth-child(1) { text-align: left; padding-left: 5px; }
.ppf-group-table-head > div:nth-child(2) { text-align: left; }
.ppf-group-table-head > div:nth-child(3) { text-align: center; }
.ppf-group-table-head > div:nth-child(4) { text-align: center; }
.ppf-group-table-head > div:nth-child(5) { text-align: center; }
.ppf-group-table-head > div:nth-child(6) { text-align: center; }

/* ===== СТРОКА ТОВАРА ===== */
.ppf-group-body {
    padding: 0;
}

.wa-product {
    border-bottom: 1px solid #f0f0f0;
}
.wa-product:last-child {
    border-bottom: none;
}

.wa-product-body {
    display: grid !important;
    grid-template-columns: 85px 95px 175px 65px 110px 40px !important;
    gap: 8px !important;
    padding: 12px 16px !important;
    align-items: center !important;
}

/* Состояние */
.wa-column-details {
    padding-left: 5px !important;
}
.ppf-cond {
    font-size: 12px !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    display: inline-block !important;
}
.ppf-cond-new {
    background: #e3f2fd !important;
    color: #1565c0 !important;
}
.ppf-cond-used {
    background: #fff3e0 !important;
    color: #e65100 !important;
}

/* Цена за штуку */
.wa-column-unit-price {
    font-weight: 600 !important;
    color: #333 !important;
    font-size: 14px !important;
}

/* Количество */
.wa-column-quantity {
    text-align: center !important;
}
.wa-quantity-section {
    display: inline-flex !important;
    align-items: center !important;
    gap: 2px !important;
}
.wa-qty-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 18px !important;
    font-weight: normal !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #666 !important;
    border-radius: 4px !important;
}
.wa-qty-btn:hover {
    background: #f0f0f0 !important;
    color: #333 !important;
}
.wa-qty-input {
    width: 45px !important;
    height: 28px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    outline: none !important;
}
.wa-qty-input:focus {
    border-color: #999 !important;
}

/* Наличие */
.wa-column-stock {
}
.ppf-stock {
    font-weight: 600 !important;
    font-size: 13px !important;
    white-space: nowrap !important;
}
.ppf-stock.in-stock { color: #2e7d32 !important; }
.ppf-stock.low-stock { color: #f57c00 !important; }
.ppf-stock.out-of-stock, .ppf-stock.preorder { color: #1565c0 !important; }

/* Сумма */
.wa-column-price {
    text-align: right !important;
}
.wa-price-total {
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #333 !important;
}

/* Удаление */
.wa-column-delete {
}
.ppf-remove-btn {
    width: 28px !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    color: #bbb !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    transition: all 0.15s !important;
    text-decoration: none !important;
    background: transparent !important;
}
.ppf-remove-btn:hover {
    background: #ffebee !important;
    color: #c62828 !important;
}

/* ===== КНОПКИ ГРУППЫ ===== */
.ppf-group-actions {
    display: flex !important;
    gap: 10px !important;
    padding: 10px 16px !important;
    border-top: 1px dashed #e0e0e0 !important;
    background: #fafafa !important;
    border-radius: 0 0 8px 8px !important;
}
.ppf-add-btn {
    font-size: 13px !important;
    color: #fff !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    transition: opacity 0.15s !important;
}
.ppf-add-new { background: #2563eb !important; }
.ppf-add-used { background: #d97706 !important; }
.ppf-add-btn:hover { opacity: 0.85 !important; }

/* Кнопки экспорта */


/* ===== МОБИЛЬНАЯ ВЕРСИЯ (до 768px) ===== */
@media (max-width: 767px) {

    /* === ШАПКА ГРУППЫ === */
    .ppf-group-head {
        padding: 10px 12px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .ppf-group-head-left {
        width: 45px !important;
        min-width: 45px !important;
    }
    .ppf-group-head-left img {
        width: 45px !important;
        height: 45px !important;
    }

    .ppf-group-title {
        flex: 1;
        min-width: 120px;
    }
    .ppf-group-title a {
        font-size: 13px;
    }

    /* Артикул на новую строку */
    .ppf-group-head-right {
        flex: 0 0 100%;
        order: 3;
        margin-top: 4px;
    }
    .ppf-group-sku {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* === ЗАГОЛОВОК ТАБЛИЦЫ - скрыть === */
    .ppf-group-table-head {
        display: none !important;
    }

    /* === СТРОКА ТОВАРА - вертикальный layout === */
    .wa-product-body {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        padding: 12px !important;
        align-items: center !important;
    }

    /* Состояние + Цена в одной строке */
    .wa-column-details {
        flex: 0 0 auto;
        padding-left: 0 !important;
        order: 1;
    }
    .ppf-cond {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    .wa-column-unit-price {
        flex: 1;
        text-align: right !important;
        font-size: 13px !important;
        order: 2;
    }

    /* Количество - полная ширина */
    .wa-column-quantity {
        flex: 0 0 100%;
        order: 3;
        padding: 8px 0 !important;
        border-top: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
        display: flex !important;
        justify-content: center !important;
    }
    .wa-quantity-section {
        gap: 4px !important;
    }
    .wa-qty-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 20px !important;
    }
    .wa-qty-input {
        width: 50px !important;
        height: 36px !important;
        font-size: 15px !important;
    }

    /* Наличие */
    .wa-column-stock {
        flex: 0 0 auto;
        order: 4;
    }
    .ppf-stock {
        font-size: 12px !important;
    }

    /* Сумма + Удалить */
    .wa-column-price {
        flex: 1;
        text-align: right !important;
        order: 5;
    }
    .wa-price-total {
        font-size: 15px !important;
    }

    .wa-column-delete {
        flex: 0 0 auto;
        order: 6;
    }
    .ppf-remove-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }

    /* === КНОПКИ ГРУППЫ === */
    .ppf-group-actions {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 10px 12px !important;
    }
    .ppf-add-btn {
        width: 100%;
        font-size: 13px !important;
        padding: 12px 16px !important;
    }
}

/* ===== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 480px) ===== */
@media (max-width: 479px) {

    .ppf-group-head {
        padding: 8px 10px;
    }

    .ppf-group-head-left {
        width: 40px !important;
        min-width: 40px !important;
    }
    .ppf-group-head-left img {
        width: 40px !important;
        height: 40px !important;
    }

    .ppf-group-title a {
        font-size: 12px;
    }

    .ppf-group-sku {
        font-size: 10px;
        padding: 2px 6px;
    }

    .wa-product-body {
        padding: 10px 8px !important;
        gap: 6px !important;
    }

    .wa-qty-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 18px !important;
    }
    .wa-qty-input {
        width: 45px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    .ppf-remove-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }

    .ppf-group-actions {
        padding: 8px !important;
    }

    .ppf-add-btn {
        font-size: 12px !important;
        padding: 10px 12px !important;
    }

    .wa-price-total {
        font-size: 14px !important;
    }

    .wa-column-unit-price {
        font-size: 12px !important;
    }
}
