/**
 * Cart Experience Pro - Styles
 * 
 * @package DW_Select_Cart_Products
 * @since 2.0.0
 * @author David William da Costa
 */

/* ===========================
   Seleção de Itens
   =========================== */

.dw-scp-select-all {
    background: #f9f9f9;
    padding: 12px 15px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.dw-scp-selection-counter {
    margin-left: 10px;
    color: #666;
    font-size: 13px;
}

/* Checkbox personalizado */
input[type="checkbox"].dw-scp-cart-item-selector,
input[type="checkbox"]#dw-scp-select-all {
    accent-color: #007185;
    cursor: pointer;
    margin-right: 8px !important;
}

/* Wrapper da thumbnail com checkbox */
.dw-scp-thumbnail-wrapper {
    display: flex !important;
    align-items: center !important;
}

.dw-scp-thumbnail-wrapper .dw-scp-cart-item-selector {
    width: 20px !important;
    height: 20px !important;
    margin-right: 8px !important;
    margin-left: 0 !important;
    flex-shrink: 0;
}

/* Item não selecionado */
tr.cart_item:has(.dw-scp-cart-item-selector:not(:checked)),
tr.woocommerce-cart-form__cart-item:has(.dw-scp-cart-item-selector:not(:checked)) {
    opacity: 0.5;
    background-color: #f9f9f9;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

/* ===========================
   Botões de Ação
   =========================== */

.dw-scp-item-actions {
    margin-top: 8px;
    display: flex;
    gap: 15px;
    font-size: 12px;
    flex-wrap: wrap;
}

.dw-scp-item-actions a {
    color: #007185;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dw-scp-item-actions a:hover {
    text-decoration: underline !important;
    color: #c7511f !important;
}

/* ===========================
   Aviso de Nenhum Item
   =========================== */

.dw-scp-no-items-warning {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
    color: #856404 !important;
}

/* ===========================
   Seções de Produtos
   =========================== */

.dw-scp-saved-section,
.dw-scp-buy-again-section,
.dw-scp-tabs-wrapper {
    margin-top: 40px;
    border-top: 1px solid #ddd;
    padding-top: 30px;
}

/* Grid de produtos */
.dw-scp-saved-grid,
.dw-scp-buy-again-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Cards de produtos */
.dw-scp-saved-card,
.dw-scp-buy-again-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.dw-scp-saved-card:hover,
.dw-scp-buy-again-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dw-scp-saved-card img,
.dw-scp-buy-again-card img {
    max-width: 100%;
    height: auto;
}

/* Botões dos cards */
.dw-scp-move-to-cart,
.dw-scp-add-to-cart-again {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.dw-scp-move-to-cart {
    background: #fff;
    border: 1px solid #d5d9d9;
    color: #000;
}

.dw-scp-move-to-cart:hover {
    background-color: #f7fafa !important;
    border-color: #008296 !important;
}

.dw-scp-add-to-cart-again {
    border-radius: var(--btn-accented-brd-radius) !important;
    color: var(--btn-accented-color) !important;
    box-shadow: var(--btn-accented-box-shadow) !important;
    background-color: var(--btn-accented-bgcolor) !important;
    text-transform: var(--btn-accented-transform, var(--btn-transform)) !important;
    font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600)) !important;
    font-family: var(--btn-accented-font-family, var(--btn-font-family, inherit)) !important;
    font-style: var(--btn-accented-font-style, var(--btn-font-style, unset)) !important;
}

.dw-scp-add-to-cart-again:hover {
    color: var(--btn-accented-color-hover) !important;
    box-shadow: var(--btn-accented-box-shadow-hover) !important;
    background-color: var(--btn-accented-bgcolor-hover) !important;
}

/* ===========================
   Abas (Tabs)
   =========================== */

.dw-scp-tabs {
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.dw-scp-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    color: #565959;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.dw-scp-tab:hover {
    color: #007185 !important;
}

.dw-scp-tab.active {
    border-bottom: 3px solid #007185;
    font-weight: bold;
    color: #007185;
}

.dw-scp-tab-content {
    display: none;
}

.dw-scp-tab-content.active {
    display: block;
}

/* ===========================
   Modal de Compartilhamento
   =========================== */

.dw-scp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dw-scp-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.dw-scp-modal-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.dw-scp-share-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dw-scp-share-btn {
    padding: 10px;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.dw-scp-share-facebook {
    background: #1877f2;
}

.dw-scp-share-facebook:hover {
    background: #166fe5;
}

.dw-scp-share-whatsapp {
    background: #25d366;
}

.dw-scp-share-whatsapp:hover {
    background: #20c25a;
}

.dw-scp-share-copy {
    background: #007185;
}

.dw-scp-share-copy:hover {
    background: #005a6b;
}

.dw-scp-share-copy.copied {
    background: #28a745;
}

.dw-scp-modal-close {
    background: #ddd;
    color: #333;
}

.dw-scp-modal-close:hover {
    background: #ccc;
}

/* ===========================
   Responsividade
   =========================== */

@media (max-width: 768px) {
    .dw-scp-item-actions {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .dw-scp-item-actions span {
        display: none;
    }

    .dw-scp-saved-grid,
    .dw-scp-buy-again-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }

    .dw-scp-tabs {
        flex-direction: column;
    }

    .dw-scp-tab {
        width: 100%;
        text-align: left;
    }

    .dw-scp-modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .dw-scp-select-all {
        padding: 8px 10px;
        font-size: 13px;
    }

    .dw-scp-saved-grid,
    .dw-scp-buy-again-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===========================
   Acessibilidade
   =========================== */

.dw-scp-cart-item-selector:focus,
#dw-scp-select-all:focus {
    outline: 2px solid #007185;
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid #007185;
    outline-offset: 2px;
}

/* ===========================
   Animações
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dw-scp-no-items-warning {
    animation: fadeIn 0.3s ease;
}

.dw-scp-modal-overlay {
    animation: fadeIn 0.3s ease;
}

/* ===========================
   Compatibilidade com Temas
   =========================== */

.woocommerce-cart .dw-scp-item-actions a {
    font-weight: normal !important;
}

/* ===========================
   Indicador de Atualização de Frete (sutil)
   =========================== */
.cart_totals.dw-scp-updating,
.cart-collaterals.dw-scp-updating {
    opacity: 0.85;
    pointer-events: none;
    position: relative;
    transition: opacity 0.2s ease;
}

.cart_totals.dw-scp-updating::after,
.cart-collaterals.dw-scp-updating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    z-index: 1;
    pointer-events: none;
}

/* ===========================
   Ocultar Coluna de Remoção
   =========================== */

.woocommerce-cart-form .shop_table th.product-remove,
.woocommerce-cart-form .shop_table td.product-remove {
    display: none !important;
}

tr.dw-scp-row-removing {
    opacity: 0.35;
}

.dw-scp-undo-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.dw-scp-undo-toast button.dw-scp-undo-remove {
    background: #fff;
    color: #111827;
    border: 0;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.dw-scp-undo-toast.dw-scp-restoring {
    opacity: 0.8;
    pointer-events: none;
}

/* ===========================
   Imagem do produto no carrinho
   =========================== */

@media (max-width: 768.98px) {
    .shop-table-with-img td.product-thumbnail img {
        min-width: 80px !important;
        max-width: 80px !important;
        height: auto;
    }
}

@media (max-width: 480px) {
    .shop-table-with-img td.product-thumbnail img {
        min-width: 50px !important;
        max-width: 50px !important;
    }
}