/* Vzmet Bundle Builder Styles - E-misija Theme */
/* All styles scoped to .vzb-builder to prevent conflicts */

.vzb-builder {
    --vzb-primary: #1a365d;
    --vzb-primary-light: #2c5282;
    --vzb-primary-dark: #0f2440;
    --vzb-accent: #e53e3e;
    --vzb-success: #38a169;
    --vzb-warning: #d69e2e;
    --vzb-gray-50: #f7fafc;
    --vzb-gray-100: #edf2f7;
    --vzb-gray-200: #e2e8f0;
    --vzb-gray-300: #cbd5e0;
    --vzb-gray-400: #a0aec0;
    --vzb-gray-500: #718096;
    --vzb-gray-600: #4a5568;
    --vzb-gray-700: #2d3748;
    --vzb-gray-800: #1a202c;
    --vzb-radius: 8px;
    --vzb-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --vzb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Reset box-sizing within builder */
    box-sizing: border-box;
    margin: 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    clear: both;
}

.vzb-builder *,
.vzb-builder *::before,
.vzb-builder *::after {
    box-sizing: border-box;
}

.vzb-builder-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--vzb-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vzb-builder-title svg {
    width: 28px;
    height: 28px;
}

/* Progress Section */
.vzb-progress-wrapper {
    background: var(--vzb-gray-50);
    border-radius: var(--vzb-radius);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--vzb-gray-200);
    position: sticky;
    top: 100px;
    z-index: 100;
}

.vzb-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.vzb-progress-label {
    font-weight: 600;
    color: var(--vzb-gray-700);
    font-size: 0.95rem;
}

.vzb-progress-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--vzb-primary);
}

.vzb-progress-value .current {
    color: var(--vzb-success);
}

.vzb-progress-value .limit {
    color: var(--vzb-gray-500);
}

.vzb-progress-bar {
    height: 12px;
    background: var(--vzb-gray-200);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.vzb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38a169, #48bb78);
    border-radius: 6px;
    transition: width 0.3s ease, background 0.3s ease;
    position: relative;
}

