﻿/* ==========================================================================
   Product Tag Autocomplete Component Styles
   ========================================================================== */

.product-tag-autocomplete-container {
    position: relative;
    width: 100%;
}

/* Input Wrapper */
.product-tag-autocomplete-input-wrapper {
    position: relative;
}

    .product-tag-autocomplete-input-wrapper .autocomplete-icon {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #6c757d;
        pointer-events: none;
    }

    .product-tag-autocomplete-input-wrapper .autocomplete-spinner {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

/* Dropdown */
.product-tag-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    margin-top: 0.25rem;
}

/* Suggestion Items */
.product-tag-suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--bs-border-color);
}

    .product-tag-suggestion-item:last-child {
        border-bottom: none;
    }

    .product-tag-suggestion-item:hover {
        background-color: var(--bs-tertiary-bg);
    }

    .product-tag-suggestion-item.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background-color: var(--bs-secondary-bg);
    }

        .product-tag-suggestion-item.disabled:hover {
            background-color: var(--bs-secondary-bg);
        }

    .product-tag-suggestion-item.tag-create-new {
        background-color: var(--bs-primary-bg-subtle);
        color: var(--bs-primary);
        font-weight: 500;
    }

        .product-tag-suggestion-item.tag-create-new:hover {
            background-color: var(--bs-primary);
            color: white;
        }

/* Tag Icons */
.tag-suggestion-icon,
.tag-suggestion-icon-placeholder {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.tag-suggestion-icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--bs-secondary);
}

.tag-suggestion-content {
    flex: 1;
    min-width: 0;
}

    .tag-suggestion-content strong {
        display: block;
        font-size: 0.9375rem;
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tag-suggestion-content small {
        display: block;
        font-size: 0.8125rem;
        line-height: 1.3;
        margin-top: 0.125rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Selected Tags Container */
.selected-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.375rem;
}

.selected-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--bs-primary);
    color: white;
    border-radius: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 500;
}

.selected-tag-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 50%;
}

.btn-remove-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

    .btn-remove-tag:hover {
        background-color: rgba(255, 255, 255, 0.4);
    }

    .btn-remove-tag i {
        font-size: 0.75rem;
    }

/* Popular Tags Section */
.popular-tags-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--bs-border-color);
}

.popular-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.popular-tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 1rem;
}

.popular-tag-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* Validation */
.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--bs-form-invalid-color);
}

/* Scrollbar Styling (for dropdown) */
.product-tag-autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.product-tag-autocomplete-dropdown::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 0 0.375rem 0.375rem 0;
}

.product-tag-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

    .product-tag-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
        background: var(--bs-secondary-color);
    }

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .product-tag-autocomplete-dropdown {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5);
    }
}

/* Responsive */
@media (max-width: 576px) {
    .selected-tag-badge {
        font-size: 0.8125rem;
        padding: 0.25rem 0.625rem;
    }

    .popular-tag-btn {
        font-size: 0.75rem;
        padding: 0.1875rem 0.625rem;
    }
}

/* ==========================================================================
   DRAGGABLE PRODUCT TAG BADGES (for ProductTagUpsert & Product Forms)
   Enhanced visual feedback for drag and drop ordering
   ========================================================================== */

/* Base product tag badge styling */
.badge.product-tag-badge {
    padding: 0.5rem 0.75rem;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.badge.product-tag-badge:hover {
    background-color: #e9ecef !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Drag handle styling */
.product-tag-drag-handle {
    color: #6c757d;
    font-size: 1.25rem;
    line-height: 1;
    cursor: grab;
}

.product-tag-drag-handle:hover {
    color: #495057;
}

/* Product tag order badge */
.product-tag-order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background-color: #0d6efd;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Product tag name */
.product-tag-name {
    flex: 1;
    font-weight: 500;
}

/* Dragging state for product tags */
.product-tag-dragging {
    cursor: grabbing !important;
    opacity: 0.5;
    transform: scale(0.95) rotate(2deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Drop target state for product tags */
.product-tag-drop-target {
    border: 2px dashed #0d6efd !important;
    background-color: #e7f3ff !important;
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

/* Product tag container for drag & drop */
.product-tags-draggable-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.375rem;
    min-height: 60px;
}

/* Dark mode support for product tags */
[data-bs-theme="dark"] .badge.product-tag-badge {
    background-color: #2b3035 !important;
    color: #fff;
}

[data-bs-theme="dark"] .badge.product-tag-badge:hover {
    background-color: #343a40 !important;
}

[data-bs-theme="dark"] .product-tag-drop-target {
    background-color: #1a3a52 !important;
    border-color: #4a9eff !important;
}

[data-bs-theme="dark"] .product-tag-drag-handle {
    color: #adb5bd;
}

[data-bs-theme="dark"] .product-tag-drag-handle:hover {
    color: #dee2e6;
}

/* Responsive adjustments for product tags */
@media (max-width: 768px) {
    .badge.product-tag-badge {
        font-size: 0.875rem;
        padding: 0.4rem 0.6rem;
    }
    
    .product-tag-drag-handle {
        font-size: 1rem;
    }
    
    .product-tag-order-badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.688rem;
    }
}

/* Animation for smooth reordering */
@keyframes product-tag-slide {
    0% {
        transform: translateX(-10px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.badge.product-tag-badge {
    animation: product-tag-slide 0.3s ease-out;
}

/* Hover effect for remove button on product tags */
.badge.product-tag-badge .btn-remove-tag {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.badge.product-tag-badge:hover .btn-remove-tag {
    opacity: 1;
}
