/* Pick 4 Bundle Builder - Main Styles */

/* Variables */
:root {
    --p4bb-primary: #2271b1;
    --p4bb-primary-hover: #135e96;
    --p4bb-success: #00a32a;
    --p4bb-danger: #d63638;
    --p4bb-border: #ddd;
    --p4bb-bg: #f9f9f9;
    --p4bb-white: #fff;
    --p4bb-text: #333;
    --p4bb-text-light: #666;
    --p4bb-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Bundle Builder Container */
.p4bb-bundle-builder {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.p4bb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--p4bb-border);
}

.p4bb-title {
    margin: 0;
    font-size: 28px;
    color: var(--p4bb-text);
}

.p4bb-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
}

.p4bb-counter-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--p4bb-primary);
    color: var(--p4bb-white);
    border-radius: 50%;
    font-size: 20px;
}

/* Filters */
.p4bb-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.p4bb-search-box {
    display: flex;
    flex: 1;
    min-width: 250px;
}

#p4bb-search {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--p4bb-border);
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.p4bb-search-btn {
    padding: 10px 20px;
    background: var(--p4bb-primary);
    color: var(--p4bb-white);
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.3s;
}

.p4bb-search-btn:hover {
    background: var(--p4bb-primary-hover);
}

#p4bb-category-select {
    padding: 10px 15px;
    border: 1px solid var(--p4bb-border);
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

/* Loading */
.p4bb-loading {
    text-align: center;
    padding: 40px;
}

.p4bb-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--p4bb-border);
    border-top-color: var(--p4bb-primary);
    border-radius: 50%;
    animation: p4bb-spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes p4bb-spin {
    to { transform: rotate(360deg); }
}

/* Products Grid */
.p4bb-products-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.p4bb-columns-2 { grid-template-columns: repeat(2, 1fr); }
.p4bb-columns-3 { grid-template-columns: repeat(3, 1fr); }
.p4bb-columns-4 { grid-template-columns: repeat(4, 1fr); }
.p4bb-columns-5 { grid-template-columns: repeat(5, 1fr); }