.vzb-progress-fill.low {
    background: linear-gradient(90deg, #38a169, #48bb78);
}

.vzb-progress-fill.medium {
    background: linear-gradient(90deg, #48bb78, #ecc94b);
}

.vzb-progress-fill.high {
    background: linear-gradient(90deg, #ecc94b, #ed8936);
}

.vzb-progress-fill.very-high {
    background: linear-gradient(90deg, #ed8936, #e53e3e);
}

.vzb-progress-fill.full {
    background: linear-gradient(90deg, #e53e3e, #c53030);
}

.vzb-progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--vzb-gray-500);
}

/* Search & Filters */
.vzb-search-wrapper {
    margin-bottom: 20px;
}

.vzb-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--vzb-gray-200);
    border-radius: var(--vzb-radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
}

.vzb-search-input:focus {
    outline: none;
    border-color: var(--vzb-primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

/* Items Grid */
.vzb-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.vzb-item {
    background: white;
    border: 2px solid var(--vzb-gray-200);
    border-radius: var(--vzb-radius);
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.vzb-item:hover {
    border-color: var(--vzb-primary-light);
    box-shadow: var(--vzb-shadow);
    transform: translateY(-2px);
}

.vzb-item.selected {
    border-color: var(--vzb-primary);
    background: rgba(26, 54, 93, 0.03);
}

.vzb-item-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 12px;
    background: var(--vzb-gray-50);
}

.vzb-item-name {
    font-weight: 600;
    color: var(--vzb-gray-800);
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vzb-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    color: var(--vzb-gray-500);
    margin-bottom: 12px;
}

.vzb-item-price {
    font-weight: 700;
    color: var(--vzb-primary);
}

.vzb-item-weight {
    background: var(--vzb-gray-100);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Quantity Controls */
.vzb-qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vzb-qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: var(--vzb-gray-100);
    color: var(--vzb-gray-600);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vzb-qty-btn:hover {
    background: var(--vzb-primary);
    color: white;
}

.vzb-qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vzb-qty-btn.minus:hover {
    background: var(--vzb-accent);
}

.vzb-qty-value {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--vzb-gray-800);
}

/* Selected Badge */
.vzb-selected-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--vzb-primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Selected Items Summary */
.vzb-selected-summary {
    background: white;
    border: 2px solid var(--vzb-gray-200);
    border-radius: var(--vzb-radius);
    padding: 20px;
    margin-bottom: 24px;
}

.vzb-selected-title {
    font-weight: 700;
    color: var(--vzb-gray-700);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vzb-selected-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vzb-selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--vzb-gray-100);
}

.vzb-selected-item:last-child {
    border-bottom: none;
}

.vzb-selected-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vzb-selected-item-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--vzb-gray-50);
}

.vzb-selected-item-name {
    font-weight: 500;
    color: var(--vzb-gray-700);
    font-size: 0.9rem;
}

.vzb-selected-item-qty {
    color: var(--vzb-gray-500);
    font-size: 0.85rem;
}

.vzb-selected-item-remove {
    background: none;
    border: none;
    color: var(--vzb-gray-400);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.vzb-selected-item-remove:hover {
    color: var(--vzb-accent);
}

/* Empty State */
.vzb-empty-selection {
    text-align: center;
    padding: 30px;
    color: var(--vzb-gray-400);
}

.vzb-empty-selection svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Add to Cart Button */
.vzb-add-to-cart {
    width: 100%;
    padding: 16px 24px;
    background: var(--vzb-primary);
    color: white;
    border: none;
    border-radius: var(--vzb-radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.vzb-add-to-cart:hover {
    background: var(--vzb-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--vzb-shadow-lg);
}

.vzb-add-to-cart:disabled {
    background: var(--vzb-gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.vzb-add-to-cart svg {
    width: 22px;
    height: 22px;
}

/* Loading State */
.vzb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--vzb-gray-400);
}

.vzb-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--vzb-gray-200);
    border-top-color: var(--vzb-primary);
    border-radius: 50%;
    animation: vzb-spin 0.8s linear infinite;
}

@keyframes vzb-spin {
    to { transform: rotate(360deg); }
}

/* Load More */
.vzb-load-more {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--vzb-gray-100);
    border: 2px dashed var(--vzb-gray-300);
    border-radius: var(--vzb-radius);
    color: var(--vzb-gray-600);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
}

.vzb-load-more:hover {
    background: var(--vzb-gray-200);
    border-color: var(--vzb-gray-400);
}

/* Cart Items Display */
.vzb-cart-items {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    font-size: 0.85rem;
}

.vzb-cart-items li {
    padding: 4px 0;
    color: var(--vzb-gray-600);
}

/* WooCommerce Blocks cart - bundle items display */
.wc-block-components-product-details__izbrani-artikli {
    display: block !important;
    width: 100% !important;
}

.wc-block-components-product-details__izbrani-artikli .wc-block-components-product-details__name {
    display: block !important;
    font-weight: 600 !important;
    margin-bottom: 5px !important;
}

.wc-block-components-product-details__izbrani-artikli .wc-block-components-product-details__value {
    display: block !important;
    white-space: pre-line !important;
}

.vzb-selected-items {
    margin: 8px 0 0 0 !important;
    padding: 0 !important;
}

.vzb-selected-items dt {
    float: left;
    clear: left;
    margin: 0 8px 5px 0 !important;
    padding: 0 !important;
    font-weight: normal !important;
}

.vzb-selected-items dd {
    margin: 0 0 5px 0 !important;
    padding: 0 !important;
    text-align: right;
}

.vzb-order-items {
    color: var(--vzb-gray-500);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .vzb-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .vzb-progress-wrapper {
        position: relative;
        top: 0;
    }
    
    .vzb-item {
        padding: 12px;
    }
    
    .vzb-item-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .vzb-items-grid {
        grid-template-columns: 1fr;
    }
}

/* Notice */
.vzb-notice {
    padding: 12px 16px;
    border-radius: var(--vzb-radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.vzb-notice.info {
    background: rgba(26, 54, 93, 0.1);
    color: var(--vzb-primary);
    border: 1px solid rgba(26, 54, 93, 0.2);
}

.vzb-notice.warning {
    background: rgba(214, 158, 46, 0.1);
    color: #975a16;
    border: 1px solid rgba(214, 158, 46, 0.3);
}

/* Modal */
.vzb-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.vzb-modal.active {
    display: flex;
}

.vzb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.vzb-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: vzb-modal-in 0.3s ease;
}

@keyframes vzb-modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.vzb-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vzb-modal-icon svg {
    width: 32px;
    height: 32px;
    color: #d97706;
}

.vzb-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--vzb-gray-800);
    margin: 0 0 12px 0;
}

.vzb-modal-message {
    font-size: 1rem;
    color: var(--vzb-gray-600);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.vzb-modal-btn {
    background: var(--vzb-primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: var(--vzb-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.vzb-modal-btn:hover {
    background: var(--vzb-primary-dark);
    transform: translateY(-1px);
}
