/* ============================================
   TAG SELECTOR - Modern Grid Design
   ============================================ */

/* Tag Selector Grid */
.tag-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #dee2e6;
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive columns */
@media (max-width: 576px) {
    .tag-selector-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 15px;
    }
}

@media (min-width: 577px) and (max-width: 991px) {
    .tag-selector-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .tag-selector-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tag Item Wrapper */
.tag-item-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Tag Item - Button Style */
.tag-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
    min-height: 48px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex: 1;
}

.tag-item:hover {
    border-color: #0d6efd;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.15);
}

/* Tag Delete Button */
.tag-delete-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: #dc3545;
    border: 2px solid #dc3545;
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.tag-item-wrapper:hover .tag-delete-btn {
    opacity: 1;
    width: 36px;
}

.tag-delete-btn:hover {
    background: #bb2d3b;
    border-color: #bb2d3b;
    transform: translateY(-2px);
}

.tag-delete-btn i {
    font-size: 14px;
}

/* Hide checkbox */
.tag-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Tag Label */
.tag-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    text-align: center;
    transition: all 0.3s ease;
    user-select: none;
}

.tag-label i {
    font-size: 16px;
}

/* Checked State */
.tag-item:has(.tag-checkbox:checked) {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border-color: #0a58ca;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
    transform: translateY(-2px);
}

.tag-item:has(.tag-checkbox:checked) .tag-label {
    color: white;
}

/* Checkmark */
.tag-item::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.tag-item:has(.tag-checkbox:checked)::after {
    opacity: 1;
    transform: scale(1);
}

/* Focus */
.tag-item:focus-within {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Scrollbar */
.tag-selector-grid::-webkit-scrollbar {
    width: 8px;
}

.tag-selector-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.tag-selector-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.tag-selector-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animation */
@keyframes tagSelect {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.tag-item:has(.tag-checkbox:checked) {
    animation: tagSelect 0.3s ease;
}

/* ============================================
   TAG PAGINATION STYLES
   ============================================ */

.tag-pagination-info {
    font-size: 14px;
    color: #6c757d;
    display: flex;
    align-items: center;
}

.tag-pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-pagination-controls .btn-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tag-pagination-controls .btn {
    font-size: 13px;
    padding: 6px 12px;
    border-color: #dee2e6;
    transition: all 0.2s ease;
}

.tag-pagination-controls .btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.tag-pagination-controls .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    font-weight: 600;
}

.tag-pagination-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive pagination */
@media (max-width: 576px) {
    .tag-pagination-info {
        font-size: 12px;
    }
    
    .tag-pagination-controls .btn {
        font-size: 12px;
        padding: 5px 10px;
    }
}