/* Product Item */
.p4bb-product-item {
    background: var(--p4bb-white);
    border: 2px solid var(--p4bb-border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.p4bb-product-item:hover {
    box-shadow: var(--p4bb-shadow);
    transform: translateY(-2px);
}

.p4bb-product-item.in-bucket {
    border-color: var(--p4bb-success);
    background: #f0f9f4;
}

.p4bb-product-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.p4bb-product-image {
    position: relative;
    overflow: hidden;
    background: var(--p4bb-bg);
}

.p4bb-product-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.p4bb-product-item:hover .p4bb-product-image img {
    transform: scale(1.05);
}

.p4bb-selected-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: var(--p4bb-success);
    color: var(--p4bb-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.p4bb-product-info {
    padding: 15px;
    flex: 1;
}

.p4bb-product-title {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 1.4;
}

.p4bb-product-title a {
    color: var(--p4bb-text);
    text-decoration: none;
    transition: color 0.3s;
}

.p4bb-product-title a:hover {
    color: var(--p4bb-primary);
}

.p4bb-product-price {
    margin-bottom: 10px;
}

.p4bb-original-price {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--p4bb-text);
}

.p4bb-bundle-price-note {
    display: block;
    font-size: 12px;
    color: var(--p4bb-success);
    margin-top: 4px;
}

.p4bb-product-excerpt {
    font-size: 13px;
    color: var(--p4bb-text-light);
    line-height: 1.5;
}

.p4bb-product-actions {
    padding: 15px;
    border-top: 1px solid var(--p4bb-border);
}

.p4bb-add-bucket-btn,
.p4bb-remove-bucket-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.p4bb-add-bucket-btn {
    background: var(--p4bb-primary);
    color: var(--p4bb-white);
}

.p4bb-add-bucket-btn:hover {
    background: var(--p4bb-primary-hover);
}

.p4bb-add-bucket-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.p4bb-remove-bucket-btn {
    background: var(--p4bb-danger);
    color: var(--p4bb-white);
}

.p4bb-remove-bucket-btn:hover {
    background: #b32d2e;
}

/* Pagination */
.p4bb-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
}

.p4bb-prev-page,
.p4bb-next-page {
    padding: 10px 20px;
    background: var(--p4bb-white);
    border: 2px solid var(--p4bb-primary);
    color: var(--p4bb-primary);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.p4bb-prev-page:hover,
.p4bb-next-page:hover {
    background: var(--p4bb-primary);
    color: var(--p4bb-white);
}

.p4bb-prev-page:disabled,
.p4bb-next-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.p4bb-page-info {
    font-size: 16px;
    font-weight: 600;
}

/* Sticky Bucket Widget */
.p4bb-sticky-bucket {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

/* Bucket Widget */
.p4bb-bucket-widget {
    background: var(--p4bb-white);
    border: 2px solid var(--p4bb-primary);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.p4bb-bucket-header {
    background: var(--p4bb-primary);
    color: var(--p4bb-white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.p4bb-bucket-title {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.p4bb-bucket-count-badge {
    background: var(--p4bb-white);
    color: var(--p4bb-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
}

.p4bb-bucket-body {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.p4bb-bucket-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--p4bb-text-light);
}

.p4bb-bucket-empty .dashicons {
    font-size: 48px;
    opacity: 0.3;
}

.p4bb-bucket-empty p {
    margin: 10px 0 5px;
}

.p4bb-bucket-hint {
    font-size: 13px;
    color: var(--p4bb-text-light);
}

.p4bb-bucket-items {
    padding: 10px;
}

.p4bb-bucket-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--p4bb-bg);
    border-radius: 6px;
    transition: background 0.3s;
}

.p4bb-bucket-item:hover {
    background: #efefef;
}

.p4bb-bucket-item-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 4px;
    background: var(--p4bb-white);
}

.p4bb-bucket-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.p4bb-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--p4bb-border);
    color: #999;
}

.p4bb-bucket-item-info {
    flex: 1;
}

.p4bb-bucket-item-name {
    margin: 0 0 5px;
    font-size: 14px;
    line-height: 1.3;
}

.p4bb-bucket-item-price {
    font-size: 13px;
    color: var(--p4bb-success);
    font-weight: 600;
}

.p4bb-bucket-remove-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--p4bb-danger);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p4bb-bucket-remove-btn:hover {
    background: var(--p4bb-danger);
    color: var(--p4bb-white);
}

.p4bb-bucket-footer {
    padding: 15px 20px;
    border-top: 2px solid var(--p4bb-border);
    background: var(--p4bb-white);
}

.p4bb-bucket-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 700;
}

.p4bb-total-price {
    color: var(--p4bb-success);
}

.p4bb-bucket-progress {
    margin-bottom: 15px;
}

.p4bb-progress-bar {
    height: 8px;
    background: var(--p4bb-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.p4bb-progress-fill {
    height: 100%;
    background: var(--p4bb-success);
    transition: width 0.3s;
}

.p4bb-progress-text {
    margin: 0;
    font-size: 13px;
    text-align: center;
    color: var(--p4bb-text-light);
}

.p4bb-bucket-actions {
    display: flex;
    gap: 10px;
}

.p4bb-clear-bucket-btn,
.p4bb-checkout-btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.p4bb-clear-bucket-btn {
    background: transparent;
    border: 2px solid var(--p4bb-danger);
    color: var(--p4bb-danger);
}

.p4bb-clear-bucket-btn:hover {
    background: var(--p4bb-danger);
    color: var(--p4bb-white);
}

.p4bb-checkout-btn {
    background: var(--p4bb-success);
    color: var(--p4bb-white);
}

.p4bb-checkout-btn:hover {
    background: #008a24;
}

.p4bb-checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* No Products */
.p4bb-no-products {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--p4bb-text-light);
    font-size: 18px;
}

/* Responsive */
@media (max-width: 1024px) {
    .p4bb-columns-4 { grid-template-columns: repeat(3, 1fr); }
    .p4bb-columns-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .p4bb-columns-3,
    .p4bb-columns-4,
    .p4bb-columns-5 { grid-template-columns: repeat(2, 1fr); }
    
    .p4bb-sticky-bucket {
        right: 10px;
        width: calc(100% - 20px);
        max-width: 350px;
    }
    
    .p4bb-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .p4bb-columns-2,
    .p4bb-columns-3,
    .p4bb-columns-4,
    .p4bb-columns-5 { grid-template-columns: 1fr; }
    
    .p4bb-filters {
        flex-direction: column;
    }
    
    .p4bb-search-box {
        min-width: 100%;
    }
}
