/**
 * WC Products Display Control - Frontend Styles
 *
 * @package WC_Products_Display_Control
 */

/* ── Products Per Page Selector ── */
.wcpdc-per-page-wrap {
    display: flex;
    align-items: center;
    margin: 0 0 1em 0;
    padding: 0;
    float: right;
}

.wcpdc-per-page-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wcpdc-per-page-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin: 0;
    white-space: nowrap;
}

.wcpdc-per-page-select {
    padding: 6px 28px 6px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    min-width: 60px;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
}

.wcpdc-per-page-select:hover,
.wcpdc-per-page-select:focus {
    border-color: #999;
    outline: none;
}

.wcpdc-per-page-suffix {
    font-size: 14px;
    color: #555;
    white-space: nowrap;
}

.wcpdc-custom-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}

.wcpdc-custom-input {
    padding: 5px 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 70px !important;
    text-align: center;
}

.wcpdc-custom-input:focus {
    border-color: #999;
    outline: none;
}

.wcpdc-custom-go.button {
    padding: 5px 12px;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
}

/* ── Multi-Select Toolbar ── */
.wcpdc-multi-select-toolbar {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 16px;
    margin: 0 0 1em 0;
    clear: both;
    transition: all 0.2s ease;
}

.wcpdc-multi-select-toolbar.wcpdc-toolbar-active {
    display: block !important;
    background: #f0f7ff;
    border-color: #b8d4f0;
}

.wcpdc-ms-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.wcpdc-select-all-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    margin: 0;
    white-space: nowrap;
}

.wcpdc-select-all-wrap input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.wcpdc-ms-count {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.wcpdc-ms-count-num {
    font-weight: 600;
    color: #333;
}

.wcpdc-ms-max-info {
    font-size: 12px;
    color: #999;
}

.wcpdc-bulk-add-to-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.wcpdc-bulk-add-to-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.wcpdc-bulk-add-to-cart .wcpdc-btn-icon {
    font-size: 16px;
    line-height: 1;
}

.wcpdc-bulk-add-to-cart.wcpdc-loading {
    pointer-events: none;
    opacity: 0.7;
}

.wcpdc-clear-selection.button {
    padding: 8px 14px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

/* ── Product Checkboxes ── */
.wcpdc-product-checkbox-wrap {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

/* Make product container relative for checkbox positioning */
.products .product {
    position: relative;
}

.wcpdc-product-checkbox-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.wcpdc-product-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.wcpdc-checkbox-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.wcpdc-checkbox-visual:hover {
    border-color: #999;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.wcpdc-product-checkbox:checked + .wcpdc-checkbox-visual {
    background: #2271b1;
    border-color: #2271b1;
}

.wcpdc-product-checkbox:checked + .wcpdc-checkbox-visual::after {
    content: '';
    display: block;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

/* Product selected state */
.products .product.wcpdc-selected {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
    border-radius: 4px;
}

.products .product.wcpdc-selected .wcpdc-checkbox-visual {
    background: #2271b1;
    border-color: #2271b1;
}

/* ── Toast notification ── */
.wcpdc-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    background: #333;
    color: #fff;
    padding: 14px 22px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 380px;
}

.wcpdc-toast.wcpdc-toast-visible {
    transform: translateY(0);
    opacity: 1;
}

.wcpdc-toast.wcpdc-toast-success {
    background: #2e7d32;
}

.wcpdc-toast.wcpdc-toast-error {
    background: #c62828;
}

.wcpdc-toast a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.wcpdc-toast a:hover {
    color: #eee;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .wcpdc-per-page-wrap {
        float: none;
        justify-content: flex-start;
        margin-top: 8px;
    }

    .wcpdc-ms-inner {
        gap: 10px;
    }

    .wcpdc-bulk-add-to-cart {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }

    .wcpdc-clear-selection.button {
        padding: 8px 12px !important;
    }

    .wcpdc-product-checkbox-wrap {
        top: 6px;
        left: 6px;
    }

    .wcpdc-checkbox-visual {
        width: 28px;
        height: 28px;
    }

    .wcpdc-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .wcpdc-per-page-form {
        gap: 4px;
    }

    .wcpdc-per-page-suffix {
        display: none;
    }

    .wcpdc-ms-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
